How should the new context api work with React Native navigator?

后端 未结 4 781
野性不改
野性不改 2021-01-30 18:37

I created a multiscreen app using React Navigator following this example:

import {
  createStackNavigator,
} from \'react-navigation\';

const App = createStackN         


        
4条回答
  •  余生分开走
    2021-01-30 19:00

    https://wix.github.io/react-native-navigation/docs/third-party-react-context/

    As RNN screens are not part of the same component tree, updating the values in the shared context does not trigger a re-render across all screens. However you can still use the React.Context per RNN screen component tree.

    If you need to trigger a re-render across all screens, there are many popular third party libraries such as MobX or Redux.

提交回复
热议问题