(iOS) - NativeCommands fail in ref functions if batchRenderingUpdatesInEventLoop is active #46330
Labels
Issue: Author Provided Repro
This issue can be reproduced in Snack or an attached project.
Newer Patch Available
Platform: iOS
iOS applications.
Type: New Architecture
Issues and PRs related to new architecture (Fabric/Turbo Modules)
Description
Problem
Starting in version
0.74.1
and above, due to this change, thebatchRenderingUpdatesInEventLoop
feature flag is turned ON. This causes NativeCommands called inref
functions to fail.The corresponding NativeCommand:
Diagnosis
The NativeCommand
trigger
fails because when synchronouslyDispatchCommandOnUIThread gets called,findComponentViewWithTag
returnsnil
because the _registry does not contain the element.When
batchRenderingUpdatesInEventLoop
is off, the_registry
is correctly populated with all elements on the screen, and the NativeCommandtrigger
functions correctly.If
Commands.trigger
is wrapped in asetTimeout
, it gets called successfully.Steps to reproduce
See the reproducer provided.
codegenNativeComponent
andcodegenNativeCommands
to create aNativeCommand
NativeCommand
in aref
functionNativeCommand
does NOT get called in versions>=0.74.1
React Native Version
0.74.5
Affected Platforms
Runtime - iOS
Areas
JSI - Javascript Interface, Bridgeless - The New Initialization Flow
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/RyanCommits/RN74-issue-reproducer
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: