问题描述
更新:
反应导航Web支持已完成.遵循此: https://reactnavigation.org/docs/en/web-support.html
react-navigation web support is done. follow this:https://reactnavigation.org/docs/en/web-support.html
原点:
我尝试在react-native和Web之间共享我的代码.当我尝试react-native-web时,效果很好.但是只有一个问题,如何从URL访问特定屏幕?我阅读了react-navigation文档,对此一无所知.并且react-router-native可以捕获Web URL,但它具有类似于StackNavigator/DrawerNavigator的导航器.对此有想法吗?
I try to share my code between react-native and web.when I try react-native-web, it works well.but there is only one question, how to access the specific screen from URL?I read the react-navigation docs, there nothing about that.and react-router-native can catch the web URL,but it has navigator likes StackNavigator/DrawerNavigator.and idea about that?
推荐答案
我认为这是不可能的,因为ReactNavigation使用的是内部状态对象.记住,它是移动框架,没有URL路由的概念.我还想指出,即使RN要求网络支持,您仍需要谨慎选择组件,因为并非所有行为都是相同的(从内存来看,FlatList不支持触摸滚动)
I don't think it's possible as ReactNavigation is using an internal state object. Remember, it's mobile framework, it has no concept of URL routing.I also wanted to point out that even though RN claims web support you will need to be careful with component selection as not all the behaviours are identical (from memory, FlatList does not support touch scroll)
这篇关于如何同时使用react-native-web和react-navigation以及如何从Web URL访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!