-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swizzle RCTUIManager #4619
Swizzle RCTUIManager #4619
Conversation
if (self = [super init]) { | ||
_animationsManager = animationsManager; | ||
_uiManager = uiManager; | ||
_reaUIManager = self; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand the need for this whole REASwizzledUIManager class to exists. Also, assigning singletons like that seem a bit risky.
It seem to me that the reason it's been done this way was for the swizzled methods to be able to access _uiManager and _animationsManager fields. I think the former can just be replaced by self
as the swizzling concept refers to swapping out implementation of certain methods. The UI manager object will be the same and the swizzled method self will refer to it.
As for the latter field, the best way IMO would be to use category on UIManager class that adds animationsManager property to it using associated object technique (https://nshipster.com/associated-objects/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I've made the changes based on your suggestions 👍. I dumped the singleton and used associated objects with the category instead.
- The only reason I created the
REASwizzledUIManager
class was to keep the swizzled methods separate from the animation manager. I didn't want to put everything into one file. But yeah, if you think it's best, I can move the_manageChildren
and_uiBlockWithLayoutUpdateForRootView
methods back to theREAAnimationManager
class.
…ansion/react-native-reanimated into @piaskowyk/UIManager-refactor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! ❤️
## Summary Recently, we began rewriting the iOS initialization process. Tomek moved the injection of JSI bindings to `installTurboModule` (check out #4523) and then used swizzling to eliminate the `REAEventDispatcher` (see #4576). More context here: expo/expo#23057 (comment) This PR removed UIManager overriding by swizzling the `_manageChildren` and `uiBlockWithLayoutUpdateForRootView` methods. These changes allowed us to get rid of `RCTAppDelegate+Reanimated`, `UIResponder+Reanimated`, and `REAInitializer`. For now, we're gonna leave `REAInitializer` as deprecated for a few more releases to maintain backward compatibility. But just a heads up, we'll be removing it in the future. ## Test plan - I tested building on different react native versions by CI https://github.com/piaskowyk/reanimated-rn-version-tester/actions/runs/5375166823 - Tested Layout Animations on Example app form main branch.
# Why update vendoring modules for SDK 50 + this will produce way less diffs when upgrading for react-native 0.73 support # How - `et uvm -m react-native-reanimated -c 3.5.4` - Updated `EXVersionUtils.mm` given that REAEventDispatcher and REAUIManager no longer exist (software-mansion/react-native-reanimated#4619) # Test Plan - unversioned expo go + ncl reanimated - versioned expo go + ncl reanimated # Checklist - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev>
# Why update vendoring modules for SDK 50 + this will produce way less diffs when upgrading for react-native 0.73 support # How - `et uvm -m react-native-reanimated -c 3.5.4` - Updated `EXVersionUtils.mm` given that REAEventDispatcher and REAUIManager no longer exist (software-mansion/react-native-reanimated#4619) # Test Plan - unversioned expo go + ncl reanimated - versioned expo go + ncl reanimated # Checklist - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Kudo Chien <kudo@expo.dev>
## Summary In #4619 @piaskowyk removed `REAInitializer` because it was no longer required. To avoid a breaking change, in #4880 he restored `REAInitializer` with no-op implementation for backward compatibility. This PR removes `REAInitializer` which effectively does nothing since 3.5.0. ## Test plan Build Example app on iOS.
Summary
Recently, we began rewriting the iOS initialization process. Tomek moved the injection of JSI bindings to
installTurboModule
(check out #4523) and then used swizzling to eliminate theREAEventDispatcher
(see #4576). More context here: expo/expo#23057 (comment)This PR removed UIManager overriding by swizzling the
_manageChildren
anduiBlockWithLayoutUpdateForRootView
methods. These changes allowed us to get rid ofRCTAppDelegate+Reanimated
,UIResponder+Reanimated
, andREAInitializer
.For now, we're gonna leave
REAInitializer
as deprecated for a few more releases to maintain backward compatibility. But just a heads up, we'll be removing it in the future.Test plan