-
-
Notifications
You must be signed in to change notification settings - Fork 154
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 Storybook doesn't work with iOS/Android Hermes Engine in React Native v0.64.0 #152
Comments
same here |
Faced the same issue. |
Hey guys thanks for reporting these issues, I haven't had a chance to test this yet. I wasn't aware of any incompatibly with hermes, I'll look into it. Are you able to provide a repository that reproduces the issue? |
If anyone is able to offer their time to help on this issue that would be really great, it might take some time for me alone to test everything with 0.64. This is all done in my free time outside of work hours so please be patient with me 🙏 . I've just made a fresh react native project for testing this out and I'll be doing some debugging tonight. |
@oleksandr-dziuban @SlaUA @balovbohdan I just tried this on my machine and I had no issues getting it working without making any changes. Could you please share a repository where you are able to produce this error? |
I've found a bit of an issue when using the code generated by cli alongside existing projects, I'm not sure if it's related however I think I will need to update the generator in the cli. If it is relatedThere are some changes you could make that might resolve your issue however I need to see some of your code to be sure. |
Hello @dannyhw Sorry, can't share a repo, as this e-commerce project is under NDA. Which issues did you find and what we can do to help you to test it? |
@oleksandr-dziuban its not necessary to share the project itself but if you could try to recreate the issue in a fresh project and then share that with me it would be really useful. Otherwise you could share just the parts of the code that include the storybook configuration and the place where you use the component returned from getStorybookUI. Of course feel free to take out any code specific to your project and modify it so that it doesn't breach the nda. |
Just want to re-iterate that in order to fix any issues I really need someone to show me an example of this not working so that I can help the best way possible. Doesn't need to be the issue creator or any real world code, just any example or steps to reproduce. I've not found any issues with hermes or 0.64 personally when I try it so I need to understand better where this issue is coming from. |
@oleksandr-dziuban in your issue description you have given some steps but its not clear to me exactly the steps you followed. "Setup basic React Native Storybook app according to Docs" - which docs are you refering to? the readme? |
@dannyhw here is the repo to reproduce the errors below: Storybook with hermes please see the commit messages for the steps i followed. Note that I could reproduce this error only when using the storybook server and |
@apostopher thanks a lot for providing this, it will definitely help a lot 👍. |
Readme, yes, simple project without typescript and without expo |
For me it reproduced without storybook server and on device ui enabled |
@oleksandr-dziuban if you could provide an example of this then that would help alot, so far I haven't been able to reproduce anything without the storybook server |
@apostopher I was able to see the issue when running your example. It seems the issue is caused by trying to connect with the server, perhaps hermes doesn't support web sockets? Anyway I'm looking into it. |
@oleksandr-dziuban @apostopher I found something interesting when I was investigating and I was able to make the error go away. From what I can tell the issue is that "JSON" was coming up as undefined, through some googling I found that hermes might have an issue with "inlineRequires". When I change metro config to have |
@dannyhw thanks mate! i tested it with Thanks a lot for investigating. i can confirm that it works for me now. |
@dannyhw Thanks a lot for thsi research! it works perfectly with |
@oleksandr-dziuban In short yes I would love to fix that case, at the moment I'm just not sure how. If its related to corejs it would be difficult to resolve. The storybook client api is using babel transforms to support older versions of javascript and I think even the typescript compiler will transform using corejs. Even if I were to provide the react-native code without transforms there isn't a way that I can get the client-api without those babel transformations. If I can figure out what specifically causes the issue I'll be able to say more clearly though. |
Thanks |
@dannyhw thanks for the workaround. Is this something that might be resolved in V6? |
@henrymoulton I hope so, however I'll have to do some debugging since I've not identified the cause yet. |
Going to try and dig, I've got a version I just setup where Android works with a fresh setup https://github.com/henrymoulton/storybook-hermes Will branch off |
Yep that works... https://github.com/henrymoulton/storybook-hermes/tree/ios-hermes-enabled @apostopher I noticed that your repro uses TypeScript whereas mine uses vanilla JS... other than that couldn't spot differences |
@henrymoulton I noticed a difference in the lock diff that that one has react native 0.64.1 and the other 0.64. Is it possible that there was a fix in 64.1? edit: I checked the release notes and 64.1 just includes the fix for xcode 12.5 |
We believe that this is fixed in the v6 alpha and using inlineRequires:false is a workaround for 5.3. For those reason I'll close this issue. Please let us know if you continue to have this issue in the v6 alpha. |
@dannyhw (react native version 0.68.2) |
@hannojg hey, I haven't come across this issue in a while and I'm not totally sure why it happens. I think it has something to do with the way that we import stories. Does this happen on a fresh project also? |
@dannyhw great suggestion on that |
@dannyhw noticed this issue closed, we don't want to set Is there a fix in v5/6 |
@henrymoulton Not sure why this happens exactly but I never run into this issue on v6 so I guess using the release candidate version maybe 😅 |
Also as far as I understand ram bundles don't work on hermes so I'm not sure that would be very widely used |
@dannyhw my understanding is that you can still use inline requires without RAM format and the docs encourage it. |
@henrymoulton yeah but i was talking about not using ram bundles with hermes. Anyway inline requires works you just need to add sbmodern to your metro resolvers config
This only works on v6.5 though |
Now app starts but can't run with redux dispatch method. I'm using redux toolkit slices. Commenting actions which is exported from slice solves the issue. |
@CavidM sorry but I don't see how that would be related to this, if you can explain the link between redux slices and storybook I'm happy to try and debug. |
I upgraded from 6 to 6.5 (semver would suggest this is a non-breaking update) and added Seems like it started to think I'm using the DOM. Anyone have some upgrade tip for going to 6.5? I need |
@dominictobias unfortunately you need to install react-dom since its used by a storybook dependency. You can put inlinesRequires:true as long as you have sbmodern in your resolverMainfields. |
Ah great it works now thanks! |
works with following config in metro.config.js:
|
Describe the bug
When I run react-native storybook with React Native v0.64.0 and Hermes enabled for iOS/Android platform it throws en error:
If Hermes JS Engine disabled everything works fine for iOS/Android platforms.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
App is running storybook correctly
Screenshots
App throws an error and cannot be bootstrapped.
System:
The text was updated successfully, but these errors were encountered: