javascript - React-native ListView keys -


i'm getting warning on app bothers me. react keeps saying need add key each row, no matter cannot add these keys.

my code looks this:

 <listview    style={styles.listview}    datasource={this.state.favs}    renderseparator={() => <view style={styles.listseparator}/>}    renderrow={(rowdata,i) => <card data={rowdata}              onpress={this.oncardpress.bind(this,rowdata)} /> } /> 

i try add key on component <card key={rowdata.id}/>/ , tried key props inside component , add in first element of component on case touchbleopacity

<touchablewithoutfeedback         key={this.props.key}         style={styles.cardbtn}> 

someone hive me hint? or should should ignore warning?

actually renderrow gets 4 arguments (rowdata, sectionid, rowid, highlightrow) , , need third , not second one.

renderrow={(rowdata, sectionid, rowid) => <card key={rowid} data={rowdata}              onpress={this.oncardpress.bind(this,rowdata)} /> } 

reference: facebook.github.io/react-native/docs/listview.html#renderrow


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -