使用平面列表获取类型错误将数据发送到另一个屏幕

时间:2018-08-30 07:02:43

标签: react-native react-native-android react-navigation react-native-flatlist

嘿,使用平面列表将数据发送到另一个屏幕时,我遇到了错误。 收到类型错误  TYPE ERROR  并且未定义这不是对象我该如何解决...

项目数组

Recommended : [
                         {"Rimage":require("./assets/image/pulses1.jpg"),
                         "name":"Corn-NK6240","name2":"Syngenta","Price":"INR 30/KG"},
                         {"Rimage":require("./assets/image/pulse2.jpg"),
                         "name":"Corn-NK6240","name2":"Syngenta","Price":"INR 30/KG"},
                         {"Rimage":require("./assets/image/pulse2.jpg"),
                         "name":"Corn-NK6240","name2":"Syngenta","Price":"INR 30/KG"},
                         {"Rimage":require("./assets/image/turmeric.jpg"),
                         "name":"Cabbage-NK6240","name2":"Syngenta","Price":"INR 30/KG"},
                         {"Rimage":require("./assets/image/pulses1.jpg"),
                         "name":"Corn-NK56240","name2":"Syngenta","Price":"INR 80/KG"},
                       ],

和具有扁平列表的该主类

class Mainclass extends Component {

    render() {
        return (
            <FlatList
                data={data}
                numColumns={2}
                keyExtractor={_keyExtractor}
                <FlatList data={this.state.Recommended}
      contentContainerStyle={{  flexDirection: 'row',justifyContent:'space-between'
    }}
       renderItem={({item,key}) =>

       <TouchableOpacity onPress={()=>navigate('Product', { ListViewClickItemHolder: item })} >

        <View style={{flexDirection:'row'}}>
        <View style={{flexDirection:'column',alignItems:'center',padding:3,width:(width-200)/2}}>
          <View style={{padding:3,borderWidth:1,borderColor:'#dfdfe0'}}>
          <Image style={{height:90,width:90}}  source={item.Rimage} /></View>
          <Text style={{fontFamily:'Montserrat',fontSize:width/30,}} numberOfLines={1}>{item.name}</Text>
          <Text style={{fontFamily:'Montserrat',fontSize:width/30}} numberOfLines={1}>{item.name2}</Text>
          <Text style={{color:'#4e9dda',fontFamily:'Montserrat',fontSize:width/30}}>{item.Price}</Text>
        </View>
      </View>
      </TouchableOpacity>
      }/>
            />
        );
    }
  }

我需要接收数据的屏幕

<Text style={{fontSize:width / 14,fontFamily:'CRC55',color:'black',}}> {this.props.navigation.state.getParam.ListViewClickItemHolder}</Text>

0 个答案:

没有答案