简体   繁体   English

React native modal vs react-navigation modal,哪个性能更好?

[英]React native modal vs react-navigation modal, which is more performant?

As of now, I am using React native modal right now.截至目前,我正在使用 React 原生模式。 My modal contains some lightweight animation inside it.我的模态在其中包含一些轻量级动画。 Now some questions are poking for a while.现在有些问题正在酝酿一段时间。 Should I use react native Modal, which is built-in, or Should I use react-navigation full screen modal?我应该使用内置的 react native Modal,还是应该使用 react-navigation 全屏模式? Which is mode performant?哪个是模式性能? It may vary from situation to situation, but where should I use the react-native modal and react-navigation Modal?它可能因情况而异,但我应该在哪里使用 react-native modal 和 react-navigation Modal? Which is more performant?哪个性能更高?

Modals usually work with performance.模态通常与性能一起使用。 I usually use this and I haven't had any performance issues.我通常使用它并且我没有任何性能问题。

https://github.com/react-native-modal/react-native-modal https://github.com/react-native-modal/react-native-modal

React navigation modal creates a modal as separate screen while React native modal is a component. React 导航模式将模式创建为单独的屏幕,而 React 原生模式是一个组件。

I've had cases where my modal doesn't display over all screens when using react native modal.在使用 react native modal 时,我的模态不会显示在所有屏幕上的情况。

But using React navigation Modal approach, you are sure it displays it over all screens.但是使用 React 导航模态方法,您确定它会在所有屏幕上显示它。

A modal is like a popup — but in react navigation, it's not part of your primary navigation flow. modal 就像一个弹出窗口——但在反应导航中,它不是你的主要导航流程的一部分。 This can also be a problem in some cases.在某些情况下,这也可能是一个问题。

React native modal is lighter though, it's just a component. React native modal 更轻巧,它只是一个组件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM