react-web icon indicating copy to clipboard operation
react-web copied to clipboard

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

Open jlapton opened this issue 8 years ago • 5 comments

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

jlapton avatar Apr 10 '17 04:04 jlapton

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"}}}

brainpoint avatar Apr 11 '17 04:04 brainpoint

围观

tangkunyin avatar Apr 16 '17 06:04 tangkunyin

@jlapton 可以提交PR尝试下

yuanyan avatar May 02 '17 01:05 yuanyan

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

flyskywhy avatar May 09 '17 02:05 flyskywhy

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

xiamingyu avatar Nov 10 '17 06:11 xiamingyu