I am trying to post rowdata to another activity. But data i posted seems to be empty.

I tried binding functions together.

constructor(props) {
  super(props);
  this.renderRow = this.renderRow.bind(this);
  this.state = {data: [],uid:0,diyetId:0 };
  }
   Send_Data_Function(data) {
  console.log(this.state.dietId)
  this.props.navigation.navigate('DiyetOkuma', {
    dietId: data })}
   renderRow(data) {
  return (
    <View>
    <Tile style={styles.tileContainer}>
    <TouchableOpacity onPress={() => this.Send_Data_Function.bind(this,data.dietid)}>
     <Title style={styles.title}>{data.dietid}</Title>
     </TouchableOpacity>
     <TouchableOpacity onPress={(data) => this.Send_Data_Function(data)}><Text>git</Text></TouchableOpacity>
     </Tile>
 </View>
  );
}
render() {
const data = this.state.data;
return (
<Screen style={styles.container}>
<StatusBar barStyle="light-content"/>
 <ListView
    data={data}
    renderRow={this.renderRow}
  />
</Screen>   
 );}}

When i click on row i want rowdata to post to another activity.

0 Answers