-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
storybook on react-native does not work with hmr (hot module reload) properly #2081
Comments
The propType bug is related to #2117 |
#2081 fix hmr in react-native template
@danielduan The issue is not resolved. I updated storybook to yesterdays version (3.2.14) and verified that the storybook index file matches this template #2194 (I already had the base component as a class instead of a stateless function). HMR still does not work in this setup. Any change to a file will trigger a refresh in the app, but it will crash with:
by using the debugger i see that this happens in
Edit: I am using CRNA (with expo) and i have added decorators to stories (e.g. ThemeProvider from styled-components). Edit2: If I dismiss the error, storybook will show the startscreen again for a moment and go back to the story with the changes. Any further change to the components will have no effect and won't trigger HMR anymore. Edit3: if i disable remote debugging, the memory leak error is still there, but otherwise HMR seems to work besides this bug: #835 |
The decorators themselves might break HMR if it's a stateless functional component. Our event emitter probably needs some work too. If you have time to dig through this, we'd love some help on a PR. |
#2081 add hmr to other rn app template
Do you have a repo so I can try to reproduce this? @macrozone I just tried in our CRNA example and it seems to work:
|
I found this issue while trying to figure out why 3.3.12 is not working with HMR. Update |
it's hard to tell what's wrong with hmr and react-native. It works for some time, but starts to get slower and slower, eats cpu on both the device and the computer, throwing errors like the dreaded "possible event emitter leaked" and now kills the server eventually (see #2923) So it basically "works" but extremly unreliable and i therefore wonder if anyone successfully uses it on real projects |
I too am getting this error.
I'm using a global decorator along with create react native app, typescript and storyshots. |
I'm on "@storybook/react-native": "^4.0.0-alpha.25" and in order to get hot reloading working again after integrating storybook into my app I had to do the following.
|
Hey @jqn, so to be clear you had to create StorybookUIHMRRoot even though we already create it in getStorybookUI? |
Yes I did. The hot reload was broken with the default install configuration. |
@jqn This worked for me as well |
We’ve released a brand new @macrozone @odino @b3ngineer @maxhungry @tonyxiao @Bardiamist @danielduan @EskelCz @Maxim-Filimonov @axelnormand @jqn @jjm340 @iamolegga @FunkSoulNinja @miltoneiji @Gongreg |
Still not working on 5.1 for me |
@stereodenis try |
@shilman 5.2-beta.7 |
Sadly there was no effort done to fix hmr |
React Native 0.61 has a new reload format, so closing this issue. The new issue is #7916 |
For HMR (hot module reload) to work, the root component has to be a class, as it seems.
I therefore added this to storybook/storybook.js :
This used to work in the past, but with latest version, i just see the native ui menu and some warnings like:
"The prop url is marked as required in
StoryView
but it's value is null"and
"The prop url is marked as required in
OnDeviceUI
, but it's value is null"Edit: without the class above, there is no warning. But hot reload does not work. On the simulator it notifies about "hot reloading", but nothing changes.
Edit 2: if i change to a different story after hot reload and back, the changes are applied... So what's wrong?
I now switched back to live reload, HMR seems broken at the time beeing
The text was updated successfully, but these errors were encountered: