react-native - 如何调用 Actions.pop() 并刷新之前的场景? React Native、Redux、React-Native-Router-Flux

标签 react-native react-redux react-native-router-flux

我想在用户创建记录后将用户重定向到之前的屏幕,同时刷新之前的列表屏幕以反射(reflect)新记录

这是我的 Action 文件中的函数

fetch(CREATE_POST, request).then(response => {
        dispatch({ type: action });
        Actions.pop();
        setTimeout(() => { Actions.refresh({}) }, 10);
    }).catch(error => {
        console.log(error);
    });

但是,当调用 Actions.pop() 时,它会将我带到上一个屏幕但不会刷新它。

我试过 Actions.pop({ type: reset }) 但没有成功

非常感谢任何帮助!

最佳答案

你试过Actions.pop({ refresh: {} }) 或者,如果您想更具体地说明应该刷新哪些 Prop ,您实际上可以指定 Actions.pop({ refresh: { user: res.user } })

关于react-native - 如何调用 Actions.pop() 并刷新之前的场景? React Native、Redux、React-Native-Router-Flux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53236591/

相关文章:

javascript - 如何使用react-native显示/隐藏内容?

javascript - 将一个对象分配给另一个不带所有字段的对象

javascript - 使用 React 和 Redux 的收藏夹购物车

javascript - react ,Redux webpack 错误

javascript - react-native-router-flux 不路由

react-native - 如何从 react native 路由器流量中删除动画

react-native - 使用react-native-router-flux自定义navBar

react-native - React Native 链接/图标样式

javascript - React-Native for-loop through large size array 性能问题

react-native - Reducer 在初始化期间返回 undefined 但在 reducer 开关中返回 initialState 作为默认值