Fix order of calls for Native Animated Module

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
This commit is contained in:
Samuel Susla 2021-08-03 04:02:46 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 0b4f4eec8e
Коммит 8a8a5323cf
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -47,9 +47,9 @@ const API = {
saveValueCallback: (value: number) => void, saveValueCallback: (value: number) => void,
): void { ): void {
invariant(NativeAnimatedModule, 'Native animated module is not available'); invariant(NativeAnimatedModule, 'Native animated module is not available');
if (NativeAnimatedModule.getValue) { API.queueOperation(() => {
NativeAnimatedModule.getValue(tag, saveValueCallback); NativeAnimatedModule.getValue(tag, saveValueCallback);
} });
}, },
setWaitingForIdentifier: function(id: string): void { setWaitingForIdentifier: function(id: string): void {
waitingForQueuedOperations.add(id); waitingForQueuedOperations.add(id);