Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native 如何热更新? #390

Closed
r4ggj opened this issue Dec 13, 2016 · 8 comments
Closed

React Native 如何热更新? #390

r4ggj opened this issue Dec 13, 2016 · 8 comments

Comments

@r4ggj
Copy link

r4ggj commented Dec 13, 2016

每次都手动刷新,影响开发效率,在考虑是否用dva了

@nikogu
Copy link
Member

nikogu commented Dec 13, 2016

https://github.com/dvajs/babel-plugin-dva-hmr

热更新,看错了,忽略

@sorrycc
Copy link
Member

sorrycc commented Dec 13, 2016

ReactNative 不清楚更新机制如何。不过 Web 的快了,build 和 server 会基于 https://github.com/sorrycc/roadhog 实现。

@Liuthx
Copy link

Liuthx commented Dec 19, 2016

@sorrycc
React Native的热更新有近期处理的计划吗?

@sorrycc
Copy link
Member

sorrycc commented Dec 24, 2016

React Native的热更新有近期处理的计划吗?

近期没有计划,如果谁有做过,可以提供点线索。RN 的热替换和 React 的有啥区别吗?

@BCGen
Copy link

BCGen commented Dec 25, 2016

我開發react native時,Component如果用const 建立就無法hot reloading,用class建立就可以,可以試試看。

@BCGen
Copy link

BCGen commented Dec 25, 2016

詳細一點,就是使用es6 class建立的component可以hot reloading, 使用stateless function建立的無法,我現在是使用class 建立 container component,用 stateless function 建立presentational component 。

@r4ggj
Copy link
Author

r4ggj commented Jan 4, 2017

经过无数次尝试,证明楼上的的说法有一定道理,但不完全正确,更正如下:
1.app 顶层 与 创建dva 应用同一目录用ES6 class的方法创建顶层Component;
2.第二层在顶层组件中引入定义路由的 Stateless function;(注意:第二层一定要是function组件!!!不要问我为什么,我也不知道;试出来的。。。);
3.第三层其它页面,随便你用那种方式创建组件,都可以热重载了!!!
结语:自己提出的问题,还是自己解决了。。。。

@sorrycc sorrycc changed the title React Native 更改样式没有热更新。Web也没有 React Native 如何热更新? Jan 4, 2017
@sorrycc sorrycc added the faq label Jan 4, 2017
@sorrycc sorrycc closed this as completed Jan 4, 2017
@vance-liu
Copy link

vance-liu commented Sep 11, 2017

@r4ggj 有没有例子呢,现在很烦,无法热加载,只能刷新,我用的是dva + react-navigation

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

No branches or pull requests

6 participants