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
This commit is contained in:
Riccardo Cipolleschi
2024-08-12 03:52:51 -07:00
committed by Facebook GitHub Bot
parent a8786fc1df
commit 4faafb0aa4
@@ -27,9 +27,6 @@ typedef void (^AnimatedOperation)(RCTNativeAnimatedNodesManager *nodesManager);
NSMutableArray<AnimatedOperation> *_preOperations;
NSSet<NSString *> *_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<NSNumber *> *)nodes
{
if (!_shouldEmitEvent) {
return;
}
[self sendEventWithName:@"onUserDrivenAnimationEnded" body:@{@"tags" : nodes}];
}