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)
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
.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With