更新:
反应导航网络支持已完成.请遵循:https: //reactnavigation.org/docs/en/web-support.html
原文:
我尝试在react-native和web之间共享我的代码.当我尝试react-native-web时,它运作良好.但是只有一个问题,如何从网址访问特定的屏幕?我读了react-navigation的文档,没有任何相关内容.和react-router-native可以捕获web url,但它有导航器喜欢StackNavigator/DrawerNavigator.那个想法?
react-native react-router-v4 react-navigation react-native-web react-router-native
我使用 yarn 安装了 react-native-router 并且只导入了 NativeRouter
这就是我从 react-router-native import { NativeRouter, Route, Link } from "react-router-native" 导入的方式;
这是我得到的错误
D:/WORKSHOP/Tunga/music-app/node_modules/react-router-native/NativeRouter.js 11:9
Module parse failed: Unexpected token (11:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| */
| function NativeRouter(props) {
> return <MemoryRouter {...props} />;
| }
|
Run Code Online (Sandbox Code Playgroud) react-native ×3