react-native 中 navigator 和 navigatorIOS 有什么区别?
What is different between navigator and navigatorIOS in react-native?
看看fb的文档就知道了。
react-native中navigator和navigatorIOS有什么区别?
Navigator是你应用中不同场景之间的过渡,可以看作是一个动画。
NavigatorIOS 包装了 UIKit 导航,它将推送或弹出一个控制器,并且表现得更像一个 Native 导航。
官方文档中曾经有过两者的对比。不确定为什么自 0.31 起将其删除。您仍然可以从 google 缓存版本中获取它:
Navigator Comparison
The differences between Navigator and NavigatorIOS are a common source
of confusion for newcomers.
Both Navigator and NavigatorIOS are components that allow you to
manage the navigation in your app between various "scenes" (another
word for screens). They manage a route stack and allow you to pop,
push, and replace states. In this way, they are similar to the html5
history API. The primary distinction between the two is that
NavigatorIOS leverages the iOS UINavigationController class, and
Navigator re-implements that functionality entirely in JavaScript as a
React component. A corollary of this is that Navigator will be
compatible with Android and iOS, whereas NavigatorIOS will only work
on the one platform. Below is an itemized list of differences between
the two.
Navigator #
- Extensive API makes it completely customizable from JavaScript.
- Under active development from the React Native team.
- Written in JavaScript.
- Works on iOS and Android.
- Includes a simple navigation bar component similar to the default NavigatorIOS bar: Navigator.NavigationBar, and another with
breadcrumbs called Navigator.BreadcrumbNavigationBar.
- See the UIExplorer demo to try them out and see how to use them. Currently animations are good and improving, but they are still less
refined than Apple's, which you get from NavigatorIOS.
- You can provide your own navigation bar by passing it through the navigationBar prop.
NavigatorIOS #
- Small, limited API makes it much less customizable than Navigator in its current form.
- Development belongs to open-source community - not used by the React Native team on their apps. A result of this is that there is
currently a backlog of unresolved bugs, nobody who uses this has
stepped up to take ownership for it yet.
- Wraps UIKit, so it works exactly the same as it would on another native app. Lives in Objective-C and JavaScript. Consequently, you
get the animations and behaviour that Apple has developed. iOS only.
- Includes a navigation bar by default; this navigation bar is not a React Native view component and the style can only be slightly
modified.
根据我的经验,navigatorIOS 目前有很多问题,我建议改用 Navigator。如果你看一下 Facebook F8 应用程序,他们使用的是 Navigator 而不是 navigatorIOS。
看看fb的文档就知道了。
react-native中navigator和navigatorIOS有什么区别?
Navigator是你应用中不同场景之间的过渡,可以看作是一个动画。
NavigatorIOS 包装了 UIKit 导航,它将推送或弹出一个控制器,并且表现得更像一个 Native 导航。
官方文档中曾经有过两者的对比。不确定为什么自 0.31 起将其删除。您仍然可以从 google 缓存版本中获取它:
Navigator Comparison
The differences between Navigator and NavigatorIOS are a common source of confusion for newcomers.
Both Navigator and NavigatorIOS are components that allow you to manage the navigation in your app between various "scenes" (another word for screens). They manage a route stack and allow you to pop, push, and replace states. In this way, they are similar to the html5 history API. The primary distinction between the two is that NavigatorIOS leverages the iOS UINavigationController class, and Navigator re-implements that functionality entirely in JavaScript as a React component. A corollary of this is that Navigator will be compatible with Android and iOS, whereas NavigatorIOS will only work on the one platform. Below is an itemized list of differences between the two.
Navigator #
- Extensive API makes it completely customizable from JavaScript.
- Under active development from the React Native team.
- Written in JavaScript.
- Works on iOS and Android.
- Includes a simple navigation bar component similar to the default NavigatorIOS bar: Navigator.NavigationBar, and another with
breadcrumbs called Navigator.BreadcrumbNavigationBar.- See the UIExplorer demo to try them out and see how to use them. Currently animations are good and improving, but they are still less
refined than Apple's, which you get from NavigatorIOS.- You can provide your own navigation bar by passing it through the navigationBar prop.
NavigatorIOS #
- Small, limited API makes it much less customizable than Navigator in its current form.
- Development belongs to open-source community - not used by the React Native team on their apps. A result of this is that there is currently a backlog of unresolved bugs, nobody who uses this has
stepped up to take ownership for it yet.- Wraps UIKit, so it works exactly the same as it would on another native app. Lives in Objective-C and JavaScript. Consequently, you
get the animations and behaviour that Apple has developed. iOS only.- Includes a navigation bar by default; this navigation bar is not a React Native view component and the style can only be slightly
modified.
根据我的经验,navigatorIOS 目前有很多问题,我建议改用 Navigator。如果你看一下 Facebook F8 应用程序,他们使用的是 Navigator 而不是 navigatorIOS。