Commit 1faa665
Guard against OTA mismatch in NativeAnimatedHelper queue (#56802)
Summary:
Pull Request resolved: #56802
When MobileConfig flags (`cxxNativeAnimatedEnabled` and `useSharedAnimatedBackend`) are enabled server-side, `connectAnimatedNodeToShadowNodeFamily` is added to the method names list in `createNativeOperations()`. However, MobileConfig values and what is available in the AnimatedModule on the client can mismatch due to OTA updates — the JS bundle may have the flag enabled while the native module on the device does not yet implement the method. In this case, `nullthrows(NativeAnimatedModule)[methodName]` returns `undefined`, which gets queued as `() => undefined(...args)` and throws TypeError when the queue is flushed.
This fix adds a runtime check that `NativeAnimatedModule?.connectAnimatedNodeToShadowNodeFamily != null` before including the method in the list, preventing the mismatch from surfacing. The specific guard at the registration site is sufficient — if the method is not available on the native module, it will never be registered, so the general null guard in the method wrapper is unnecessary.
Fixes T270861607.
Changelog: [Internal]
Reviewed By: zeyap
Differential Revision: D104775294
fbshipit-source-id: ece86a3ab37792bf9624985eebfc53059af616771 parent 2991a97 commit 1faa665
1 file changed
Lines changed: 2 additions & 1 deletion
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
0 commit comments