From 4faafb0aa42dbe51a84b5c59e82d753bef0d5fc2 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 12 Aug 2024 03:52:51 -0700 Subject: [PATCH] Remove `_shouldEmitEvent` guardrails (#45837) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45837 Some Internal tests in the old architecture were failing after landing [#45414](https://github.com/facebook/react-native/pull/45414) because the `RCTNativeAnimatedModule` in the old architecture was not declaring the event. This change fixes it by declaring the event that is never fired in the Old Architecture as it is not needed. ## Changelog [iOS][Added] - Declare the `onUserDrivenAnimationEnded` in the old Architecture Reviewed By: sammy-SC Differential Revision: D60499584 fbshipit-source-id: 581a30a88dbd6d8d67078a11699157c55ed19e58 --- .../RCTNativeAnimatedTurboModule.mm | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm b/packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm index 4d16e500925..a3f8d1583cf 100644 --- a/packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm +++ b/packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm @@ -27,9 +27,6 @@ typedef void (^AnimatedOperation)(RCTNativeAnimatedNodesManager *nodesManager); NSMutableArray *_preOperations; NSSet *_userDrivenAnimationEndedEvents; - - // TODO: Remove this when https://github.com/facebook/react-native/pull/45457 lands - BOOL _shouldEmitEvent; } RCT_EXPORT_MODULE(); @@ -45,7 +42,6 @@ RCT_EXPORT_MODULE(); _operations = [NSMutableArray new]; _preOperations = [NSMutableArray new]; _userDrivenAnimationEndedEvents = [NSSet setWithArray:@[ @"onScrollEnded" ]]; - _shouldEmitEvent = NO; } return self; } @@ -379,27 +375,8 @@ RCT_EXPORT_METHOD(queueAndExecuteBatchedOperations : (NSArray *)operationsAndArg [self sendEventWithName:@"onAnimatedValueUpdate" body:@{@"tag" : node.nodeTag, @"value" : @(value)}]; } -// TODO: Remove this when https://github.com/facebook/react-native/pull/45457 lands -- (void)startObserving -{ - [super startObserving]; - _shouldEmitEvent = YES; -} - -- (void)stopObserving -{ - [super stopObserving]; - _shouldEmitEvent = NO; -} - -// ---- - - (void)userDrivenAnimationEnded:(NSArray *)nodes { - if (!_shouldEmitEvent) { - return; - } - [self sendEventWithName:@"onUserDrivenAnimationEnded" body:@{@"tags" : nodes}]; }