Skip to content

Commit

Permalink
Make RCTNativeAnimatedModule a regular NativeModule
Browse files Browse the repository at this point in the history
Summary:
There's a race when RCTNativeAnimatedModule is a TurboModule that breaks animations. More details here: T68603674. Even though this is a bit edge-casey, I think it's best to make this NativeModule a non-TurboModule until this problem is resolved.

Changelog: [iOS][Fixed] - Make RCTNativeAnimatedModule a regular NativeModule to unbreak animations with TurboModules on

Reviewed By: yungsters

Differential Revision: D22149179

fbshipit-source-id: 6bf9f0d5eab7c99a82b21ec07e76359181dcedd2
  • Loading branch information
RSNara authored and facebook-github-bot committed Jun 20, 2020
1 parent e5a4d95 commit e6d7f4a
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions Libraries/NativeAnimation/RCTNativeAnimatedModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

typedef void (^AnimatedOperation)(RCTNativeAnimatedNodesManager *nodesManager);

@interface RCTNativeAnimatedModule() <NativeAnimatedModuleSpec>
@end

@implementation RCTNativeAnimatedModule
{
RCTNativeAnimatedNodesManager *_nodesManager;
Expand Down Expand Up @@ -96,16 +93,16 @@ - (void)setBridge:(RCTBridge *)bridge
[nodesManager startAnimatingNode:[NSNumber numberWithDouble:animationId] nodeTag:[NSNumber numberWithDouble:nodeTag] config:config endCallback:callBack];
}];

RCTExecuteOnMainQueue(^{
if (![self->_nodesManager isNodeManagedByFabric:[NSNumber numberWithDouble:nodeTag]]) {
return;
}
RCTExecuteOnMainQueue(^{
if (![self->_nodesManager isNodeManagedByFabric:[NSNumber numberWithDouble:nodeTag]]) {
return;
}

RCTExecuteOnUIManagerQueue(^{
self->_animIdIsManagedByFabric[[NSNumber numberWithDouble:animationId]] = @YES;
[self flushOperationQueues];
});
});
RCTExecuteOnUIManagerQueue(^{
self->_animIdIsManagedByFabric[[NSNumber numberWithDouble:animationId]] = @YES;
[self flushOperationQueues];
});
});
}

RCT_EXPORT_METHOD(stopAnimation:(double)animationId)
Expand Down Expand Up @@ -335,11 +332,6 @@ - (void)eventDispatcherWillDispatchEvent:(id<RCTEvent>)event
});
}

- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
{
return std::make_shared<facebook::react::NativeAnimatedModuleSpecJSI>(params);
}

@end

Class RCTNativeAnimatedModuleCls(void) {
Expand Down

0 comments on commit e6d7f4a

Please sign in to comment.