@@ -46,14 +46,15 @@ class Card extends Component{
46
46
47
47
class SCard extends Component {
48
48
static propTypes = {
49
+ id : React . PropTypes . string . isRequired ,
49
50
top : React . PropTypes . number . isRequired ,
50
51
width : React . PropTypes . number . isRequired ,
51
52
img : React . PropTypes . string . isRequired ,
52
53
} ;
53
54
54
55
render ( ) {
55
56
return (
56
- < View style = { [ styles . scard , { top :this . props . top , width :this . props . width } ] } >
57
+ < View key = { this . props . id } style = { [ styles . scard , { top :this . props . top , width :this . props . width } ] } >
57
58
< Image style = { { width :this . props . width - 2 , height :350 } } source = { { uri :this . props . img } } > </ Image >
58
59
< View style = { styles . cardInfo } >
59
60
< View >
@@ -82,7 +83,7 @@ class SwipeCard extends Component{
82
83
// const simgs = ["https://media.giphy.com/media/GfXFVHUzjlbOg/giphy.gif","https://media.giphy.com/media/irTuv1L1T34TC/giphy.gif","https://media.giphy.com/media/LkLL0HJerdXMI/giphy.gif","https://media.giphy.com/media/fFBmUMzFL5zRS/giphy.gif","https://media.giphy.com/media/oDLDbBgf0dkis/giphy.gif"];
83
84
const names = [ "Stuart" , "Bob" , "Kevin" , "Dave" , "Jerry" ] ;
84
85
const cards = simgs . map ( function ( elem , index ) {
85
- return { img :simgs [ 4 - index ] , name :names [ 4 - index ] , top :13 + index * 4 , width :Util . size . width - 22 - index * 4 , }
86
+ return { id : "sc" + index , img :simgs [ 4 - index ] , name :names [ 4 - index ] , top :13 + index * 4 , width :Util . size . width - 22 - index * 4 , }
86
87
} )
87
88
88
89
this . state = {
@@ -102,7 +103,7 @@ class SwipeCard extends Component{
102
103
return (
103
104
< SwipeCards
104
105
cards = { this . state . cards }
105
- renderCard = { ( cardData ) => < SCard { ...cardData } /> }
106
+ renderCard = { ( cardData ) => < SCard key = { cardData . id } { ...cardData } /> }
106
107
handleYup = { ( ) => this . handleYup ( ) }
107
108
handleNope = { ( ) => this . handleNope ( ) }
108
109
showYup = { false }
0 commit comments