Skip to content

Commit

Permalink
Fix order of calls for Native Animated Module
Browse files Browse the repository at this point in the history
Summary:
Changelog: [internal]

Make sure the order of call is preserved for `NativeAnimatedModule`. The order of calls to NativeAnimatedModule needs to be preserved because its internals depend on it. For example, if you `getValue` is called before `createAnimatedNode`, it causes a crash.

To resolve it, we need to enqueue `getValue` onto operationQueue.

Reviewed By: JoshuaGross

Differential Revision: D30035911

fbshipit-source-id: bbd698a96cada5d2b1312a1a689ca99b04a07cdc
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Aug 3, 2021
1 parent 0b4f4ee commit 8a8a532
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Libraries/Animated/NativeAnimatedHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ const API = {
saveValueCallback: (value: number) => void,
): void {
invariant(NativeAnimatedModule, 'Native animated module is not available');
if (NativeAnimatedModule.getValue) {
API.queueOperation(() => {
NativeAnimatedModule.getValue(tag, saveValueCallback);
}
});
},
setWaitingForIdentifier: function(id: string): void {
waitingForQueuedOperations.add(id);
Expand Down

0 comments on commit 8a8a532

Please sign in to comment.