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

Fix memoization for Animated components when no style is passed in #44269

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

Commits on Apr 26, 2024

  1. Fix memoization for Animated components when no style is passed in

    Summary:
    Any component wrapped via `createAnimatedComponent()` will always re-render, because it creates a new `style` object. It's impossible to memoize.
    
    Adding `useMemo()` here ensures that the `style` object passed to the underlying object is stable: if no `style` is passed to the wrapped component, then memoization can work.
    
    Allowing memoization to function when the `style` object is passed in will require a deeper fix. See https://fb.workplace.com/groups/rn.support/permalink/26084643474490921/
    
    Before:
    {F1496803038}
    
    After:
    {F1496805410}
    
    Differential Revision: D56618868
    David Rickard authored and facebook-github-bot committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    710b3fe View commit details
    Browse the repository at this point in the history