You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getDerivedStateFromProps is a static method so you cant reach this.props.style.
The only option to do it is to save the style into the state each time.
In StyleProvider the componentDidUpdate should be fine because we compare the props.style, and set the state only in case it changed.
Anyway, i can use the memoize also in this function (instead of componentDidUpdate).
memoize save the result of the function and return it back in case it called with the same vars.
I wasn't able to use it in StyleProvider (it cause me a problem).
Anyway, I think it is safe to use componentDidUpdate in there because of the if before the setState.
I wast able to change the theme in runtime with the change and without it, is it even supported by native base?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use memoize instead of saving the style in the state like explained in this doc: https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#what-about-memoization