Skip to content

Commit e9ed115

Browse files
p-sunfacebook-github-bot
authored andcommitted
Remove RCTUIManagerObserver from RCTNativeAnimatedTurboModule
Reviewed By: philIip Differential Revision: D32115902 fbshipit-source-id: 27a35ff4b4dad5f6364af6b91a6de9e467c068d0
1 parent b7b59ae commit e9ed115

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
#import <React/RCTEventDispatcherProtocol.h>
1010
#import <React/RCTEventEmitter.h>
1111
#import <React/RCTSurfacePresenterStub.h>
12-
#import <React/RCTUIManager.h>
13-
#import <React/RCTUIManagerObserverCoordinator.h>
1412
#import <React/RCTUIManagerUtils.h>
1513

1614
#import "RCTValueAnimatedNode.h"
1715

1816
// TODO T69437152 @petetheheat - Delete this fork when Fabric ships to 100%.
1917
// NOTE: This module is temporarily forked (see RCTNativeAnimatedModule).
2018
// When making any changes, be sure to apply them to the fork as well.
21-
@interface RCTNativeAnimatedTurboModule: RCTEventEmitter <RCTBridgeModule, RCTValueAnimatedNodeObserver, RCTEventDispatcherObserver, RCTUIManagerObserver, RCTSurfacePresenterObserver>
19+
@interface RCTNativeAnimatedTurboModule: RCTEventEmitter <RCTBridgeModule, RCTValueAnimatedNodeObserver, RCTEventDispatcherObserver, RCTSurfacePresenterObserver>
2220

2321
@end

Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm

+3-39
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ @implementation RCTNativeAnimatedTurboModule
2929
NSMutableDictionary<NSNumber *, NSNumber *> *_animIdIsManagedByFabric;
3030
// A set of nodeIDs managed by Fabric.
3131
NSMutableSet<NSNumber *> *_nodeIDsManagedByFabric;
32-
3332
}
3433

3534
RCT_EXPORT_MODULE();
@@ -52,15 +51,8 @@ - (instancetype)init
5251

5352
- (void)initialize
5453
{
55-
if (self.bridge) {
56-
_surfacePresenter = self.bridge.surfacePresenter;
57-
_nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:self.bridge surfacePresenter:_surfacePresenter];
58-
[self.bridge.uiManager.observerCoordinator addObserver:self];
59-
} else {
60-
// _surfacePresenter set in setSurfacePresenter:
61-
_nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:nil surfacePresenter:_surfacePresenter];
62-
}
63-
54+
// _surfacePresenter set in setSurfacePresenter:
55+
_nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:nil surfacePresenter:_surfacePresenter];
6456
[_surfacePresenter addObserver:self];
6557
[[self.moduleRegistry moduleForName:"EventDispatcher"] addDispatchObserver:self];
6658
}
@@ -70,7 +62,6 @@ - (void)invalidate
7062
[super invalidate];
7163
[_nodesManager stopAnimationLoop];
7264
[[self.moduleRegistry moduleForName:"EventDispatcher"] removeDispatchObserver:self];
73-
[self.bridge.uiManager.observerCoordinator removeObserver:self];
7465
[_surfacePresenter removeObserver:self];
7566
}
7667

@@ -196,8 +187,8 @@ - (void)setSurfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
196187
if (RCTUIManagerTypeForTagIsFabric(@(viewTag))) {
197188
[_nodeIDsManagedByFabric addObject:@(nodeTag)];
198189
}
199-
NSString *viewName = [self.bridge.uiManager viewNameForReactTag:[NSNumber numberWithDouble:viewTag]];
200190
[self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) {
191+
NSString *viewName; // Not used when node is managed by Fabric. Nodes are always managed by Fabric in Bridgeless.
201192
[nodesManager connectAnimatedNodeToView:[NSNumber numberWithDouble:nodeTag] viewTag:[NSNumber numberWithDouble:viewTag] viewName:viewName];
202193
}];
203194
}
@@ -336,33 +327,6 @@ - (void)didMountComponentsWithRootTag:(NSInteger)rootTag
336327
});
337328
}
338329

339-
#pragma mark - RCTUIManagerObserver
340-
341-
- (void)uiManagerWillPerformMounting:(RCTUIManager *)uiManager
342-
{
343-
if (_preOperations.count == 0 && _operations.count == 0) {
344-
return;
345-
}
346-
347-
NSArray<AnimatedOperation> *preOperations = _preOperations;
348-
NSArray<AnimatedOperation> *operations = _operations;
349-
_preOperations = [NSMutableArray new];
350-
_operations = [NSMutableArray new];
351-
352-
[uiManager prependUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
353-
for (AnimatedOperation operation in preOperations) {
354-
operation(self->_nodesManager);
355-
}
356-
}];
357-
[uiManager addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
358-
for (AnimatedOperation operation in operations) {
359-
operation(self->_nodesManager);
360-
}
361-
362-
[self->_nodesManager updateAnimations];
363-
}];
364-
}
365-
366330
#pragma mark -- Events
367331

368332
- (NSArray<NSString *> *)supportedEvents

0 commit comments

Comments
 (0)