我想将 React Navigation 3.x 与 react-native-web 结合使用。通过“入门”步骤,
只需导入:
import { createStackNavigator, createAppContainer } from "react-navigation";
并更新 babel 配置,我最终收到此错误:
./node_modules/@react-navigation/native/node_modules/react-native-gesture-handler/Swipeable.js 未找到模块:无法在“D:\”中解析“react - native/Libraries/Animated/src/AnimatedEvent ” react_native\App\app\node_modules@react-navigation\native\node_modules\react-native-gesture-handler'
在我的研究中,我在 github 上发现了一些可能与该错误有关的主题: https ://github.com/kmagiera/react-native-gesture-handler/pull/406
https://github.com/react-navigation/react-navigation/issues/5632
我已经使用了这个“修复”(来自上面的 github 拉)作为依赖:
"react-native-gesture-handler": "jaulz/react-native-gesture-handler#fix/web-compatibility"
但再次出现类似的错误:
./node_modules/@react-navigation/native/node_modules/react-native-gesture-handler/DrawerLayout.js 未找到模块:无法解析'D:\ 中的'react - native/Libraries/Animated/src/AnimatedEvent ' react_native\App\app\node_modules@react-navigation\native\node_modules\react-native-gesture-handler'
如何使用反应导航在 Web 上实现工作导航?也许使用其他依赖版本?还是我应该使用反应路由器?