Skip to content

Commit c920b7f

Browse files
rozelefacebook-github-bot
authored andcommitted
Do not register RCTSurfacePresenterObserver for animatedShouldSignalBatch (facebook#50247)
Summary: Pull Request resolved: facebook#50247 Rather than nooping the RCTSurfacePresenterObserver in RCTNativeAnimatedTurboModule, we should just not register the observer when using ReactNativeFeatureFlags::animatedShouldSignalBatch. ## Changelog [Internal] Reviewed By: shwanton Differential Revision: D71735004 fbshipit-source-id: 5176497197314a9b07fc9bd77828f7a2af2650ea
1 parent bffb414 commit c920b7f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ - (void)initialize
5151
{
5252
// _surfacePresenter set in setSurfacePresenter:
5353
_nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:nil surfacePresenter:_surfacePresenter];
54-
[_surfacePresenter addObserver:self];
54+
if (!facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
55+
[_surfacePresenter addObserver:self];
56+
}
5557
[[self.moduleRegistry moduleForName:"EventDispatcher"] addDispatchObserver:self];
5658
}
5759

@@ -60,7 +62,9 @@ - (void)invalidate
6062
[super invalidate];
6163
[_nodesManager stopAnimationLoop];
6264
[[self.moduleRegistry moduleForName:"EventDispatcher"] removeDispatchObserver:self];
63-
[_surfacePresenter removeObserver:self];
65+
if (!facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
66+
[_surfacePresenter removeObserver:self];
67+
}
6468
}
6569

6670
/*
@@ -325,10 +329,6 @@ - (void)flushOperationQueues
325329

326330
- (void)willMountComponentsWithRootTag:(NSInteger)rootTag
327331
{
328-
if (facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
329-
return;
330-
}
331-
332332
RCTAssertMainQueue();
333333
RCTExecuteOnUIManagerQueue(^{
334334
NSArray<AnimatedOperation> *preOperations = self->_preOperations;
@@ -344,10 +344,6 @@ - (void)willMountComponentsWithRootTag:(NSInteger)rootTag
344344

345345
- (void)didMountComponentsWithRootTag:(NSInteger)rootTag
346346
{
347-
if (facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
348-
return;
349-
}
350-
351347
RCTAssertMainQueue();
352348
RCTExecuteOnUIManagerQueue(^{
353349
NSArray<AnimatedOperation> *operations = self->_operations;

0 commit comments

Comments
 (0)