UNPKG

607 BPlain TextView Raw
1'use strict';
2import { isFabric } from './PlatformChecker';
3import { runOnUI } from './threads';
4
5let VIEW_TAGS: number[] = [];
6
7export function removeFromPropsRegistry(viewTag: number) {
8 VIEW_TAGS.push(viewTag);
9 if (VIEW_TAGS.length === 1) {
10 queueMicrotask(flush);
11 }
12}
13
14function flush() {
15 if (__DEV__ && !isFabric()) {
16 throw new Error('[Reanimated] PropsRegistry is only available on Fabric.');
17 }
18 runOnUI(removeFromPropsRegistryOnUI)(VIEW_TAGS);
19 VIEW_TAGS = [];
20}
21
22function removeFromPropsRegistryOnUI(viewTags: number[]) {
23 'worklet';
24 global._removeFromPropsRegistry(viewTags);
25}