Skip to content
This repository has been archived by the owner on May 13, 2019. It is now read-only.

探讨转成web后,通过url访问每个页面的解决方案 #242

Open
jlapton opened this issue Apr 10, 2017 · 5 comments
Open

探讨转成web后,通过url访问每个页面的解决方案 #242

jlapton opened this issue Apr 10, 2017 · 5 comments

Comments

@jlapton
Copy link

jlapton commented Apr 10, 2017

app都是从首页进入的,不会直接跳到某个子组件;而web的任何一个界面都应该可以直接访问。
不知道可不可以不对RN中的navigator相关部分进行修改,无缝迁移到web上?

@brainpoint
Copy link
Contributor

brainpoint commented Apr 11, 2017 via email

@tangkunyin
Copy link

围观

@yuanyan
Copy link
Contributor

yuanyan commented May 2, 2017

@jlapton 可以提交PR尝试下

@flyskywhy
Copy link
Contributor

flyskywhy commented May 9, 2017

@jlapton ,要修改的话就要在 react-navigation 中修改了,因为 navigator 已经在 react-native 0.44.0 中被移除并同时提示推荐使用 https://github.com/react-community/react-navigation
另: PR #248 已经支持 react-navigation 了

@xiamingyu
Copy link

使用react-navigation动态定义initialRouteName就行了,代码如下:
dispatchUrl = () => {
if (Platform.OS === 'web' && window.location.hash) {
if (window.location.hash.split("?").length>1){
return window.location.hash.split("?")[0].replace('#/', '');
}
return window.location.hash.replace('#/', '');
} else {
return 'MainPage';
}
};

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants