【问题标题】:createBrowserApp is not working with react-navigation v5createBrowserApp 不适用于 react-navigation v5
【发布时间】:2020-08-08 10:05:58
【问题描述】:

有了新的 react-navigation v5,它就无法与 react-native-web 一起使用。 只是导入 createBrowserApp 会引发错误

import {createBrowserApp} from "@react-navigation/web";

在@react-navigation/web/dist/Link.js 中显示以下错误

TypeError: (0 , _core.withNavigation) is not a function

有人知道如何将 react-navigation v5 与 react-native-web 一起使用吗?我需要路径中的 url 历史记录,但现在已经不可能了。

【问题讨论】:

    标签: react-navigation react-native-web react-navigation-v5


    【解决方案1】:

    expo install react-navigation react-native-gesture-handler react-native-reanimated react-native-screens

    npm i react-navigation-stack
    npm i @react-navigation/web
    

    与 expo 一起安装,这就是为什么 expo 会寻找正确版本的 react-navigation 库,这些库可以与您项目中安装的 expo 版本一起使用。

    继续学习本教程 https://codersera.com/blog/how-to-do-navigation-in-react-native-web-in-2020/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-11
      相关资源
      最近更新 更多