【发布时间】:2020-08-27 08:44:42
【问题描述】:
可以将“list”参数传递给 screen1 和 screen2 而无需导航到 screen2
在我的示例中,我在导航到 screen1 时将参数数据“列表”移动到 screen1,我也想在 screen2 中使用此参数,该怎么做? 我需要使用钩子和导航 5。
onPress={() => {
const fromDate = params.fromDate;
const toDate = params.toDate;
if (
Array.isArray(listSelectedWaterSourceCode) === true &&
listSelectedWaterSourceCode.length > 0
) {
ListOfTheFlat(listSelectedWaterSourceCode, fromDate, toDate)
.then((list) => {
navigation.navigate('screen1', {
list,
});
})
.catch((error) => {
console.log(error);
});
}
}}
【问题讨论】:
标签: javascript reactjs react-native react-hooks react-navigation