Skip to content

Commit

Permalink
Remove _shouldEmitEvent guardrails (facebook#45837)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#45837

Some Internal tests in the old architecture were failing after landing [facebook#45414](facebook#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
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Aug 12, 2024
1 parent a8786fc commit 4faafb0
Showing 1 changed file with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ @implementation RCTNativeAnimatedTurboModule {
NSMutableArray<AnimatedOperation> *_preOperations;

NSSet<NSString *> *_userDrivenAnimationEndedEvents;

// TODO: Remove this when https://github.com/facebook/react-native/pull/45457 lands
BOOL _shouldEmitEvent;
}

RCT_EXPORT_MODULE();
Expand All @@ -45,7 +42,6 @@ - (instancetype)init
_operations = [NSMutableArray new];
_preOperations = [NSMutableArray new];
_userDrivenAnimationEndedEvents = [NSSet setWithArray:@[ @"onScrollEnded" ]];
_shouldEmitEvent = NO;
}
return self;
}
Expand Down Expand Up @@ -379,27 +375,8 @@ - (void)animatedNode:(RCTValueAnimatedNode *)node didUpdateValue:(CGFloat)value
[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}];
}

Expand Down

0 comments on commit 4faafb0

Please sign in to comment.