-
Notifications
You must be signed in to change notification settings - Fork 2
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
rerenders on RN 0.68 #6
Comments
Hello there! Thanks for taking some time to create this issue, and to provide evidence about the issue. I'm not a RN user and I'm not familiar with the versioning/releases of that library; but after you suggested the issue might be due to the I have asked React team to check if there is any other way to achieve a similar behavior in case there is a way I could re-implement the solution for this library. I'll wait in the upcoming days for any news about that; if not, then I'll probably mark the library as not supporting React@18 and probably RN@0.68 as you just suggested. For the moment, you can try downgrading RN library, or explore using use-context-selector library instead. |
Hello again!, it seems the I just updated another project ( If you need to update your React version, I think that should be your best option. The API is pretty much the same, so I believe you should not have any major problem updating; the only big difference I found is that you cannot specify a custom Good luck! |
Thank you very much for investigating. I found another module that fits my needs (executing same above code it only rerenders expected consumers no care about of props updates order): react-use-context-selector. |
Hi,
first of all wonderful light implementation of this useful "tool".
I tried this lib with a simple code with a context provider component (
PreferencesProvider
with value = object with 2 properties: lang and theme), 2 context consumer components that respectively subscribe one of the 2 "context props" (LangConsumer
andThemeConsumer
) and the main screen componentStubScreen
that only subscribe the context setter function.On react-native 0.64 code works as expected: when I update only one property (ie. lang) it rerender only the context provider and the LangConsumer component, instead on react-native 0.68 the same code rerenders all consumers: LangConsumer, ThemeConsumer and StubScreen too, no caring of which context property I updated.
I guess that the
non-documented feature available on React.createContext API which allows us to disable dispatching updates to every component accessing a Context value
isn't available anymore on new react-native release...ENVIRONMENT INFO:
Below sample code:
The text was updated successfully, but these errors were encountered: