Enable RuntimeScheduler in old architecture#37523
Conversation
Base commit: 1a1e399 |
|
@sammy-SC has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was exported from Phabricator. Differential Revision: D46078324 |
78885a3 to
de290e0
Compare
|
This pull request was successfully merged by @sammy-SC in de290e0801b0cae0559333ad0f76ee6dc2cee6fa. When will my fix make it into a release? | Upcoming Releases |
de290e0 to
19c2596
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46078324 |
1 similar comment
|
This pull request was exported from Phabricator. Differential Revision: D46078324 |
Summary: ## Changelog: [IOS] [FIXED] - unexpected useEffects flushing semantics Pull Request resolved: #37523 Test Plan: Run RNTester with Paper and make sure native scheduler is used. Differential Revision: D46078324 Pulled By: sammy-SC fbshipit-source-id: 1790b4f42c0df428e26da482d0c895c20741cdbd
19c2596 to
9481858
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46078324 |
f5e26cd to
f59723e
Compare
|
@sammy-SC has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@sammy-SC has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
98acec6 to
8927517
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46078324 |
1 similar comment
|
This pull request was exported from Phabricator. Differential Revision: D46078324 |
8927517 to
7a0868a
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46078324 |
7a0868a to
1342130
Compare
Summary: ## Changelog: [IOS] [FIXED] - unexpected useEffects flushing semantics Pull Request resolved: #37523 Test Plan: Run RNTester with old architecture and make sure RuntimeScheduler is used. Differential Revision: D46078324 Pulled By: sammy-SC fbshipit-source-id: 6b3dccb9aaf4e3e3beaf723098359a83be23ae5c
1342130 to
0c10fc8
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46078324 |
Summary: [IOS] [FIXED] - unexpected useEffects flushing semantics Pull Request resolved: #37523 Test Plan: Run RNTester with old architecture and make sure RuntimeScheduler is used. Reviewed By: cipolleschi Differential Revision: D46078324 Pulled By: sammy-SC fbshipit-source-id: 5f18cbe60e6c9c753c373f175ba413b79288a928
|
This pull request has been reverted by 88eef42. |
Summary: [IOS] [FIXED] - unexpected useEffects flushing semantics Pull Request resolved: facebook#37523 Test Plan: Run RNTester with old architecture and make sure RuntimeScheduler is used. Reviewed By: cipolleschi Differential Revision: D46078324 Pulled By: sammy-SC fbshipit-source-id: 5f18cbe60e6c9c753c373f175ba413b79288a928
## Summary This PR bumps react-native to 0.72.0-rc.5 and slightly changes initialization path on iOS (Paper) due to recent changes in the framework (facebook/react-native#37523). Fixes #4521. Continues #3005. On iOS, Reanimated needs to overwrite two React internal modules: * `RCTUIManager` → `REAUIManager` to intercept `manageChildren` calls in order to observe React tree changes ([here](https://github.com/software-mansion/react-native-reanimated/blob/main/ios/LayoutReanimation/REAUIManager.mm)) * `RCTEventDispatcher` → `REAEventDispatcher` to intercept events in the native code while still on the UI thread ([here](https://github.com/software-mansion/react-native-reanimated/blob/663ee74925cafa4a1a802f4722466dc02cb1760f/ios/REAEventDispatcher.m#L9-L10)) The rest of the initialization (injecting JSI bindings) can be safely done in `installTurboModule` method, as we already do on Android and iOS/Fabric. Previously, this was done using categories (see [`UIResponder+Reanimated.mm`](https://github.com/software-mansion/react-native-reanimated/blob/663ee74925cafa4a1a802f4722466dc02cb1760f/ios/native/UIResponder%2BReanimated.mm#L19-L30)), in particular by overwriting `jsExecutorFactoryForBridge:` method which is called during initialization. However, since 0.72.0-rc.4, this method is already implemented in `RCTAppDelegate` so the trick does no longer work, making the app fail with the following error "[Reanimated] The native part of Reanimated doesn't seem to be initialized". In this PR, I've used a category to overwrite another method `extraModulesForBridge` which swizzles the implementation of `jsExecutorFactoryForBridge` method and runs `REAInitializer` before the original call. As suggested by @kmagiera, alternatively we could just swizzle the methods of `RCTUIManager` and `RCTEventDispatcher`. ## TODO - [x] Restore support for 0.71 and below with #ifdefs ## Test plan <!-- Provide a minimal but complete code snippet that can be used to test out this change along with instructions how to run it and a description of the expected behavior. -->
Summary:
Changelog:
[IOS] [FIXED] - unexpected useEffects flushing semantics
Test Plan:
Run RNTester with old architecture and make sure RuntimeScheduler is used.