Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 将本地移动平面列表从一个屏幕移动到另一个屏幕_React Native - Fatal编程技术网

React native 将本地移动平面列表从一个屏幕移动到另一个屏幕

React native 将本地移动平面列表从一个屏幕移动到另一个屏幕,react-native,React Native,我已经用用户身份验证完成了firebase。每个结果都显示在一个平面列表中。单击心形图标后,我想将所选项目移动到收藏夹屏幕 Result.id.toString()} renderItem={({item})=>{ //console.log(item.id); 返回( { 导航。导航(“结果显示屏幕”{ id:item.id, image:item.image, }); }} > ); }} /> 屏风 您可以通过读取路由的route.params对象的属性来实现这一点。像这样: 函数

我已经用用户身份验证完成了firebase。每个结果都显示在一个平面列表中。单击心形图标后,我想将所选项目移动到收藏夹屏幕

Result.id.toString()}
renderItem={({item})=>{
//console.log(item.id);
返回(
{
导航。导航(“结果显示屏幕”{
id:item.id,
image:item.image,
});
}}
>
);
}}
/>


屏风

您可以通过读取路由的
route.params
对象的属性来实现这一点。像这样:

函数收藏夹({route}){
const{id,image}=route.params;
返回(
...
);
}
请记住,当按下
TouchableOpacity
时,这只会显示您通过的
id
image
。如果需要所有收藏夹的列表,则需要将它们存储在类似数组的数据结构中(并在项目伪造/未伪造时修改数组),然后将该数组传递给


有关此功能的完整参考信息,您可以阅读React导航文档的页面。

感谢您的快速响应!。我现在可以将所需数据传递到收藏夹屏幕。你有保存收藏列表的资源吗。它需要异步存储吗。非常感谢。
  <FlatList
     contentContainerStyle={ { alignSelf:"center",}}
        data={Results}
        keyExtractor={(Result) => Result.id.toString()}
        renderItem={({ item }) => {
          // console.log(item.id);
          return (

            <TouchableOpacity
              onPress={() => {
                navigation.navigate("ResultsShowScreen", {
                  id: item.id,
                  image: item.image,
                });
              }}
            >
              <ResultsDetail Result={item} />
            </TouchableOpacity>
          );
        }}
      />
    </View>
<View>
      <Text> Screen</Text>
    </View>