Open sebastianjung opened 1 year ago
Hi @sebastianjung! Thanks for reporting the issue.
That's interesting, I've never faced that before. Navio's code is highly memo
ised (so shouldn't have unnecessary re-renders) but the warning is linked to this line, however I couldn't find anything wrong. I will need some time to test that and understand why it's happened.
Can you provide the steps on how to get to that warning? And maybe some code snippet?
@kanzitelli I've been using your rn-starter template.
When minifiying with npx expo start --dev-client --minify
the warning occures.
That may be sufficient.
Hey @sebastianjung. I couldn't reproduce the warning on my end following the steps you provided. However, I changed some code in Navio related to the warning but idk if that's a correct way.
// line 633
return <Stack.Screen key={name} name={name} component={C} options={Opts} />;
Changed to
return (
<Stack.Screen key={name} name={name} options={Opts}>
{(props: any) => <C {...props} />}
</Stack.Screen>
);
And after building it, it generated following code:
return (React.createElement(Stack.Screen, { key: name, name: name, options: Opts }, (props) => React.createElement(C, { ...props })));
It seems the same with what you sent before. But I'm not sure if that's correct way of building react-navigation's Stack Screens component. Let me know if that resolves the issue.
@kanzitelli Sorry, but how to test if this works? Any branch i should check inside my project?
I tried cloning this repo but building it does not give me a dist folder (probably because no bundler is involved). Sorry, i am not sure how to properly build this project i guess.
It seems that this piece of code:
return React.createElement(Stack.Screen, { key: name, name: name, component: C, options: Opts });
throws warnings in minified bundle.Changing the code to the following, seems to resolve the issue.
return React.createElement(Stack.Screen, { key: name, name: name, options: Opts },(props) => <C {...props} />);
Any thoughts on this?