Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 89b28c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
the next branch doesnt have react native so how are you using it? |
|
Thanks for checking this @joshuaellis! You're completely right that The reason for proposing this on Component[cacheKey] = withAnimated(Component, hostConfig)When someone wraps an arbitrary component with That said, since the original issue (#2533) was specifically reported in the context of React Native on Hermes, and |
Why
Resolves #2533.
In React Native environments running the Hermes JavaScript engine (or whenever host components / higher-order components are frozen or have their extensions prevented via
Object.preventExtensions()), callinganimated(Component)throws an uncaught exception:TypeError: Cannot add property Symbol(AnimatedComponent), object is not extensibleThis issue was previously patched on the
v10branch in PR #2535, but was never ported to the defaultnextdevelopment branch. As a result, users of thenextline still experience crashes when animating React Native host components under Hermes.What
WeakMap<object, any>fallback cache inpackages/animated/src/createHost.ts.Component[cacheKey] = cached.cacheKeythrows (because the component is non-extensible or frozen), the error is caught and the wrapper is stored in thefallbackCacheWeakMap.Component[cacheKey] ?? fallbackCache.get(Component).packages/animated/src/createHost.test.tsverifying that non-extensible and frozen components do not throw, retain their cached wrapper identity across invocations, and preserve theirdisplayName..changeset/non-extensible-component-cache.md.Checklist