Open flixyudh opened 6 years ago
I have this code :
class Medicine extends Component { constructor(){ super() this.onEventPress = this.onEventPress.bind(this) this.renderSelected = this.renderSelected.bind(this) this.renderDetail = this.renderDetail.bind(this) this.state = {selected: '', visible:false} } onEventPress(data){ this.setState({selected: data, visible:true}) } renderImage(){ console.log(this.state.selected) return <Image style={{width:DeviceWidth*0.3, height:DeviceWidth*0.3}} source={{uri: this.state.selected.url}}/> } renderDetail(rowData, sectionID, rowID){ let title = <Text style={[global.global.SubHeaderText, {color:'green'}]}>{rowData.time}</Text> var desc = ( <View> <View style={{flexDirection:'row'}}> <Text style={[global.global.TextBold, {width:DeviceWidth*0.17}]}>Radiology </Text> <Text style={[global.global.Text, {flexWrap:'wrap', width:DeviceWidth*0.7}]}>{rowData.cat}</Text> </View> <View style={{flexDirection:'row'}}> <Text style={[global.global.TextBold, {width:DeviceWidth*0.17}]}>Description </Text> <Text style={[global.global.Text, {flexWrap:'wrap', width:DeviceWidth*0.7}]}>{rowData.description == null ? '-' : rowData.description}</Text> </View> {this.renderImage()} </View> ) return ( <View style={{flex:1}}> {title} {desc} </View> ) } render() { return ( <View style={{flex:1}}> <Timeline style={{flex: 1, marginTop:20}} showTime={false} separator={true} renderFullLine={true} circleColor={'green'} lineColor={'green'} data={this.data} onEventPress={this.onEventPress} renderDetail={this.renderDetail} /> </View> ); } }
I want to show image on specific listview, but everytime I pressed an object of Listview, the image showing on all listview with the same image I've pressed,
How to displaying only one image while onPressed triggered?
I have this code :
I want to show image on specific listview, but everytime I pressed an object of Listview, the image showing on all listview with the same image I've pressed,
How to displaying only one image while onPressed triggered?