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
When I memoize a Stylesheet that derives some styles from props or state, the react-native/no-unused-styles reports an error although the memoized object is used.
The assumption is correct. Dynamic styles should be memoized to prevent triggering re-renders. A simple benchmark with Why Did You Render would show that. The most expensive operation for RN is converting back and forth data to JSON to propagate the unnecessary changes over the bridge, therefore YES: memoize your dynamic styles.
I totally stand with this. I often need to move some styles in the component to make a dynamic stylesheet object, but I also need to memoize them for performance purposes.
When I memoize a Stylesheet that derives some styles from props or state, the
react-native/no-unused-styles
reports an error although the memoized object is used.Example:
The text was updated successfully, but these errors were encountered: