React Navigator无法正常工作,也无法移至下一个屏幕

时间:2019-05-24 05:15:05

标签: react-native react-navigation

我正在尝试在两个屏幕之间执行导航,但是它不起作用。这是我的代码。

<FlatList
            style={{ paddingBottom: 5 }}
            data={this.state.fetchFreelancer}
            keyExtractor={(y, z) => z.toString()}
            renderItem={({ item }) => (
                <TouchableOpacity   
      // onPress={() => navigate('Details', {id: item.id})}
             onPress={() => this.props.navigation.navigate('DetailFreelancerScreen', {profile_id: item.profile_id})}
            //onPress={() => alert(item.profile_id)}
                >
                <FreelancerCategory
                    imageUrifreelancer = {{uri: `${item.profile_img}`}}
                    imageUrifeatured = {{uri: `${item.badge.badget_url}`}}
                    featuredColor ={`${entities.decode(item.badge.badget_color)}`}
                    flagimageUri= {{uri: `${item.location.flag}`}}
                    freelancername={`${entities.decode(item.name)}`}
                    title={`${entities.decode(item._tag_line)}`}
                    rate={`${entities.decode(item._perhour_rate)}`}
                    country={`${entities.decode(item.location._country)}`}
                /> 
            </TouchableOpacity>
            )}
          />

1 个答案:

答案 0 :(得分:0)

您应该将导航道具传递到屏幕上。

ref