Skip to content

Fix native-driven props dropped on Animated.FlatList/SectionList under shared animated backend (#57178)#57178

Open
zeyap wants to merge 1 commit into
react:mainfrom
zeyap:export-D108155219
Open

Fix native-driven props dropped on Animated.FlatList/SectionList under shared animated backend (#57178)#57178
zeyap wants to merge 1 commit into
react:mainfrom
zeyap:export-D108155219

Conversation

@zeyap

@zeyap zeyap commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary:

Changelog:

[Internal][Fixed] - Fix native-driven props dropped on Animated.FlatList/SectionList under shared animated backend

Under the shared animated backend (cxxNativeAnimatedEnabled + useSharedAnimatedBackend), a useNativeDriver: true animation on Animated.FlatList or Animated.SectionList (or any class composite that wraps a host) was silently dropped — e.g. an opacity fade never committed, so the content stayed at its initial value.

Root cause: AnimatedProps.#connectShadowNode resolves the target shadow node via getNodeFromPublicInstance(target.instance). FlatList/SectionList are class components (not forwardRef-to-host), so the ref is the composite instance, which has no __internalInstanceHandle; getNodeFromPublicInstance returns null and connectAnimatedNodeToShadowNodeFamily is never called. The C++ shared backend commits animated props only through a connected ShadowNodeFamily and has no viewTag fallback when useSharedAnimatedBackend is enabled, so the value is dropped. Animated.View and Animated.ScrollView are unaffected because their ref is the host instance; with cxxNativeAnimatedEnabled alone the legacy viewTag path still commits, so this only regresses once the shared backend is on.

Fix: in #connectShadowNode, resolve the shadow node from the host instance rather than the composite — try the instance, then getNativeScrollRef() (covers FlatList/SectionList), then fall back to the host tag that #connectAnimatedView already resolved via findNodeHandle, looked up natively with findShadowNodeByTag_DEPRECATED. The #connectAnimatedView viewTag path is unchanged.

Reviewed By: cipolleschi, javache

Differential Revision: D108155219

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 11, 2026
@meta-codesync

meta-codesync Bot commented Jun 11, 2026

Copy link
Copy Markdown

@zeyap has exported this pull request. If you are a Meta employee, you can view the originating Diff in D108155219.

…r shared animated backend (react#57178)

Summary:

## Changelog:

[Internal][Fixed] - Fix native-driven props dropped on Animated.FlatList/SectionList under shared animated backend

Under the shared animated backend (`cxxNativeAnimatedEnabled` + `useSharedAnimatedBackend`), a `useNativeDriver: true` animation on `Animated.FlatList` or `Animated.SectionList` (or any class composite that wraps a host) was silently dropped — e.g. an opacity fade never committed, so the content stayed at its initial value.

Root cause: `AnimatedProps.#connectShadowNode` resolves the target shadow node via `getNodeFromPublicInstance(target.instance)`. `FlatList`/`SectionList` are class components (not `forwardRef`-to-host), so the ref is the composite instance, which has no `__internalInstanceHandle`; `getNodeFromPublicInstance` returns `null` and `connectAnimatedNodeToShadowNodeFamily` is never called. The C++ shared backend commits animated props only through a connected `ShadowNodeFamily` and has no viewTag fallback when `useSharedAnimatedBackend` is enabled, so the value is dropped. `Animated.View` and `Animated.ScrollView` are unaffected because their ref is the host instance; with `cxxNativeAnimatedEnabled` alone the legacy viewTag path still commits, so this only regresses once the shared backend is on.

Fix: in `#connectShadowNode`, resolve the shadow node from the host instance rather than the composite — try the instance, then `getNativeScrollRef()` (covers `FlatList`/`SectionList`), then fall back to the host tag that `#connectAnimatedView` already resolved via `findNodeHandle`, looked up natively with `findShadowNodeByTag_DEPRECATED`. The `#connectAnimatedView` viewTag path is unchanged.

Reviewed By: cipolleschi, javache

Differential Revision: D108155219
@meta-codesync meta-codesync Bot changed the title Fix native-driven props dropped on Animated.FlatList/SectionList under shared animated backend Fix native-driven props dropped on Animated.FlatList/SectionList under shared animated backend (#57178) Jun 11, 2026
@zeyap zeyap force-pushed the export-D108155219 branch from eb4c53e to c2dec74 Compare June 11, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant