Skip to content
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

feat(theme): memoize createStyleProp #1171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Federkun
Copy link

Please read and mark the following check list before creating a pull request:

Short description of what this resolves:

Apparently StyleConsumerService's createStyleProp is quite slow. Memoize it is not a silver bullet, but give you a chance to not generate those styles on each rerender by providing props to your styled component with a stable identity.

My problem was a screen that had to re-render every 1s, which contained 15/20 buttons. On an iOS tablet, I usually drop to 2/3 fps. With this patch, given that all the props of the button have a stable identity (onPress in particular), I can maintain 60 fps.

@Federkun Federkun force-pushed the feature/memoize-generate-style branch from 0f4e0de to c9779d0 Compare June 30, 2020 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant