-
Notifications
You must be signed in to change notification settings - Fork 33
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
Still unstable value used in Provider #84
Comments
Would you accept a PR to fix that? I have a patch-file for all of those changes, if you want. |
Hey @pke a PR would be great! Apologies for the lack of input from my side, I recently moved to another country and has been difficult to tend to my open source projects + new job.. But should have more time to address issues here going forward :) When submitting a pr, please make use of angular commit conventions so that the CI knows how to version the project accordingly. And the base branch needs to be set to |
Sure, Jean. I will see when I can alot some time to create a PR. All the best in your new job! |
Hey, I am still experience massive re-renders whenever a toast message is shown.
So I checked the
value
used in theProvider
and its creating a new object hash on every render, which makes it unstable (for react).As a side note, the structure of the value does not comply with the defined
ToastContextType
because only thetoast
method is ever exported in the object ofvalue
.react-native-styled-toast/src/Context/index.tsx
Line 78 in 010f200
When I changed the
value
to really only export thetoast
function (which in itself is stable thanks touseCallback
) the app became more stable instantly.<Provider value={toast}>
I am not sure what the root cause of all that is, might be an even outer mounted component that causes this packages Provider to re-render and by that trigger some ripple effects in the app.
I am trying to come up with a proper test suite to find out more about this behaviour but maybe you also have an idea whats going on?
The text was updated successfully, but these errors were encountered: