mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Back out "Remove _shouldEmitEvent guardrails"
Summary: Backout of this [commit]() as the previous one was making some E2E fail and need to investigate further. ## Changelog: [Internal] - Add back `_shouldEmitEvent` guardrails Reviewed By: mdvacca, arushikesarwani94 Differential Revision: D60467145 fbshipit-source-id: a703022aa74ca0ed0fed05b59da68918eb2001e1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
48421df60a
commit
488faaaddb
@@ -27,6 +27,9 @@ 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();
|
||||
@@ -42,6 +45,7 @@ RCT_EXPORT_MODULE();
|
||||
_operations = [NSMutableArray new];
|
||||
_preOperations = [NSMutableArray new];
|
||||
_userDrivenAnimationEndedEvents = [NSSet setWithArray:@[ @"onScrollEnded" ]];
|
||||
_shouldEmitEvent = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -375,8 +379,27 @@ 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}];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user