Skip to content

Commit 6c832d6

Browse files
committed
Merge pull request #54 from sunnylqm/patch-1
fix warnings about keys for dots
2 parents e28af9b + dd7c324 commit 6c832d6

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/index.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -333,27 +333,23 @@ export default React.createClass({
333333
if(this.state.total <= 1) return null
334334

335335
let dots = []
336+
let CustomDot = this.props.dot
337+
let CustomActiveDot = this.props.activeDot
336338
for(let i = 0; i < this.state.total; i++) {
337339
dots.push(i === this.state.index
338-
? (this.props.activeDot || <View style={{
340+
? (<CustomActiveDot key={i} /> || <View key={i} style={{
339341
backgroundColor: '#007aff',
340342
width: 8,
341343
height: 8,
342344
borderRadius: 4,
343-
marginLeft: 3,
344-
marginRight: 3,
345-
marginTop: 3,
346-
marginBottom: 3,
345+
margin: 3
347346
}} />)
348-
: (this.props.dot || <View style={{
347+
: (<CustomDot key={i} /> || <View key={i} style={{
349348
backgroundColor:'rgba(0,0,0,.2)',
350349
width: 8,
351350
height: 8,
352351
borderRadius: 4,
353-
marginLeft: 3,
354-
marginRight: 3,
355-
marginTop: 3,
356-
marginBottom: 3,
352+
margin: 3
357353
}} />)
358354
)
359355
}

0 commit comments

Comments
 (0)