react-navigation 从 v5 升级到 v6 时,是否还要在顶部引入 react-native-gesture-handler?

When upgrading react-navigation from v5 to v6, should we still import react-native-gesture-handler at the top?

react-navigation v5 的文档提到了这一点:

To finalize installation of react-native-gesture-handler, add the following at the top (make sure it's at the top and there's nothing else before it) of your entry file, such as index.js or App.js

Note: If you are building for Android or iOS, do not skip this step, or your app may crash in production even if it works fine in development. This is not applicable to other platforms.

v6 是当前最新的,它没有在任何地方提到它:https://reactnavigation.org/docs/getting-started/

它甚至没有说您必须先安装 react-native-gesture-handler

并且升级指南没有说您必须删除它:https://reactnavigation.org/docs/upgrading-from-5.x/

现在我问的原因是因为 v5 文档说你的应用程序可能会在生产中崩溃,即使它在开发中工作。那就是如果你不 import 'react-native-gesture-handler' 在顶部。

我目前的情况是,我的应用程序在开发中运行,在生产中崩溃。我正在使用 react-navigation 的 v6,并且我仍然在顶部导入 react-native-gesture-handler。这让我想知道这是否与它有任何关系。它是生产应用程序,所以我看不到错误消息,所以我主要只是猜测。我之前只是想过这个,文档和升级指南怎么没有提到任何东西,我现在才发布,我想知道这是不是导致错误的原因。

它在 v6 的 Stack Navigator 设置页面上 say it