react-native-navigation and redux



如何使用 react-native-navigation 编写 redux 数据流? 这是我的代码:

- Navigation.registerComponent('Scan', () => props => (   <Provider
store={store}>
<ScanScreen {...props} />   </Provider> ))

你需要从 react-native-navigation 中使用registerComponentWithRedux而不是registerComponent

而且,您无需在提供程序中手动包装组件。

请参考下面的代码片段进行集成:

Navigation.registerComponentWithRedux(
"your_route_name",
() => YourScreenComponent,
Provider,
store
);

在上面的代码片段中:

  1. 您将从以下位置获取提供程序:从"react-redux"导入 {提供程序};
  2. 存储
  3. ,你使用redux配置存储方法配置

最新更新