-
-
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 Storyshots - RangeError: Maximum call stack size exceeded #302
Comments
We use Storybook at our business and are having the same exception after upgrading to 5.1.3 We are using it as a component inside our live app which is conditionally bundled based on environment variables. Our minimal repro is the following: // StorybookComponent.js
import { getStorybookUI } from "@storybook/react-native";
const StorybookUIRoot = getStorybookUI({ port: 7007, onDeviceUI: true });
export default StorybookUIRoot; This, however does work // StorybookComponent.js
import { View } from "react-native";
export default View; The stack trace isn't so helpful either. |
This is still an issue with React Native 0.59.9 and Storybook 5.1.3 |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook! |
Getting the same thing here, did you guys give up on storyshot or did you find a fix? |
I find that this is an issue when passing an element as a prop, otherwise, it works fine.
|
It's still an issue :/ |
It is still an issue with: {
"expo": "~43.0.2",
"react-native": "0.64.3",
"@storybook/addon-actions": "^5.3",
"@storybook/addon-knobs": "^5.3",
"@storybook/addon-links": "^5.3",
"@storybook/addon-ondevice-actions": "^5.3.23",
"@storybook/addon-ondevice-knobs": "^5.3.25",
"@storybook/react-native": "^5.3.25",
"@storybook/react-native-server": "^5.3.23",
} |
I've never really worked with storyshots if someone could explain more about this issue or open a PR that would be really helpful. |
@dannyhw, still having the issue with upgraded packages: "expo": "^44.0.0",
"@storybook/addon-actions": "^6.4.9",
"@storybook/addon-knobs": "^6.4.0",
"@storybook/addon-links": "^6.4.9",
"@storybook/addon-ondevice-actions": "^5.3.23",
"@storybook/addon-ondevice-knobs": "^5.3.25",
"@storybook/react-native": "^5.3.25",
"@storybook/react-native-server": "^5.3.23", I render my storybook inside the app with a specific route. <Stack.Navigator>
<Stack.Screen
name="Home"
component={MainStack}
/>
<Stack.Screen
name="Storybook"
component={StorybookComp}
/>
</Stack.Navigator> App is working as expected. When I navigate to the Storybook route. I got this message. (But I can continue using by dismiss this message) If I directly render Storybook in App.js (in Expo, this is the root file) like this: import React from "react";
import StorybookUIRoot from "./storybook";
export default StorybookUIRoot; 🟢 It is ok. 🔴 But when I want to import both my app and Storybook, it gives the error. Here I thought:
function App() {
const { storybook } = Constants.manifest.extra;
const [fontsLoaded] = useFonts({
Poppins_400Regular,
Poppins_600SemiBold,
});
if (!fontsLoaded) {
return <AppLoading />;
}
return <>{Boolean(storybook) ? <LinksScreen /> : <MainNavigator />}</>;
}
export default App; I can give these details. Appreciate your help. Still trying to solve this issue. |
You shouldn't mix 5.3 with 6.x either use V6 or 5.3 but not both. |
How to continue here? Downgraded the others to 5.x.x latest. Edit: Downgraded all the packages like below. Still giving error. "@storybook/addon-actions": "5.3.13",
"@storybook/addon-knobs": "5.3",
"@storybook/addon-links": "5.3.7",
"@storybook/addon-ondevice-actions": "^5.3.23",
"@storybook/addon-ondevice-knobs": "5.3.25",
"@storybook/react-native": "^5.3.25",
"@storybook/react-native-server": "^5.3.23", |
This solved the issue for me. But not sure any other thing will be affected by setting For my Expo app, in const { getDefaultConfig } = require("expo/metro-config");
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts },
} = await getDefaultConfig(__dirname);
return {
transformer: {
// ...my configs
// added this function 👇🏽
getTransformOptions: async () => ({
transform: {
inlineRequires: true,
},
}),
},
resolver: {
// my configs
},
};
})(); |
Inline requires is just an optimization disabling it shouldn't be a problem. |
@dannyhw I have tried with inlineRequires: false in react-native-cli application which is causing other issues in the project |
Setting <NavigationContainer>
...
<Stack.Screen name={Routes.Storybook}>
{() => {
const { Storybook } = require('./screens/Storybook')
return <Storybook />
}}
</Stack.Screen>
...
</NavigationContainer> |
Why is this issue closed? It's still occurring for me on Android only devices using the latest expo/storybook. Crazy that there hasn't been a ton of progress in 3.5 years... yea yea I suppose I could dig in but I'm pretty lazy right now. The work around that worked for me though was from @SamakaCD so thank you. I had to do a slight modification for my purposes (since my
|
Its closed because many solutions have been posted here that don't seem related to any storybook code. Also lots has changed in the v6 beta so its very likely this issue wouldn't occur anymore. Happy to reopen if its shown to be a persistent issue in the beta. |
Yea I'm on 5.3 (just added storybook to my app yesterday) and after doing so I was encountering this issue with Android only devices. When I removed all the boilerplate setup code for Storybook in the What was also strange is that all my SecureStore functions were basically empty which I think was causing all the unhandled exceptions which resulted in the max call stack. Refactoring to lazy-load the storybook related code iff I was running in storybook mode (dotenv variable to toggle it on/off) resolved the issue. E.g.
I'll have to give v6 a shot at some point to see if the issue disappears. |
If anyone finds this ticket first. This issue appears with storybook v6 as well. This solution fixed it for us (Hermes + inlineRequires: true) |
Inline requires changes shouldn't be needed if you have this in your metro config
|
Only started to experience this after upgrading to expo 49. this fixed it for me. thanks. |
Describe the bug
When running
storyshots
the following error occurs. Running the storybook within the app on the device works as expected:To Reproduce
Steps to reproduce the behavior:
@storybook/addon-storyshots
storyshots.test.ts
as per READMEyarn test
Expected behavior
Snapshots to be generated
Code snippets
storybook/index.ts
storyshots.test.ts
button.stories.ts
System:
The text was updated successfully, but these errors were encountered: