Custom navigation with Navigator component in React-Native

后端 未结 4 2032
小鲜肉
小鲜肉 2021-01-29 17:46

I’m exploring possibilities of React Native while developing a demo app with custom navigation between views with the help of Navigator component.

The main app class ren

相关标签:
4条回答
  • 2021-01-29 18:23

    Navigator component is deprecated now. You could use react-native-router-flux by askonov, it has a huge variety and supports many different animations and is efficient

    0 讨论(0)
  • 2021-01-29 18:34

    Your approach should work great. In big apps at Fb, we avoid calling the require() for the scene component until we render it, which can save a bit of start-up time.

    The renderScene function should be called when the scene is first pushed to the Navigator. It will also be called for the active scene when the Navigator gets re-rendered. If you see renderScene get called multiple times after a push, then it is probably a bug.

    The navigator is still a work in progress, but if you find any problems with it please file on github and tag me! (@ericvicenti)

    0 讨论(0)
  • 2021-01-29 18:44

    Navigator is deprecated now in RN 0.44.0 you can use react-native-deprecated-custom-components instead to support your existing application that is using Navigator.

    0 讨论(0)
  • 2021-01-29 18:45

    As others have previously mentioned, Navigator has been deprecated since v0.44, but can still be imported to support older applications:

    Navigator has been removed from the core React Native package in version 0.44. The module has been moved to a react-native-custom-components package that can be imported by your application in order to maintain backwards compatibility.

    To see the original docs for Navigator, please switch to an older version of the docs.

    As per the docs (React Native v0.54) Navigating Between Screens. It is now recommended to use React Navigation if you are just getting started, or NavigatorIOS for non-Android applications

    If you are just getting started with navigation, you will probably want to use React Navigation. React Navigation provides an easy to use navigation solution, with the ability to present common stack navigation and tabbed navigation patterns on both iOS and Android.

    ...

    If you're only targeting iOS, you may want to also check out NavigatorIOS as a way of providing a native look and feel with minimal configuration, as it provides a wrapper around the native UINavigationController class.

    NB: At the time of providing this answer, React Native was at version 0.54

    0 讨论(0)
提交回复
热议问题