Skip to content

Commit 44499f2

Browse files
authored
Remove didMountComponentsWithRootTag on the new arch (#2687)
## Description Removes usage of `didMountComponentsWithRootTag` on the new architecture. It was doing exactly the same thing as `flushOperations` but was executed on a different thread, which could cause crashes. Removing this method shouldn't change any behavior as `flushOperations` is scheduled after every operation. Closes #2658 ## Test plan See #2658
1 parent 7a13ef5 commit 44499f2

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

apple/RNGestureHandlerModule.mm

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#ifdef RCT_NEW_ARCH_ENABLED
1111
#import <React/RCTBridge+Private.h>
1212
#import <React/RCTBridge.h>
13-
#import <React/RCTSurfacePresenter.h>
1413
#import <React/RCTUtils.h>
1514
#import <ReactCommon/CallInvoker.h>
1615
#import <ReactCommon/RCTTurboModule.h>
@@ -34,7 +33,7 @@
3433
#endif // RCT_NEW_ARCH_ENABLED
3534

3635
#ifdef RCT_NEW_ARCH_ENABLED
37-
@interface RNGestureHandlerModule () <RCTSurfacePresenterObserver, RNGestureHandlerStateManager>
36+
@interface RNGestureHandlerModule () <RNGestureHandlerStateManager>
3837

3938
@end
4039
#else
@@ -68,9 +67,7 @@ - (void)invalidate
6867

6968
_manager = nil;
7069

71-
#ifdef RCT_NEW_ARCH_ENABLED
72-
[self.bridge.surfacePresenter removeObserver:self];
73-
#else
70+
#ifndef RCT_NEW_ARCH_ENABLED
7471
[self.bridge.uiManager.observerCoordinator removeObserver:self];
7572
#endif // RCT_NEW_ARCH_ENABLED
7673
}
@@ -115,9 +112,7 @@ - (void)setBridge:(RCTBridge *)bridge
115112
eventDispatcher:bridge.eventDispatcher];
116113
_operations = [NSMutableArray new];
117114

118-
#ifdef RCT_NEW_ARCH_ENABLED
119-
[bridge.surfacePresenter addObserver:self];
120-
#else
115+
#ifndef RCT_NEW_ARCH_ENABLED
121116
[bridge.uiManager.observerCoordinator addObserver:self];
122117
#endif // RCT_NEW_ARCH_ENABLED
123118
}
@@ -243,27 +238,7 @@ - (void)addOperationBlock:(GestureHandlerOperation)operation
243238
[_operations addObject:operation];
244239
}
245240

246-
#pragma mark - RCTSurfacePresenterObserver
247-
248-
#ifdef RCT_NEW_ARCH_ENABLED
249-
250-
- (void)didMountComponentsWithRootTag:(NSInteger)rootTag
251-
{
252-
RCTAssertMainQueue();
253-
254-
if (_operations.count == 0) {
255-
return;
256-
}
257-
258-
NSArray<GestureHandlerOperation> *operations = _operations;
259-
_operations = [NSMutableArray new];
260-
261-
for (GestureHandlerOperation operation in operations) {
262-
operation(self->_manager);
263-
}
264-
}
265-
266-
#else
241+
#ifndef RCT_NEW_ARCH_ENABLED
267242

268243
#pragma mark - RCTUIManagerObserver
269244

0 commit comments

Comments
 (0)