listview - Disable a specific Button on click in react native -


i have list of buttons on react native (around 3000 buttons) listed on listview component.

how disable button number 365 on button click?

you have not mentioned key point here, how plan disable button? want disable button in response action or want disable button by-default? please specify. i'm assuming few things here-

  1. you want disable button upon action, have maintain state.
  2. you have used touchablehighlight or touchablewithoutfeedback

use rowid intelligently disable exact item. populate array of disaled ids , accordingly disable item.

your render method renders listview

render: function(){     return(         <listview             datasource={this.state.datasource}             renderrow={(rowdata, sectionid, rowid) => renderitem.bind(this, rowid)}             style={styles.listview}         />     ); }, renderitem: function(id){     return <item id={id} enabled={this.state.isenabled} data={{name: 'foo', details: 'bar'}} /> } 

item component have own functions , state , props.

render: function(){     return(         <touchablehighlight underlaycolor={'#939393'} onpress={this.onpressitem}>             <view style={styles.container}>                 <text>{this.props.data.name}</text>                 <text>{this.props.data.details}</text>             </view>         </touchablehighlight>     ) }, onpressitem: function(){     if(this.props.enabled){         //do     }     else{         //do nothing     } } 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -