Skip to content

Commit 52caae5

Browse files
Delete legacy RCTNativeAnimatedModule from RN iOS
Summary: The Old Architecture has been deleted from React Native iOS, which makes the legacy `RCTNativeAnimatedModule` unreachable: - Its JS spec only requests `'NativeAnimatedModule'` when `shouldUseTurboAnimatedModule()` is false, but `ReactInstance.cpp` sets `RN$Bridgeless = true` unconditionally on iOS, so that branch never runs. - Its only entry points were `-setBridge:` and `RCTUIManagerObserver`, and `RCTBridge` is now an all-nil stub with `RCTCxxBridge` deleted. - Nothing referenced it by filename except a single `legacy = True` Buck plugin provider. iOS Animated is served by `RCTNativeAnimatedTurboModule` (bridgeless ObjC) and by the C++ `facebook::react::AnimatedModule` behind `cxxNativeAnimatedEnabled()`. Deleted `RCTNativeAnimatedModule.h` / `.mm` and its registrations: the `legacy = True` `react_module_plugin_providers` entry in `xplat/js/react-native-github/BUCK`, the `RCTNativeAnimatedModuleCls` shim in the `generated` `RCTAnimationPlugins.{h,mm}`, the `getCoreModuleClasses()` entry in `RCTBridge.mm`, the `headers-include-baseline.json` entries, and the `js1 rn-arch` codemod skip-list entry. With the last bridge-dependent Animated consumer gone, also stripped the dead bridge plumbing it was the only reason for: - `RCTNativeAnimatedNodesManager -initWithBridge:surfacePresenter:` loses `bridge:`. - `RCTPropsAnimatedNode -connectToView:viewName:bridge:surfacePresenter:` loses `bridge:` and the `RCTUIManager` fallback in `-updateView`, which collapses to the single `synchronouslyUpdateViewOnUIThread:props:` call. - `viewName:` goes too, since it was only used to look up a legacy view manager. The C++ (`connectAnimatedNodeToView(Tag, Tag)`) and Kotlin (`connectAnimatedNodeToView(animatedNodeTag, viewTag)`) nodes managers already take two arguments, and the sole remaining ObjC caller passed `nil`. `RCTNativeAnimatedTurboModule` is deliberately NOT renamed back to `RCTNativeAnimatedModule` — that is a much wider rename, best done separately. Changelog: [INTERNAL] Differential Revision: D115663619
1 parent 22cfb5c commit 52caae5

16 files changed

Lines changed: 154 additions & 672 deletions

packages/react-native/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@
99

1010
#import <React/RCTSurfacePresenterStub.h>
1111

12-
@class RCTBridge;
1312
@class RCTViewPropertyMapper;
1413

1514
@interface RCTPropsAnimatedNode : RCTAnimatedNode
1615

17-
- (void)connectToView:(NSNumber *)viewTag
18-
viewName:(NSString *)viewName
19-
bridge:(RCTBridge *)bridge
20-
surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter;
16+
- (void)connectToView:(NSNumber *)viewTag surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter;
2117

2218
- (void)disconnectFromView:(NSNumber *)viewTag;
2319

packages/react-native/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.mm

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
#import <React/RCTColorAnimatedNode.h>
1212
#import <React/RCTObjectAnimatedNode.h>
1313
#import <React/RCTStyleAnimatedNode.h>
14-
#import <React/RCTUIManager.h>
14+
#import <React/RCTUtils.h>
1515
#import <React/RCTValueAnimatedNode.h>
1616

1717
@implementation RCTPropsAnimatedNode {
1818
NSNumber *_connectedViewTag;
19-
NSString *_connectedViewName;
20-
__weak RCTBridge *_bridge;
2119
__weak id<RCTSurfacePresenterStub> _surfacePresenter;
2220
NSMutableDictionary<NSString *, NSObject *> *_propsDictionary; // TODO: use RawProps or folly::dynamic directly
2321
BOOL _managedByFabric;
@@ -36,40 +34,23 @@ - (BOOL)isManagedByFabric
3634
return _managedByFabric;
3735
}
3836

39-
- (void)connectToView:(NSNumber *)viewTag
40-
viewName:(NSString *)viewName
41-
bridge:(RCTBridge *)bridge
42-
surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
37+
- (void)connectToView:(NSNumber *)viewTag surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
4338
{
44-
_bridge = bridge;
4539
_surfacePresenter = surfacePresenter;
4640
_connectedViewTag = viewTag;
47-
_connectedViewName = viewName;
4841
_managedByFabric = RCTUIManagerTypeForTagIsFabric(viewTag);
4942
}
5043

5144
- (void)disconnectFromView:(NSNumber *)viewTag
5245
{
53-
_bridge = nil;
5446
_surfacePresenter = nil;
5547
_connectedViewTag = nil;
56-
_connectedViewName = nil;
5748
_managedByFabric = NO;
5849
}
5950

6051
- (void)updateView
6152
{
62-
if (_managedByFabric) {
63-
if (_bridge.surfacePresenter) {
64-
[_bridge.surfacePresenter synchronouslyUpdateViewOnUIThread:_connectedViewTag props:_propsDictionary];
65-
} else {
66-
[_surfacePresenter synchronouslyUpdateViewOnUIThread:_connectedViewTag props:_propsDictionary];
67-
}
68-
} else {
69-
[_bridge.uiManager synchronouslyUpdateViewOnUIThread:_connectedViewTag
70-
viewName:_connectedViewName
71-
props:_propsDictionary];
72-
}
53+
[_surfacePresenter synchronouslyUpdateViewOnUIThread:_connectedViewTag props:_propsDictionary];
7354
}
7455

7556
- (void)restoreDefaultValues

packages/react-native/Libraries/NativeAnimation/RCTAnimationPlugins.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ extern "C" {
2929
Class RCTAnimationClassProvider(const char *name);
3030

3131
// Lookup functions
32-
Class RCTNativeAnimatedModuleCls(void) __attribute__((used));
3332
Class RCTNativeAnimatedTurboModuleCls(void) __attribute__((used));
3433

3534
#ifdef __cplusplus

packages/react-native/Libraries/NativeAnimation/RCTAnimationPlugins.mm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
Class RCTAnimationClassProvider(const char *name)
2121
{
2222

23-
if (name == "NativeAnimatedModule"sv) {
24-
return RCTNativeAnimatedModuleCls();
25-
}
26-
2723
if (name == "NativeAnimatedTurboModule"sv) {
2824
return RCTNativeAnimatedTurboModuleCls();
2925
}

packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedModule.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)