本文介绍了React 导航与 React Native 导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道关于这两个在 React Native 中实现导航的方法的诚实、有经验和客观的观点:

I just want to know honest, experienced and objetive points of view about these two soutions to implement the navigation in React Native:

哪个更好,为什么.谢谢

Which is better and why. Thanks

推荐答案

从今天(07/2020)我建议使用 React 导航 v5.这是 Facebook 最推崇的社区解决方案.V5 重写完全改变了游戏规则,并且远远优于以前的版本.大多数情况下,设置和实现简单/复杂的堆栈都轻而易举.

NEW As of today (07/2020) I suggest using React Navigation v5. It's the community solution being most pushed by Facebook. The V5 rewrite was a complete game changer and is far superior to previous versions. Easy to get setup and implementing easy/complicated stacks is a breeze most of the time.

如果这不适合你,另一种选择是 react-native-navigation 来自 WIX(不幸的是与 expo 不兼容).

If that's not doing it for you another alternative is react-native-navigation by WIX (not compatible with expo unfortunately).

React Native Navigation 顾名思义使用带有一个 JS 桥,所以性能会/可能会更好.这需要原生集成.

React Native Navigation as the name says uses the native modules with a JS bridge, so performance will/may be better. This requires native integration.

虽然 React Navigation 是由 React Native 本身提供的简单而强大的解决方案.它是一个全 JS 实现,与使用本机支持的其他实现不同,这可能很棘手.只需 npm-install 就可以了...

While React Navigation is a simple and powerful solution provided by react native itself. Its an all JS implementation unlike the other that uses native support which can be tricky. Just npm-install and you're good to go ...

如果您更喜欢所有 JS 实现,请使用反应导航,如果您的最高优先级在于性能,请使用原生导航.

Use react navigation if you prefer an all JS implementation and use native navigation if your highest priority lies in performance .

  • 两个库都发生了巨大的变化,并进入了下一个稳定版本.react-navigation 现在更加稳定和高效.如果您必须在 js 中处理复杂的计算,请使用 react-native-navigation.但在大多数情况下,react-navigation 对你有用!
  • 随着 react-native-screens 的出现,原生屏幕优化是通过引入本机导航组件(iOS 的 UIViewController 和 Android 的 FragmentActivity)使反应导航成为可能参考这里
  • Both libs have undergone drastic changes and entered next stable versions. react-navigation is more stable and performant now. If you have to handle complex computations in js go for react-native-navigation. but in most cases react-navigation will work for you!
  • With the advent of react-native-screens, the native screen optimisation is brought possible to react-navigation by bringing the native navigation component (UIViewController for iOS, and FragmentActivity for Android) Refer here

对于那些从用户体验的角度来看的人,两者都提供了几乎相同的动画和流程,因此您不会知道幕后使用了什么库.

For those who are looking from a user experience view, both provides almost identical animations and flow so that you wouldn't know what lib is used behind the scenes.

这两个库都是 React Native 的最佳导航解决方案之一.根据您的需要/偏好使用它.

Both libs are amongst the best navigation solutions for React Native. Use it according to your need/preference.

这篇关于React 导航与 React Native 导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 11:15