taofed / react-web

A framework for building web apps with React Native compatible API.
Other
3.36k stars 448 forks source link

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

Open jlapton opened 7 years ago

jlapton commented 7 years ago

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

brainpoint commented 7 years ago

1.改单页应用为多入口应用 2.修改navigator,使用hash或参数方式对应页面


李鹏翔 brainpoint 在2017年04月10日 12:00,jlapton 写道: app都是从首页进入的,不会直接跳到某个子组件;而web的任何一个界面都应该可以直接访问。 不知道可不可以不对RN中的navigator相关部分进行修改,无缝迁移到web上?

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/taobaofed/react-web","title":"taobaofed/react-web","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/taobaofed/react-web"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"探讨转成web后,通过url访问每个页面的解决方案 (#242)"}],"action":{"name":"View Issue","url":"https://github.com/taobaofed/react-web/issues/242"}}}

tangkunyin commented 7 years ago

围观

yuanyan commented 7 years ago

@jlapton 可以提交PR尝试下

flyskywhy commented 7 years ago

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

xiamingyu commented 6 years ago

使用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'; } };