Flush operations for events on iOS Fabric #4110
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue with UI not updating when style changes are connected to events on iOS Fabric. This problem has been introduced in #3970 where we migrated from using
rAF
and started usingsetImmediate
instead. As a result we had to manually flush set-immediates queue in certain conditions. Specifically this was already happening after animations frame was run (i.e. inrequestAnimationFrame
callback) but should also be done directly after handling events much like we already do on Android here and on iOS-paper here.The reason this stopped working on iOS and not on Android was that Android-fabric implementation still uses old architecture flow for handling events while iOS uses new C++ based
react::EventListener
API (that apparently wasn't working on Android last time we checked). This PR adds flushing operations queue in that new C++ based flow.Note that this problem didn't occur before Shareable Rewrite (#3722) because before all mapper updates would result in us scheduling new animation frames. So the updates were happening eventually, were just delayed by one frame.
Test plan
Run Fabric example on iOS, test Article progress example.