react-native-reanimated 3.0.0-rc.7 → 3.0.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +32 -37
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +4 -3
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +161 -165
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +36 -34
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +22 -34
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +13 -14
- package/Common/cpp/SharedItems/RuntimeManager.h +1 -34
- package/Common/cpp/SharedItems/Shareables.cpp +142 -0
- package/Common/cpp/SharedItems/Shareables.h +455 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +54 -26
- package/Common/cpp/Tools/RuntimeDecorator.h +11 -2
- package/Common/cpp/Tools/Scheduler.cpp +10 -0
- package/Common/cpp/Tools/SingleInstanceChecker.h +1 -1
- package/android/src/main/cpp/LayoutAnimations.cpp +6 -16
- package/android/src/main/cpp/LayoutAnimations.h +4 -4
- package/android/src/main/cpp/NativeProxy.cpp +50 -63
- package/ios/native/NativeProxy.mm +26 -42
- package/lib/commonjs/createAnimatedComponent.js +7 -11
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +27 -55
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -3
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +7 -0
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +111 -209
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +15 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +18 -8
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +27 -36
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +24 -50
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +8 -33
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +16 -100
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +5 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +91 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +186 -0
- package/lib/commonjs/reanimated2/mappers.js.map +1 -0
- package/lib/commonjs/reanimated2/mutables.js +173 -0
- package/lib/commonjs/reanimated2/mutables.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +153 -0
- package/lib/commonjs/reanimated2/shareables.js.map +1 -0
- package/lib/commonjs/reanimated2/threads.js +58 -0
- package/lib/commonjs/reanimated2/threads.js.map +1 -0
- package/lib/commonjs/reanimated2/time.js +55 -0
- package/lib/commonjs/reanimated2/time.js.map +1 -0
- package/lib/commonjs/reanimated2/valueSetter.js +81 -0
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
- package/lib/module/createAnimatedComponent.js +7 -12
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +27 -53
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +4 -3
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +7 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/core.js +66 -188
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +16 -6
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +17 -8
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +29 -34
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +26 -52
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +8 -31
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +16 -95
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +5 -0
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +84 -0
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/index.js +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +173 -0
- package/lib/module/reanimated2/mappers.js.map +1 -0
- package/lib/module/reanimated2/mutables.js +149 -0
- package/lib/module/reanimated2/mutables.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +133 -0
- package/lib/module/reanimated2/shareables.js.map +1 -0
- package/lib/module/reanimated2/threads.js +45 -0
- package/lib/module/reanimated2/threads.js.map +1 -0
- package/lib/module/reanimated2/time.js +37 -0
- package/lib/module/reanimated2/time.js.map +1 -0
- package/lib/module/reanimated2/valueSetter.js +66 -0
- package/lib/module/reanimated2/valueSetter.js.map +1 -0
- package/package.json +1 -1
- package/plugin.js +31 -15
- package/src/createAnimatedComponent.tsx +8 -24
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +34 -53
- package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
- package/src/reanimated2/WorkletEventHandler.ts +4 -11
- package/src/reanimated2/animation/util.ts +1 -0
- package/src/reanimated2/commonTypes.ts +29 -4
- package/src/reanimated2/core.ts +103 -230
- package/src/reanimated2/globals.d.ts +26 -26
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +18 -9
- package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
- package/src/reanimated2/hook/useAnimatedSensor.ts +33 -31
- package/src/reanimated2/hook/useAnimatedStyle.ts +26 -64
- package/src/reanimated2/hook/useSharedValue.ts +6 -3
- package/src/reanimated2/hook/utils.ts +1 -1
- package/src/reanimated2/interpolateColor.ts +2 -2
- package/src/reanimated2/jestUtils.ts +14 -29
- package/src/reanimated2/js-reanimated/JSReanimated.ts +19 -93
- package/src/reanimated2/js-reanimated/index.ts +4 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +7 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/animationsManager.ts +94 -0
- package/src/reanimated2/layoutReanimation/index.ts +1 -1
- package/src/reanimated2/mappers.ts +179 -0
- package/src/reanimated2/mutables.ts +151 -0
- package/src/reanimated2/shareables.ts +121 -0
- package/src/reanimated2/threads.ts +46 -0
- package/src/reanimated2/time.ts +30 -0
- package/src/reanimated2/valueSetter.ts +64 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -127
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +0 -56
- package/Common/cpp/Registries/MapperRegistry.cpp +0 -147
- package/Common/cpp/Registries/MapperRegistry.h +0 -29
- package/Common/cpp/Registries/WorkletsCache.cpp +0 -45
- package/Common/cpp/Registries/WorkletsCache.h +0 -24
- package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
- package/Common/cpp/SharedItems/FrozenObject.h +0 -36
- package/Common/cpp/SharedItems/HostFunctionHandler.h +0 -28
- package/Common/cpp/SharedItems/MutableValue.cpp +0 -134
- package/Common/cpp/SharedItems/MutableValue.h +0 -54
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
- package/Common/cpp/SharedItems/MutableValueSetterProxy.h +0 -25
- package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
- package/Common/cpp/SharedItems/RemoteObject.h +0 -35
- package/Common/cpp/SharedItems/ShareableValue.cpp +0 -529
- package/Common/cpp/SharedItems/ShareableValue.h +0 -63
- package/Common/cpp/SharedItems/ValueWrapper.h +0 -183
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
- package/Common/cpp/Tools/JSIStoreValueUser.h +0 -37
- package/Common/cpp/Tools/Mapper.cpp +0 -86
- package/Common/cpp/Tools/Mapper.h +0 -51
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -58
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -52
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -49
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","makeMutable","
|
|
1
|
+
{"version":3,"names":["useRef","makeMutable","makeViewDescriptorsSet","sharableViewDescriptors","data","add","item","modify","descriptors","index","findIndex","descriptor","tag","push","remove","viewTag","splice","makeViewsRefSet","ref","current","items","Set","has","delete"],"sources":["ViewDescriptorsSet.ts"],"sourcesContent":["import { useRef } from 'react';\nimport { makeMutable } from './core';\nimport { SharedValue } from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\n\nexport interface ViewRefSet<T> {\n items: Set<T>;\n add: (item: T) => void;\n remove: (item: T) => void;\n}\n\nexport interface ViewDescriptorsSet {\n sharableViewDescriptors: SharedValue<Descriptor[]>;\n add: (item: Descriptor) => void;\n remove: (viewTag: number) => void;\n}\n\nexport function makeViewDescriptorsSet(): ViewDescriptorsSet {\n const sharableViewDescriptors = makeMutable<Descriptor[]>([]);\n const data: ViewDescriptorsSet = {\n sharableViewDescriptors,\n add: (item: Descriptor) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === item.tag\n );\n if (index !== -1) {\n descriptors[index] = item;\n } else {\n descriptors.push(item);\n }\n return descriptors;\n });\n },\n\n remove: (viewTag: number) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === viewTag\n );\n if (index !== -1) {\n descriptors.splice(index, 1);\n }\n return descriptors;\n });\n },\n };\n return data;\n}\n\nexport function makeViewsRefSet<T>(): ViewRefSet<T> {\n const ref = useRef<ViewRefSet<T> | null>(null);\n if (ref.current === null) {\n const data: ViewRefSet<T> = {\n items: new Set(),\n\n add: (item: T) => {\n if (data.items.has(item)) return;\n data.items.add(item);\n },\n\n remove: (item: T) => {\n data.items.delete(item);\n },\n };\n ref.current = data;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,MAAT,QAAuB,OAAvB;AACA,SAASC,WAAT,QAA4B,QAA5B;AAgBA,OAAO,SAASC,sBAAT,GAAsD;EAC3D,MAAMC,uBAAuB,GAAGF,WAAW,CAAe,EAAf,CAA3C;EACA,MAAMG,IAAwB,GAAG;IAC/BD,uBAD+B;IAE/BE,GAAG,EAAGC,IAAD,IAAsB;MACzBH,uBAAuB,CAACI,MAAxB,CAAgCC,WAAD,IAA+B;QAC5D;;QACA,MAAMC,KAAK,GAAGD,WAAW,CAACE,SAAZ,CACXC,UAAD,IAAgBA,UAAU,CAACC,GAAX,KAAmBN,IAAI,CAACM,GAD5B,CAAd;;QAGA,IAAIH,KAAK,KAAK,CAAC,CAAf,EAAkB;UAChBD,WAAW,CAACC,KAAD,CAAX,GAAqBH,IAArB;QACD,CAFD,MAEO;UACLE,WAAW,CAACK,IAAZ,CAAiBP,IAAjB;QACD;;QACD,OAAOE,WAAP;MACD,CAXD;IAYD,CAf8B;IAiB/BM,MAAM,EAAGC,OAAD,IAAqB;MAC3BZ,uBAAuB,CAACI,MAAxB,CAAgCC,WAAD,IAA+B;QAC5D;;QACA,MAAMC,KAAK,GAAGD,WAAW,CAACE,SAAZ,CACXC,UAAD,IAAgBA,UAAU,CAACC,GAAX,KAAmBG,OADvB,CAAd;;QAGA,IAAIN,KAAK,KAAK,CAAC,CAAf,EAAkB;UAChBD,WAAW,CAACQ,MAAZ,CAAmBP,KAAnB,EAA0B,CAA1B;QACD;;QACD,OAAOD,WAAP;MACD,CATD;IAUD;EA5B8B,CAAjC;EA8BA,OAAOJ,IAAP;AACD;AAED,OAAO,SAASa,eAAT,GAA6C;EAClD,MAAMC,GAAG,GAAGlB,MAAM,CAAuB,IAAvB,CAAlB;;EACA,IAAIkB,GAAG,CAACC,OAAJ,KAAgB,IAApB,EAA0B;IACxB,MAAMf,IAAmB,GAAG;MAC1BgB,KAAK,EAAE,IAAIC,GAAJ,EADmB;MAG1BhB,GAAG,EAAGC,IAAD,IAAa;QAChB,IAAIF,IAAI,CAACgB,KAAL,CAAWE,GAAX,CAAehB,IAAf,CAAJ,EAA0B;QAC1BF,IAAI,CAACgB,KAAL,CAAWf,GAAX,CAAeC,IAAf;MACD,CANyB;MAQ1BQ,MAAM,EAAGR,IAAD,IAAa;QACnBF,IAAI,CAACgB,KAAL,CAAWG,MAAX,CAAkBjB,IAAlB;MACD;IAVyB,CAA5B;IAYAY,GAAG,CAACC,OAAJ,GAAcf,IAAd;EACD;;EAED,OAAOc,GAAG,CAACC,OAAX;AACD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
3
|
import NativeReanimatedModule from './NativeReanimated';
|
|
4
|
+
import { registerEventHandler, unregisterEventHandler } from './core';
|
|
4
5
|
|
|
5
6
|
function jsListener(eventName, handler) {
|
|
6
7
|
return evt => {
|
|
@@ -48,15 +49,15 @@ export default class WorkletEventHandler {
|
|
|
48
49
|
|
|
49
50
|
registerForEvents(viewTag, fallbackEventName) {
|
|
50
51
|
this.viewTag = viewTag;
|
|
51
|
-
this.registrations = this.eventNames.map(eventName =>
|
|
52
|
+
this.registrations = this.eventNames.map(eventName => registerEventHandler(viewTag + eventName, this.worklet));
|
|
52
53
|
|
|
53
54
|
if (this.registrations.length === 0 && fallbackEventName) {
|
|
54
|
-
this.registrations.push(
|
|
55
|
+
this.registrations.push(registerEventHandler(viewTag + fallbackEventName, this.worklet));
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
unregisterFromEvents() {
|
|
59
|
-
this.registrations.forEach(id =>
|
|
60
|
+
this.registrations.forEach(id => unregisterEventHandler(id));
|
|
60
61
|
this.registrations = [];
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeReanimatedModule","jsListener","eventName","handler","evt","nativeEvent","WorkletEventHandler","constructor","worklet","eventNames","reattachNeeded","listeners","viewTag","undefined","registrations","native","reduce","acc","updateWorklet","newWorklet","registerForEvents","fallbackEventName","map","
|
|
1
|
+
{"version":3,"names":["NativeReanimatedModule","registerEventHandler","unregisterEventHandler","jsListener","eventName","handler","evt","nativeEvent","WorkletEventHandler","constructor","worklet","eventNames","reattachNeeded","listeners","viewTag","undefined","registrations","native","reduce","acc","updateWorklet","newWorklet","registerForEvents","fallbackEventName","map","length","push","unregisterFromEvents","forEach","id"],"sources":["WorkletEventHandler.ts"],"sourcesContent":["import { NativeEvent } from './commonTypes';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { registerEventHandler, unregisterEventHandler } from './core';\n\nfunction jsListener<T extends NativeEvent<T>>(\n eventName: string,\n handler: (event: T) => void\n) {\n return (evt: T) => {\n handler({ ...evt.nativeEvent, eventName });\n };\n}\n\nexport default class WorkletEventHandler<T extends NativeEvent<T>> {\n worklet: (event: T) => void;\n eventNames: string[];\n reattachNeeded: boolean;\n listeners: Record<string, (event: T) => void>;\n viewTag: number | undefined;\n registrations: string[];\n constructor(worklet: (event: T) => void, eventNames: string[] = []) {\n this.worklet = worklet;\n this.eventNames = eventNames;\n this.reattachNeeded = false;\n this.listeners = {};\n this.viewTag = undefined;\n this.registrations = [];\n\n if (!NativeReanimatedModule.native) {\n this.listeners = eventNames.reduce(\n (acc: Record<string, (event: T) => void>, eventName: string) => {\n acc[eventName] = jsListener(eventName, worklet);\n return acc;\n },\n {}\n );\n }\n }\n\n updateWorklet(newWorklet: (event: T) => void): void {\n this.worklet = newWorklet;\n this.reattachNeeded = true;\n }\n\n registerForEvents(viewTag: number, fallbackEventName?: string): void {\n this.viewTag = viewTag;\n this.registrations = this.eventNames.map((eventName) =>\n registerEventHandler(viewTag + eventName, this.worklet)\n );\n if (this.registrations.length === 0 && fallbackEventName) {\n this.registrations.push(\n registerEventHandler(viewTag + fallbackEventName, this.worklet)\n );\n }\n }\n\n unregisterFromEvents(): void {\n this.registrations.forEach((id) => unregisterEventHandler(id));\n this.registrations = [];\n }\n}\n"],"mappings":";;AACA,OAAOA,sBAAP,MAAmC,oBAAnC;AACA,SAASC,oBAAT,EAA+BC,sBAA/B,QAA6D,QAA7D;;AAEA,SAASC,UAAT,CACEC,SADF,EAEEC,OAFF,EAGE;EACA,OAAQC,GAAD,IAAY;IACjBD,OAAO,CAAC,EAAE,GAAGC,GAAG,CAACC,WAAT;MAAsBH;IAAtB,CAAD,CAAP;EACD,CAFD;AAGD;;AAED,eAAe,MAAMI,mBAAN,CAAoD;EAOjEC,WAAW,CAACC,OAAD,EAAyD;IAAA,IAA3BC,UAA2B,uEAAJ,EAAI;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAClE,KAAKD,OAAL,GAAeA,OAAf;IACA,KAAKC,UAAL,GAAkBA,UAAlB;IACA,KAAKC,cAAL,GAAsB,KAAtB;IACA,KAAKC,SAAL,GAAiB,EAAjB;IACA,KAAKC,OAAL,GAAeC,SAAf;IACA,KAAKC,aAAL,GAAqB,EAArB;;IAEA,IAAI,CAAChB,sBAAsB,CAACiB,MAA5B,EAAoC;MAClC,KAAKJ,SAAL,GAAiBF,UAAU,CAACO,MAAX,CACf,CAACC,GAAD,EAA0Cf,SAA1C,KAAgE;QAC9De,GAAG,CAACf,SAAD,CAAH,GAAiBD,UAAU,CAACC,SAAD,EAAYM,OAAZ,CAA3B;QACA,OAAOS,GAAP;MACD,CAJc,EAKf,EALe,CAAjB;IAOD;EACF;;EAEDC,aAAa,CAACC,UAAD,EAAuC;IAClD,KAAKX,OAAL,GAAeW,UAAf;IACA,KAAKT,cAAL,GAAsB,IAAtB;EACD;;EAEDU,iBAAiB,CAACR,OAAD,EAAkBS,iBAAlB,EAAoD;IACnE,KAAKT,OAAL,GAAeA,OAAf;IACA,KAAKE,aAAL,GAAqB,KAAKL,UAAL,CAAgBa,GAAhB,CAAqBpB,SAAD,IACvCH,oBAAoB,CAACa,OAAO,GAAGV,SAAX,EAAsB,KAAKM,OAA3B,CADD,CAArB;;IAGA,IAAI,KAAKM,aAAL,CAAmBS,MAAnB,KAA8B,CAA9B,IAAmCF,iBAAvC,EAA0D;MACxD,KAAKP,aAAL,CAAmBU,IAAnB,CACEzB,oBAAoB,CAACa,OAAO,GAAGS,iBAAX,EAA8B,KAAKb,OAAnC,CADtB;IAGD;EACF;;EAEDiB,oBAAoB,GAAS;IAC3B,KAAKX,aAAL,CAAmBY,OAAnB,CAA4BC,EAAD,IAAQ3B,sBAAsB,CAAC2B,EAAD,CAAzD;IACA,KAAKb,aAAL,GAAqB,EAArB;EACD;;AA9CgE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["convertToHSVA","isColor","toRGBA","NativeReanimatedModule","IN_STYLE_UPDATER","initialUpdaterRun","updater","result","recognizePrefixSuffix","value","match","Error","prefix","suffix","number","strippedValue","parseFloat","decorateAnimation","animation","isHigherOrder","baseOnStart","onStart","baseOnFrame","onFrame","animationCopy","Object","assign","callback","prefNumberSuffOnStart","timestamp","previousAnimation","__prefix","__suffix","strippedCurrent","strippedToValue","toValue","current","startValue","paPrefix","paSuffix","paStrippedValue","prefNumberSuffOnFrame","res","tab","colorOnStart","HSVAValue","HSVACurrent","HSVAToValue","forEach","i","index","undefined","push","colorOnFrame","finished","arrayOnStart","v","arrayOnFrame","Array","isArray","defineAnimation","starting","factory","create","_WORKLET","native","cancelAnimation","sharedValue","withStartValue"],"sources":["util.ts"],"sourcesContent":["import {\n HigherOrderAnimation,\n NextAnimation,\n DelayAnimation,\n RepeatAnimation,\n SequenceAnimation,\n StyleLayoutAnimation,\n} from './commonTypes';\n/* global _WORKLET */\nimport { ParsedColorArray, convertToHSVA, isColor, toRGBA } from '../Colors';\n\nimport {\n AnimatedStyle,\n SharedValue,\n AnimatableValue,\n Animation,\n AnimationObject,\n Timestamp,\n} from '../commonTypes';\nimport NativeReanimatedModule from '../NativeReanimated';\n\nlet IN_STYLE_UPDATER = false;\n\nexport type UserUpdater = () => AnimatedStyle;\n\nexport function initialUpdaterRun<T>(updater: () => T): T {\n IN_STYLE_UPDATER = true;\n const result = updater();\n IN_STYLE_UPDATER = false;\n return result;\n}\ninterface RecognizedPrefixSuffix {\n prefix?: string;\n suffix?: string;\n strippedValue: number;\n}\n\nfunction recognizePrefixSuffix(value: string | number): RecognizedPrefixSuffix {\n 'worklet';\n if (typeof value === 'string') {\n const match = value.match(\n /([A-Za-z]*)(-?\\d*\\.?\\d*)([eE][-+]?[0-9]+)?([A-Za-z%]*)/\n );\n if (!match) {\n throw Error(\n \"Couldn't parse animation value. Check if there isn't any typo.\"\n );\n }\n const prefix = match[1];\n const suffix = match[4];\n // number with scientific notation\n const number = match[2] + (match[3] ?? '');\n return { prefix, suffix, strippedValue: parseFloat(number) };\n } else {\n return { strippedValue: value };\n }\n}\n\nfunction decorateAnimation<T extends AnimationObject | StyleLayoutAnimation>(\n animation: T\n): void {\n 'worklet';\n if ((animation as HigherOrderAnimation).isHigherOrder) {\n return;\n }\n\n const baseOnStart = (animation as Animation<AnimationObject>).onStart;\n const baseOnFrame = (animation as Animation<AnimationObject>).onFrame;\n const animationCopy = Object.assign({}, animation);\n delete animationCopy.callback;\n\n const prefNumberSuffOnStart = (\n animation: Animation<AnimationObject>,\n value: string | number,\n timestamp: number,\n previousAnimation: Animation<AnimationObject>\n ) => {\n // recognize prefix, suffix, and updates stripped value on animation start\n const { prefix, suffix, strippedValue } = recognizePrefixSuffix(value);\n animation.__prefix = prefix;\n animation.__suffix = suffix;\n animation.strippedCurrent = strippedValue;\n const { strippedValue: strippedToValue } = recognizePrefixSuffix(\n animation.toValue as string | number\n );\n animation.current = strippedValue;\n animation.startValue = strippedValue;\n animation.toValue = strippedToValue;\n if (previousAnimation && previousAnimation !== animation) {\n const {\n prefix: paPrefix,\n suffix: paSuffix,\n strippedValue: paStrippedValue,\n } = recognizePrefixSuffix(previousAnimation.current as string | number);\n previousAnimation.current = paStrippedValue;\n previousAnimation.__prefix = paPrefix;\n previousAnimation.__suffix = paSuffix;\n }\n\n baseOnStart(animation, strippedValue, timestamp, previousAnimation);\n\n animation.current =\n (animation.__prefix ?? '') +\n animation.current +\n (animation.__suffix ?? '');\n\n if (previousAnimation && previousAnimation !== animation) {\n previousAnimation.current =\n (previousAnimation.__prefix ?? '') +\n previousAnimation.current +\n (previousAnimation.__suffix ?? '');\n }\n };\n const prefNumberSuffOnFrame = (\n animation: Animation<AnimationObject>,\n timestamp: number\n ) => {\n animation.current = animation.strippedCurrent;\n const res = baseOnFrame(animation, timestamp);\n animation.strippedCurrent = animation.current;\n animation.current =\n (animation.__prefix ?? '') +\n animation.current +\n (animation.__suffix ?? '');\n return res;\n };\n\n const tab = ['H', 'S', 'V', 'A'];\n const colorOnStart = (\n animation: Animation<AnimationObject>,\n value: string | number,\n timestamp: Timestamp,\n previousAnimation: Animation<AnimationObject>\n ): void => {\n let HSVAValue: ParsedColorArray;\n let HSVACurrent: ParsedColorArray;\n let HSVAToValue: ParsedColorArray;\n const res: Array<number> = [];\n if (isColor(value)) {\n HSVACurrent = convertToHSVA(animation.current);\n HSVAValue = convertToHSVA(value);\n if (animation.toValue) {\n HSVAToValue = convertToHSVA(animation.toValue);\n }\n }\n tab.forEach((i, index) => {\n animation[i] = Object.assign({}, animationCopy);\n animation[i].current = HSVACurrent[index];\n animation[i].toValue = HSVAToValue ? HSVAToValue[index] : undefined;\n animation[i].onStart(\n animation[i],\n HSVAValue[index],\n timestamp,\n previousAnimation ? previousAnimation[i] : undefined\n );\n res.push(animation[i].current);\n });\n\n animation.current = toRGBA(res as ParsedColorArray);\n };\n\n const colorOnFrame = (\n animation: Animation<AnimationObject>,\n timestamp: Timestamp\n ): boolean => {\n const HSVACurrent = convertToHSVA(animation.current);\n const res: Array<number> = [];\n let finished = true;\n tab.forEach((i, index) => {\n animation[i].current = HSVACurrent[index];\n // @ts-ignore: disable-next-line\n finished &= animation[i].onFrame(animation[i], timestamp);\n res.push(animation[i].current);\n });\n\n animation.current = toRGBA(res as ParsedColorArray);\n return finished;\n };\n\n const arrayOnStart = (\n animation: Animation<AnimationObject>,\n value: Array<number>,\n timestamp: Timestamp,\n previousAnimation: Animation<AnimationObject>\n ): void => {\n value.forEach((v, i) => {\n animation[i] = Object.assign({}, animationCopy);\n animation[i].current = v;\n animation[i].toValue = (animation.toValue as Array<number>)[i];\n animation[i].onStart(\n animation[i],\n v,\n timestamp,\n previousAnimation ? previousAnimation[i] : undefined\n );\n });\n\n animation.current = value;\n };\n\n const arrayOnFrame = (\n animation: Animation<AnimationObject>,\n timestamp: Timestamp\n ): boolean => {\n let finished = true;\n (animation.current as Array<number>).forEach((v, i) => {\n // @ts-ignore: disable-next-line\n finished &= animation[i].onFrame(animation[i], timestamp);\n (animation.current as Array<number>)[i] = animation[i].current;\n });\n\n return finished;\n };\n\n animation.onStart = (\n animation: Animation<AnimationObject>,\n value: number,\n timestamp: Timestamp,\n previousAnimation: Animation<AnimationObject>\n ) => {\n if (isColor(value)) {\n colorOnStart(animation, value, timestamp, previousAnimation);\n animation.onFrame = colorOnFrame;\n return;\n } else if (Array.isArray(value)) {\n arrayOnStart(animation, value, timestamp, previousAnimation);\n animation.onFrame = arrayOnFrame;\n return;\n } else if (typeof value === 'string') {\n prefNumberSuffOnStart(animation, value, timestamp, previousAnimation);\n animation.onFrame = prefNumberSuffOnFrame;\n return;\n }\n baseOnStart(animation, value, timestamp, previousAnimation);\n };\n}\n\ntype AnimationToDecoration<T extends AnimationObject | StyleLayoutAnimation> =\n T extends StyleLayoutAnimation\n ? Record<string, unknown>\n : T extends DelayAnimation\n ? NextAnimation<DelayAnimation>\n : T extends RepeatAnimation\n ? NextAnimation<RepeatAnimation>\n : T extends SequenceAnimation\n ? NextAnimation<SequenceAnimation>\n : AnimatableValue | T;\n\nexport function defineAnimation<\n T extends AnimationObject | StyleLayoutAnimation\n>(starting: AnimationToDecoration<T>, factory: () => T): T {\n 'worklet';\n if (IN_STYLE_UPDATER) {\n return starting as T;\n }\n const create = () => {\n 'worklet';\n const animation = factory();\n decorateAnimation<T>(animation);\n return animation;\n };\n\n if (_WORKLET || !NativeReanimatedModule.native) {\n return create();\n }\n // @ts-ignore: eslint-disable-line\n return create;\n}\n\nexport function cancelAnimation<T>(sharedValue: SharedValue<T>): void {\n 'worklet';\n // setting the current value cancels the animation if one is currently running\n sharedValue.value = sharedValue.value; // eslint-disable-line no-self-assign\n}\n\n// TODO it should work only if there was no animation before.\nexport function withStartValue(\n startValue: AnimatableValue,\n animation: NextAnimation<AnimationObject>\n): Animation<AnimationObject> {\n 'worklet';\n return defineAnimation(startValue, () => {\n 'worklet';\n if (!_WORKLET && typeof animation === 'function') {\n animation = animation();\n }\n (animation as Animation<AnimationObject>).current = startValue;\n return animation as Animation<AnimationObject>;\n });\n}\n"],"mappings":"AAQA;AACA,SAA2BA,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AAD,IAAa,OAAO9C,SAAP,KAAqB,UAAtC,EAAkD;MAChDA,SAAS,GAAGA,SAAS,EAArB;IACD;;IACAA,SAAD,CAA0CkB,OAA1C,GAAoDC,UAApD;IACA,OAAOnB,SAAP;EACD,CAPqB,CAAtB;AAQD"}
|
|
1
|
+
{"version":3,"names":["convertToHSVA","isColor","toRGBA","NativeReanimatedModule","IN_STYLE_UPDATER","initialUpdaterRun","updater","result","recognizePrefixSuffix","value","match","Error","prefix","suffix","number","strippedValue","parseFloat","decorateAnimation","animation","isHigherOrder","baseOnStart","onStart","baseOnFrame","onFrame","animationCopy","Object","assign","callback","prefNumberSuffOnStart","timestamp","previousAnimation","__prefix","__suffix","strippedCurrent","strippedToValue","toValue","current","startValue","paPrefix","paSuffix","paStrippedValue","prefNumberSuffOnFrame","res","tab","colorOnStart","HSVAValue","HSVACurrent","HSVAToValue","forEach","i","index","undefined","push","colorOnFrame","finished","arrayOnStart","v","arrayOnFrame","Array","isArray","defineAnimation","starting","factory","create","_WORKLET","native","cancelAnimation","sharedValue","withStartValue"],"sources":["util.ts"],"sourcesContent":["import {\n HigherOrderAnimation,\n NextAnimation,\n DelayAnimation,\n RepeatAnimation,\n SequenceAnimation,\n StyleLayoutAnimation,\n} from './commonTypes';\n/* global _WORKLET */\nimport { ParsedColorArray, convertToHSVA, isColor, toRGBA } from '../Colors';\n\nimport {\n AnimatedStyle,\n SharedValue,\n AnimatableValue,\n Animation,\n AnimationObject,\n Timestamp,\n} from '../commonTypes';\nimport NativeReanimatedModule from '../NativeReanimated';\n\nlet IN_STYLE_UPDATER = false;\n\nexport type UserUpdater = () => AnimatedStyle;\n\nexport function initialUpdaterRun<T>(updater: () => T): T {\n IN_STYLE_UPDATER = true;\n const result = updater();\n IN_STYLE_UPDATER = false;\n return result;\n}\n\ninterface RecognizedPrefixSuffix {\n prefix?: string;\n suffix?: string;\n strippedValue: number;\n}\n\nfunction recognizePrefixSuffix(value: string | number): RecognizedPrefixSuffix {\n 'worklet';\n if (typeof value === 'string') {\n const match = value.match(\n /([A-Za-z]*)(-?\\d*\\.?\\d*)([eE][-+]?[0-9]+)?([A-Za-z%]*)/\n );\n if (!match) {\n throw Error(\n \"Couldn't parse animation value. Check if there isn't any typo.\"\n );\n }\n const prefix = match[1];\n const suffix = match[4];\n // number with scientific notation\n const number = match[2] + (match[3] ?? '');\n return { prefix, suffix, strippedValue: parseFloat(number) };\n } else {\n return { strippedValue: value };\n }\n}\n\nfunction decorateAnimation<T extends AnimationObject | StyleLayoutAnimation>(\n animation: T\n): void {\n 'worklet';\n if ((animation as HigherOrderAnimation).isHigherOrder) {\n return;\n }\n\n const baseOnStart = (animation as Animation<AnimationObject>).onStart;\n const baseOnFrame = (animation as Animation<AnimationObject>).onFrame;\n const animationCopy = Object.assign({}, animation);\n delete animationCopy.callback;\n\n const prefNumberSuffOnStart = (\n animation: Animation<AnimationObject>,\n value: string | number,\n timestamp: number,\n previousAnimation: Animation<AnimationObject>\n ) => {\n // recognize prefix, suffix, and updates stripped value on animation start\n const { prefix, suffix, strippedValue } = recognizePrefixSuffix(value);\n animation.__prefix = prefix;\n animation.__suffix = suffix;\n animation.strippedCurrent = strippedValue;\n const { strippedValue: strippedToValue } = recognizePrefixSuffix(\n animation.toValue as string | number\n );\n animation.current = strippedValue;\n animation.startValue = strippedValue;\n animation.toValue = strippedToValue;\n if (previousAnimation && previousAnimation !== animation) {\n const {\n prefix: paPrefix,\n suffix: paSuffix,\n strippedValue: paStrippedValue,\n } = recognizePrefixSuffix(previousAnimation.current as string | number);\n previousAnimation.current = paStrippedValue;\n previousAnimation.__prefix = paPrefix;\n previousAnimation.__suffix = paSuffix;\n }\n\n baseOnStart(animation, strippedValue, timestamp, previousAnimation);\n\n animation.current =\n (animation.__prefix ?? '') +\n animation.current +\n (animation.__suffix ?? '');\n\n if (previousAnimation && previousAnimation !== animation) {\n previousAnimation.current =\n (previousAnimation.__prefix ?? '') +\n previousAnimation.current +\n (previousAnimation.__suffix ?? '');\n }\n };\n const prefNumberSuffOnFrame = (\n animation: Animation<AnimationObject>,\n timestamp: number\n ) => {\n animation.current = animation.strippedCurrent;\n const res = baseOnFrame(animation, timestamp);\n animation.strippedCurrent = animation.current;\n animation.current =\n (animation.__prefix ?? '') +\n animation.current +\n (animation.__suffix ?? '');\n return res;\n };\n\n const tab = ['H', 'S', 'V', 'A'];\n const colorOnStart = (\n animation: Animation<AnimationObject>,\n value: string | number,\n timestamp: Timestamp,\n previousAnimation: Animation<AnimationObject>\n ): void => {\n let HSVAValue: ParsedColorArray;\n let HSVACurrent: ParsedColorArray;\n let HSVAToValue: ParsedColorArray;\n const res: Array<number> = [];\n if (isColor(value)) {\n HSVACurrent = convertToHSVA(animation.current);\n HSVAValue = convertToHSVA(value);\n if (animation.toValue) {\n HSVAToValue = convertToHSVA(animation.toValue);\n }\n }\n tab.forEach((i, index) => {\n animation[i] = Object.assign({}, animationCopy);\n animation[i].current = HSVACurrent[index];\n animation[i].toValue = HSVAToValue ? HSVAToValue[index] : undefined;\n animation[i].onStart(\n animation[i],\n HSVAValue[index],\n timestamp,\n previousAnimation ? previousAnimation[i] : undefined\n );\n res.push(animation[i].current);\n });\n\n animation.current = toRGBA(res as ParsedColorArray);\n };\n\n const colorOnFrame = (\n animation: Animation<AnimationObject>,\n timestamp: Timestamp\n ): boolean => {\n const HSVACurrent = convertToHSVA(animation.current);\n const res: Array<number> = [];\n let finished = true;\n tab.forEach((i, index) => {\n animation[i].current = HSVACurrent[index];\n // @ts-ignore: disable-next-line\n finished &= animation[i].onFrame(animation[i], timestamp);\n res.push(animation[i].current);\n });\n\n animation.current = toRGBA(res as ParsedColorArray);\n return finished;\n };\n\n const arrayOnStart = (\n animation: Animation<AnimationObject>,\n value: Array<number>,\n timestamp: Timestamp,\n previousAnimation: Animation<AnimationObject>\n ): void => {\n value.forEach((v, i) => {\n animation[i] = Object.assign({}, animationCopy);\n animation[i].current = v;\n animation[i].toValue = (animation.toValue as Array<number>)[i];\n animation[i].onStart(\n animation[i],\n v,\n timestamp,\n previousAnimation ? previousAnimation[i] : undefined\n );\n });\n\n animation.current = value;\n };\n\n const arrayOnFrame = (\n animation: Animation<AnimationObject>,\n timestamp: Timestamp\n ): boolean => {\n let finished = true;\n (animation.current as Array<number>).forEach((v, i) => {\n // @ts-ignore: disable-next-line\n finished &= animation[i].onFrame(animation[i], timestamp);\n (animation.current as Array<number>)[i] = animation[i].current;\n });\n\n return finished;\n };\n\n animation.onStart = (\n animation: Animation<AnimationObject>,\n value: number,\n timestamp: Timestamp,\n previousAnimation: Animation<AnimationObject>\n ) => {\n if (isColor(value)) {\n colorOnStart(animation, value, timestamp, previousAnimation);\n animation.onFrame = colorOnFrame;\n return;\n } else if (Array.isArray(value)) {\n arrayOnStart(animation, value, timestamp, previousAnimation);\n animation.onFrame = arrayOnFrame;\n return;\n } else if (typeof value === 'string') {\n prefNumberSuffOnStart(animation, value, timestamp, previousAnimation);\n animation.onFrame = prefNumberSuffOnFrame;\n return;\n }\n baseOnStart(animation, value, timestamp, previousAnimation);\n };\n}\n\ntype AnimationToDecoration<T extends AnimationObject | StyleLayoutAnimation> =\n T extends StyleLayoutAnimation\n ? Record<string, unknown>\n : T extends DelayAnimation\n ? NextAnimation<DelayAnimation>\n : T extends RepeatAnimation\n ? NextAnimation<RepeatAnimation>\n : T extends SequenceAnimation\n ? NextAnimation<SequenceAnimation>\n : AnimatableValue | T;\n\nexport function defineAnimation<\n T extends AnimationObject | StyleLayoutAnimation\n>(starting: AnimationToDecoration<T>, factory: () => T): T {\n 'worklet';\n if (IN_STYLE_UPDATER) {\n return starting as T;\n }\n const create = () => {\n 'worklet';\n const animation = factory();\n decorateAnimation<T>(animation);\n return animation;\n };\n\n if (_WORKLET || !NativeReanimatedModule.native) {\n return create();\n }\n // @ts-ignore: eslint-disable-line\n return create;\n}\n\nexport function cancelAnimation<T>(sharedValue: SharedValue<T>): void {\n 'worklet';\n // setting the current value cancels the animation if one is currently running\n sharedValue.value = sharedValue.value; // eslint-disable-line no-self-assign\n}\n\n// TODO it should work only if there was no animation before.\nexport function withStartValue(\n startValue: AnimatableValue,\n animation: NextAnimation<AnimationObject>\n): Animation<AnimationObject> {\n 'worklet';\n return defineAnimation(startValue, () => {\n 'worklet';\n if (!_WORKLET && typeof animation === 'function') {\n animation = animation();\n }\n (animation as Animation<AnimationObject>).current = startValue;\n return animation as Animation<AnimationObject>;\n });\n}\n"],"mappings":"AAQA;AACA,SAA2BA,aAA3B,EAA0CC,OAA1C,EAAmDC,MAAnD,QAAiE,WAAjE;AAUA,OAAOC,sBAAP,MAAmC,qBAAnC;AAEA,IAAIC,gBAAgB,GAAG,KAAvB;AAIA,OAAO,SAASC,iBAAT,CAA8BC,OAA9B,EAAmD;EACxDF,gBAAgB,GAAG,IAAnB;EACA,MAAMG,MAAM,GAAGD,OAAO,EAAtB;EACAF,gBAAgB,GAAG,KAAnB;EACA,OAAOG,MAAP;AACD;;AAQD,SAASC,qBAAT,CAA+BC,KAA/B,EAA+E;EAC7E;;EACA,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC7B,MAAMC,KAAK,GAAGD,KAAK,CAACC,KAAN,CACZ,wDADY,CAAd;;IAGA,IAAI,CAACA,KAAL,EAAY;MACV,MAAMC,KAAK,CACT,gEADS,CAAX;IAGD;;IACD,MAAMC,MAAM,GAAGF,KAAK,CAAC,CAAD,CAApB;IACA,MAAMG,MAAM,GAAGH,KAAK,CAAC,CAAD,CAApB,CAV6B,CAW7B;;IACA,MAAMI,MAAM,GAAGJ,KAAK,CAAC,CAAD,CAAL,IAAYA,KAAK,CAAC,CAAD,CAAL,IAAY,EAAxB,CAAf;IACA,OAAO;MAAEE,MAAF;MAAUC,MAAV;MAAkBE,aAAa,EAAEC,UAAU,CAACF,MAAD;IAA3C,CAAP;EACD,CAdD,MAcO;IACL,OAAO;MAAEC,aAAa,EAAEN;IAAjB,CAAP;EACD;AACF;;AAED,SAASQ,iBAAT,CACEC,SADF,EAEQ;EACN;;EACA,IAAKA,S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AAT,CAA4BC,WAA5B,EAA+D;EACpE,UADoE,CAEpE;;EACAA,WAAW,CAAC1D,KAAZ,GAAoB0D,WAAW,CAAC1D,KAAhC,CAHoE,CAG7B;AACxC,C,CAED;;AACA,OAAO,SAAS2D,cAAT,CACL/B,UADK,EAELnB,SAFK,EAGuB;EAC5B;;EACA,OAAO0C,eAAe,CAACvB,UAAD,EAAa,MAAM;IACvC;;IACA,IAAI,CAAC2B,QAAD,IAAa,OAAO9C,SAAP,KAAqB,UAAtC,EAAkD;MAChDA,SAAS,GAAGA,SAAS,EAArB;IACD;;IACAA,SAAD,CAA0CkB,OAA1C,GAAoDC,UAApD;IACA,OAAOnB,SAAP;EACD,CAPqB,CAAtB;AAQD"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
// The below type is used for HostObjects retured by the JSI API that don't have
|
|
2
|
+
// any accessable fields or methods but can carry data that is accessed from the
|
|
3
|
+
// c++ side. We add a field to the type to make it possible for typescript to recognize
|
|
4
|
+
// which JSI methods accept those types as arguments and to be able to correctly type
|
|
5
|
+
// check other methods that may use them. However, this field is not actually defined
|
|
6
|
+
// nor should be used for anything else as assigning any data to those objects will
|
|
7
|
+
// throw an error.
|
|
1
8
|
export let KeyboardState;
|
|
2
9
|
|
|
3
10
|
(function (KeyboardState) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["KeyboardState"],"sources":["commonTypes.ts"],"sourcesContent":["import {\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n TranslateXTransform,\n TranslateYTransform,\n SkewXTransform,\n SkewYTransform,\n MatrixTransform,\n ViewStyle,\n TextStyle,\n} from 'react-native';\n\nexport type TransformProperty =\n | PerpectiveTransform\n | RotateTransform\n | RotateXTransform\n | RotateYTransform\n | RotateZTransform\n | ScaleTransform\n | ScaleXTransform\n | ScaleYTransform\n | TranslateXTransform\n | TranslateYTransform\n | SkewXTransform\n | SkewYTransform\n | MatrixTransform;\n\nexport interface StyleProps extends ViewStyle, TextStyle {\n originX?: number;\n originY?: number;\n [key: string]: any;\n}\n\nexport interface AnimatedStyle\n extends Record<string, Animation<AnimationObject>> {\n [key: string]: any;\n transform?: Array<Record<string, Animation<AnimationObject>>>;\n}\nexport interface SharedValue<T> {\n value: T;\n}\n\nexport type Context = Record<string, unknown>;\n\nexport interface WorkletFunction {\n _closure?: Context;\n __workletHash?: number;\n __optimalization?: number;\n}\n\nexport interface BasicWorkletFunction<T> extends WorkletFunction {\n (): T;\n}\n\nexport interface BasicWorkletFunctionOptional<T> extends WorkletFunction {\n (): Partial<T>;\n}\n\nexport interface NativeEvent<T> {\n nativeEvent: T;\n}\nexport interface ComplexWorkletFunction<A extends any[], R>\n extends WorkletFunction {\n (...args: A): R;\n}\n\nexport interface NestedObject<T> {\n [key: string]: NestedObjectValues<T>;\n}\n\nexport type NestedObjectValues<T> =\n | T\n | Array<NestedObjectValues<T>>\n | NestedObject<T>;\n\nexport interface AdapterWorkletFunction extends WorkletFunction {\n (value: NestedObject<string | number | AnimationObject>): void;\n}\n\nexport type AnimatableValue = number | string | Array<number>;\n\nexport interface AnimationObject {\n [key: string]: any;\n callback: AnimationCallback;\n current?: AnimatableValue;\n toValue?: AnimationObject['current'];\n startValue?: AnimationObject['current'];\n finished?: boolean;\n strippedCurrent?: number;\n cancelled?: boolean;\n\n __prefix?: string;\n __suffix?: string;\n onFrame: (animation: any, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: any,\n current: any,\n timestamp: Timestamp,\n previousAnimation: any\n ) => void;\n}\n\nexport interface Animation<T extends AnimationObject> extends AnimationObject {\n onFrame: (animation: T, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: T,\n current: T extends NumericAnimation ? number : AnimatableValue,\n timestamp: Timestamp,\n previousAnimation: T\n ) => void;\n}\n\nexport interface NumericAnimation {\n current?: number;\n}\n\nexport type AnimationCallback = (\n finished?: boolean,\n current?: AnimatableValue\n) => void;\n\nexport type Timestamp = number;\n\nexport type Value3D = {\n x: number;\n y: number;\n z: number;\n};\n\nexport type
|
|
1
|
+
{"version":3,"names":["KeyboardState"],"sources":["commonTypes.ts"],"sourcesContent":["import {\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n TranslateXTransform,\n TranslateYTransform,\n SkewXTransform,\n SkewYTransform,\n MatrixTransform,\n ViewStyle,\n TextStyle,\n} from 'react-native';\n\nexport type TransformProperty =\n | PerpectiveTransform\n | RotateTransform\n | RotateXTransform\n | RotateYTransform\n | RotateZTransform\n | ScaleTransform\n | ScaleXTransform\n | ScaleYTransform\n | TranslateXTransform\n | TranslateYTransform\n | SkewXTransform\n | SkewYTransform\n | MatrixTransform;\n\nexport interface StyleProps extends ViewStyle, TextStyle {\n originX?: number;\n originY?: number;\n [key: string]: any;\n}\n\nexport interface AnimatedStyle\n extends Record<string, Animation<AnimationObject>> {\n [key: string]: any;\n transform?: Array<Record<string, Animation<AnimationObject>>>;\n}\nexport interface SharedValue<T> {\n value: T;\n addListener: (listenerID: number, listener: (value: T) => void) => void;\n removeListener: (listenerID: number) => void;\n modify: (modifier: (value: T) => T) => void;\n}\n\n// The below type is used for HostObjects retured by the JSI API that don't have\n// any accessable fields or methods but can carry data that is accessed from the\n// c++ side. We add a field to the type to make it possible for typescript to recognize\n// which JSI methods accept those types as arguments and to be able to correctly type\n// check other methods that may use them. However, this field is not actually defined\n// nor should be used for anything else as assigning any data to those objects will\n// throw an error.\nexport type ShareableRef<T> = {\n __hostObjectShareableJSRef: T;\n};\n\nexport type ShareableSyncDataHolderRef<T> = {\n __hostObjectShareableJSRefSyncDataHolder: T;\n};\n\nexport type MapperRegistry = {\n start: (\n mapperID: number,\n worklet: () => void,\n inputs: SharedValue<any>[],\n outputs?: SharedValue<any>[]\n ) => void;\n stop: (mapperID: number) => void;\n};\n\nexport type Context = Record<string, unknown>;\n\nexport interface WorkletFunction {\n _closure?: Context;\n __workletHash?: number;\n __optimalization?: number;\n}\n\nexport interface BasicWorkletFunction<T> extends WorkletFunction {\n (): T;\n}\n\nexport interface BasicWorkletFunctionOptional<T> extends WorkletFunction {\n (): Partial<T>;\n}\n\nexport interface NativeEvent<T> {\n nativeEvent: T;\n}\nexport interface ComplexWorkletFunction<A extends any[], R>\n extends WorkletFunction {\n (...args: A): R;\n __remoteFunction?: (...args: A) => R;\n}\n\nexport interface NestedObject<T> {\n [key: string]: NestedObjectValues<T>;\n}\n\nexport type NestedObjectValues<T> =\n | T\n | Array<NestedObjectValues<T>>\n | NestedObject<T>;\n\nexport interface AdapterWorkletFunction extends WorkletFunction {\n (value: NestedObject<string | number | AnimationObject>): void;\n}\n\nexport type AnimatableValue = number | string | Array<number>;\n\nexport interface AnimationObject {\n [key: string]: any;\n callback: AnimationCallback;\n current?: AnimatableValue;\n toValue?: AnimationObject['current'];\n startValue?: AnimationObject['current'];\n finished?: boolean;\n strippedCurrent?: number;\n cancelled?: boolean;\n\n __prefix?: string;\n __suffix?: string;\n onFrame: (animation: any, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: any,\n current: any,\n timestamp: Timestamp,\n previousAnimation: any\n ) => void;\n}\n\nexport interface Animation<T extends AnimationObject> extends AnimationObject {\n onFrame: (animation: T, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: T,\n current: T extends NumericAnimation ? number : AnimatableValue,\n timestamp: Timestamp,\n previousAnimation: T\n ) => void;\n}\n\nexport interface NumericAnimation {\n current?: number;\n}\n\nexport type AnimationCallback = (\n finished?: boolean,\n current?: AnimatableValue\n) => void;\n\nexport type Timestamp = number;\n\nexport type Value3D = {\n x: number;\n y: number;\n z: number;\n};\n\nexport type ValueRotation = {\n qw: number;\n qx: number;\n qy: number;\n qz: number;\n yaw: number;\n pitch: number;\n roll: number;\n};\n\nexport type ShadowNodeWrapper = object;\n\nexport enum KeyboardState {\n UNKNOWN = 0,\n OPENING = 1,\n OPEN = 2,\n CLOSING = 3,\n CLOSED = 4,\n}\n\nexport type AnimatedKeyboardInfo = {\n height: SharedValue<number>;\n state: SharedValue<KeyboardState>;\n};\n\nexport interface MeasuredDimensions {\n x: number;\n y: number;\n width: number;\n height: number;\n pageX: number;\n pageY: number;\n}\n"],"mappings":"AAmDA;AACA;AACA;AACA;AACA;AACA;AACA;AAuHA,WAAYA,aAAZ;;WAAYA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
/* global
|
|
1
|
+
/* global _setGlobalConsole */
|
|
2
2
|
import NativeReanimatedModule from './NativeReanimated';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
3
|
import { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';
|
|
4
|
+
import { makeShareableCloneRecursive, makeShareable as makeShareableUnwrapped } from './shareables';
|
|
5
|
+
import { runOnUI, runOnJS } from './threads';
|
|
6
|
+
import { startMapper as startMapperUnwrapped } from './mappers';
|
|
7
|
+
import { makeMutable as makeMutableUnwrapped, makeRemote as makeRemoteUnwrapped } from './mutables';
|
|
8
|
+
export { stopMapper } from './mappers';
|
|
9
|
+
export { runOnJS, runOnUI } from './threads';
|
|
10
|
+
export { getTimestamp } from './time';
|
|
5
11
|
|
|
6
12
|
if (global._setGlobalConsole === undefined) {
|
|
7
13
|
// it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1
|
|
@@ -37,33 +43,22 @@ export const isConfigured = function () {
|
|
|
37
43
|
export const isConfiguredCheck = () => {
|
|
38
44
|
checkPluginState(true);
|
|
39
45
|
};
|
|
40
|
-
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} else {
|
|
51
|
-
pushFrame(frame);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
46
|
+
const configurationCheckWrapper = __DEV__ ? fn => {
|
|
47
|
+
return function () {
|
|
48
|
+
isConfigured(true);
|
|
49
|
+
return fn(...arguments);
|
|
50
|
+
};
|
|
51
|
+
} : fn => fn;
|
|
52
|
+
export const startMapper = __DEV__ ? configurationCheckWrapper(startMapperUnwrapped) : startMapperUnwrapped;
|
|
53
|
+
export const makeShareable = __DEV__ ? configurationCheckWrapper(makeShareableUnwrapped) : makeShareableUnwrapped;
|
|
54
|
+
export const makeMutable = __DEV__ ? configurationCheckWrapper(makeMutableUnwrapped) : makeMutableUnwrapped;
|
|
55
|
+
export const makeRemote = __DEV__ ? configurationCheckWrapper(makeRemoteUnwrapped) : makeRemoteUnwrapped;
|
|
54
56
|
global._WORKLET = false;
|
|
55
57
|
|
|
56
58
|
global._log = function (s) {
|
|
57
59
|
console.log(s);
|
|
58
60
|
};
|
|
59
61
|
|
|
60
|
-
export function runOnUI(worklet) {
|
|
61
|
-
return makeShareable(worklet);
|
|
62
|
-
}
|
|
63
|
-
export function makeShareable(value) {
|
|
64
|
-
isConfiguredCheck();
|
|
65
|
-
return NativeReanimatedModule.makeShareable(value);
|
|
66
|
-
}
|
|
67
62
|
export function getViewProp(viewTag, propName) {
|
|
68
63
|
if (global._IS_FABRIC) {
|
|
69
64
|
throw new Error('[react-native-reanimated] `getViewProp` is not supported on Fabric yet');
|
|
@@ -80,188 +75,74 @@ export function getViewProp(viewTag, propName) {
|
|
|
80
75
|
});
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (nativeShouldBeMock()) {
|
|
86
|
-
_getTimestamp = () => {
|
|
87
|
-
return NativeReanimatedModule.getTimestamp();
|
|
88
|
-
};
|
|
89
|
-
} else {
|
|
90
|
-
_getTimestamp = () => {
|
|
91
|
-
'worklet';
|
|
92
|
-
|
|
93
|
-
if (_frameTimestamp) {
|
|
94
|
-
return _frameTimestamp;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (_eventTimestamp) {
|
|
98
|
-
return _eventTimestamp;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return _getCurrentTime();
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export function getTimestamp() {
|
|
106
|
-
'worklet';
|
|
107
|
-
|
|
108
|
-
if (Platform.OS === 'web') {
|
|
109
|
-
return NativeReanimatedModule.getTimestamp();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return _getTimestamp();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function workletValueSetter(value) {
|
|
78
|
+
function valueUnpacker(objectToUnpack, category) {
|
|
116
79
|
'worklet';
|
|
117
80
|
|
|
118
|
-
|
|
81
|
+
let workletsCache = global.__workletsCache;
|
|
82
|
+
let handleCache = global.__handleCache;
|
|
119
83
|
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
84
|
+
if (workletsCache === undefined) {
|
|
85
|
+
// init
|
|
86
|
+
workletsCache = global.__workletsCache = new Map();
|
|
87
|
+
handleCache = global.__handleCache = new WeakMap();
|
|
123
88
|
}
|
|
124
89
|
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
// and triggering the mappers that treat this value as an input
|
|
128
|
-
// this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)
|
|
129
|
-
// built in animations that are not higher order(withTiming, withSpring) hold target value in .current
|
|
130
|
-
|
|
131
|
-
if (this._value === animation.current && !animation.isHigherOrder) {
|
|
132
|
-
animation.callback && animation.callback(true);
|
|
133
|
-
return;
|
|
134
|
-
} // animated set
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const initializeAnimation = timestamp => {
|
|
138
|
-
animation.onStart(animation, this.value, timestamp, previousAnimation);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const currentTimestamp = getTimestamp();
|
|
142
|
-
initializeAnimation(currentTimestamp);
|
|
90
|
+
if (objectToUnpack.__workletHash) {
|
|
91
|
+
let workletFun = workletsCache.get(objectToUnpack.__workletHash);
|
|
143
92
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const finished = animation.onFrame(animation, timestamp);
|
|
153
|
-
animation.finished = true;
|
|
154
|
-
animation.timestamp = timestamp;
|
|
155
|
-
this._value = animation.current;
|
|
156
|
-
|
|
157
|
-
if (finished) {
|
|
158
|
-
animation.callback && animation.callback(true
|
|
159
|
-
/* finished */
|
|
160
|
-
);
|
|
161
|
-
} else {
|
|
162
|
-
requestAnimationFrame(step);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
this._animation = animation;
|
|
167
|
-
step(currentTimestamp);
|
|
168
|
-
} else {
|
|
169
|
-
// prevent setting again to the same value
|
|
170
|
-
// and triggering the mappers that treat this value as an input
|
|
171
|
-
if (this._value === value) {
|
|
172
|
-
return;
|
|
93
|
+
if (workletFun === undefined) {
|
|
94
|
+
// eslint-disable-next-line no-eval
|
|
95
|
+
workletFun = eval('(' + objectToUnpack.asString + '\n)');
|
|
96
|
+
workletsCache.set(objectToUnpack.__workletHash, workletFun);
|
|
173
97
|
}
|
|
174
98
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
99
|
+
const functionInstance = workletFun.bind(objectToUnpack);
|
|
100
|
+
objectToUnpack._recur = functionInstance;
|
|
101
|
+
return functionInstance;
|
|
102
|
+
} else if (objectToUnpack.__init) {
|
|
103
|
+
let value = handleCache.get(objectToUnpack);
|
|
179
104
|
|
|
105
|
+
if (value === undefined) {
|
|
106
|
+
value = objectToUnpack.__init();
|
|
107
|
+
handleCache.set(objectToUnpack, value);
|
|
108
|
+
}
|
|
180
109
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
previousAnimation.cancelled = true;
|
|
186
|
-
this._animation = null;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (typeof value === 'function' || value !== null && typeof value === 'object' && value.onFrame) {
|
|
190
|
-
// animated set
|
|
191
|
-
const animation = typeof value === 'function' ? value() : value;
|
|
192
|
-
|
|
193
|
-
let initializeAnimation = timestamp => {
|
|
194
|
-
animation.onStart(animation, this.value, timestamp, previousAnimation);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const step = timestamp => {
|
|
198
|
-
if (animation.cancelled) {
|
|
199
|
-
animation.callback && animation.callback(false
|
|
200
|
-
/* finished */
|
|
201
|
-
);
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (initializeAnimation) {
|
|
206
|
-
initializeAnimation(timestamp);
|
|
207
|
-
initializeAnimation = null; // prevent closure from keeping ref to previous animation
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const finished = animation.onFrame(animation, timestamp);
|
|
211
|
-
animation.timestamp = timestamp;
|
|
212
|
-
this._setValue && this._setValue(animation.current);
|
|
110
|
+
return value;
|
|
111
|
+
} else if (category === 'RemoteFunction') {
|
|
112
|
+
const fun = () => {
|
|
113
|
+
throw new Error(`Tried to synchronously call a non-worklet function on the UI thread.
|
|
213
114
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
);
|
|
218
|
-
} else {
|
|
219
|
-
requestFrame(step);
|
|
220
|
-
}
|
|
115
|
+
Possible solutions are:
|
|
116
|
+
a) If you want to synchronously execute this method, mark it as a worklet
|
|
117
|
+
b) If you want to execute this function on the JS thread, wrap it using \`runOnJS\``);
|
|
221
118
|
};
|
|
222
119
|
|
|
223
|
-
|
|
224
|
-
|
|
120
|
+
fun.__remoteFunction = objectToUnpack;
|
|
121
|
+
return fun;
|
|
225
122
|
} else {
|
|
226
|
-
|
|
123
|
+
throw new Error('data type not recognized by unpack method');
|
|
227
124
|
}
|
|
228
125
|
}
|
|
229
126
|
|
|
230
|
-
export function
|
|
231
|
-
|
|
232
|
-
return NativeReanimatedModule.makeMutable(value);
|
|
127
|
+
export function registerEventHandler(eventHash, eventHandler) {
|
|
128
|
+
return NativeReanimatedModule.registerEventHandler(eventHash, makeShareableCloneRecursive(eventHandler));
|
|
233
129
|
}
|
|
234
|
-
export function
|
|
235
|
-
|
|
236
|
-
isConfiguredCheck();
|
|
237
|
-
return NativeReanimatedModule.makeRemote(object);
|
|
130
|
+
export function unregisterEventHandler(id) {
|
|
131
|
+
return NativeReanimatedModule.unregisterEventHandler(id);
|
|
238
132
|
}
|
|
239
|
-
export function
|
|
240
|
-
|
|
241
|
-
let outputs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
242
|
-
let updater = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : () => {// noop
|
|
243
|
-
};
|
|
244
|
-
let viewDescriptors = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
245
|
-
isConfiguredCheck();
|
|
246
|
-
return NativeReanimatedModule.startMapper(mapper, inputs, outputs, updater, viewDescriptors);
|
|
133
|
+
export function subscribeForKeyboardEvents(eventHandler) {
|
|
134
|
+
return NativeReanimatedModule.subscribeForKeyboardEvents(makeShareableCloneRecursive(eventHandler));
|
|
247
135
|
}
|
|
248
|
-
export function
|
|
249
|
-
NativeReanimatedModule.
|
|
136
|
+
export function unsubscribeFromKeyboardEvents(listenerId) {
|
|
137
|
+
return NativeReanimatedModule.unsubscribeFromKeyboardEvents(listenerId);
|
|
250
138
|
}
|
|
251
|
-
export function
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
if (!_WORKLET) {
|
|
255
|
-
return fun;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (!fun.__callAsync) {
|
|
259
|
-
throw new Error("Attempting to call runOnJS with an object that is not a host function. Using runOnJS is only possible with methods that are defined on the main React-Native Javascript thread and that aren't marked as worklets");
|
|
260
|
-
} else {
|
|
261
|
-
return fun.__callAsync;
|
|
262
|
-
}
|
|
139
|
+
export function registerSensor(sensorType, interval, eventHandler) {
|
|
140
|
+
return NativeReanimatedModule.registerSensor(sensorType, interval, makeShareableCloneRecursive(eventHandler));
|
|
263
141
|
}
|
|
264
|
-
|
|
142
|
+
export function unregisterSensor(listenerId) {
|
|
143
|
+
return NativeReanimatedModule.unregisterSensor(listenerId);
|
|
144
|
+
}
|
|
145
|
+
NativeReanimatedModule.installCoreFunctions(valueUnpacker);
|
|
265
146
|
|
|
266
147
|
if (!isWeb() && isConfigured()) {
|
|
267
148
|
const capturableConsole = console;
|
|
@@ -298,15 +179,12 @@ export function enableLayoutAnimations(flag) {
|
|
|
298
179
|
NativeReanimatedModule.enableLayoutAnimations(flag);
|
|
299
180
|
}
|
|
300
181
|
}
|
|
301
|
-
export function configureLayoutAnimations(viewTag, type, config
|
|
302
|
-
NativeReanimatedModule.configureLayoutAnimation(viewTag, type, config
|
|
182
|
+
export function configureLayoutAnimations(viewTag, type, config) {
|
|
183
|
+
NativeReanimatedModule.configureLayoutAnimation(viewTag, type, makeShareableCloneRecursive(config));
|
|
303
184
|
}
|
|
304
185
|
export function configureProps(uiProps, nativeProps) {
|
|
305
186
|
if (!nativeShouldBeMock()) {
|
|
306
187
|
NativeReanimatedModule.configureProps(uiProps, nativeProps);
|
|
307
188
|
}
|
|
308
189
|
}
|
|
309
|
-
export function jestResetJsReanimatedModule() {
|
|
310
|
-
NativeReanimatedModule.jestResetModule();
|
|
311
|
-
}
|
|
312
190
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeReanimatedModule","Platform","nativeShouldBeMock","shouldBeUseWeb","isWeb","global","_setGlobalConsole","undefined","testWorklet","throwUninitializedReanimatedException","Error","checkPluginState","throwError","__workletHash","isConfigured","isConfiguredCheck","pushFrame","frame","requestFrame","native","requestAnimationFrame","_WORKLET","_log","s","console","log","runOnUI","worklet","makeShareable","value","getViewProp","viewTag","propName","_IS_FABRIC","Promise","resolve","reject","result","substr","_getTimestamp","getTimestamp","_frameTimestamp","_eventTimestamp","_getCurrentTime","OS","workletValueSetter","previousAnimation","_animation","cancelled","onFrame","animation","_value","current","isHigherOrder","callback","initializeAnimation","timestamp","onStart","currentTimestamp","step","finished","workletValueSetterJS","_setValue","makeMutable","makeRemote","object","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","runOnJS","fun","__callAsync","installCoreFunctions","capturableConsole","debug","warn","error","info","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimations","type","config","viewSharedValue","configureLayoutAnimation","configureProps","uiProps","nativeProps","jestResetJsReanimatedModule","jestResetModule"],"sources":["core.ts"],"sourcesContent":["/* global _WORKLET _getCurrentTime _frameTimestamp _eventTimestamp _setGlobalConsole */\nimport NativeReanimatedModule from './NativeReanimated';\nimport { Platform } from 'react-native';\nimport { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';\nimport {\n BasicWorkletFunction,\n ComplexWorkletFunction,\n SharedValue,\n AnimationObject,\n AnimatableValue,\n Timestamp,\n} from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\nimport JSReanimated from './js-reanimated/JSReanimated';\nimport { LayoutAnimationFunction } from './layoutReanimation';\n\nif (global._setGlobalConsole === undefined) {\n // it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1\n global._setGlobalConsole = () => {\n // noop\n };\n}\n\nexport type ReanimatedConsole = Pick<\n Console,\n 'debug' | 'log' | 'warn' | 'info' | 'error'\n>;\n\nexport type WorkletValue =\n | (() => AnimationObject)\n | AnimationObject\n | AnimatableValue\n | Descriptor;\ninterface WorkletValueSetterContext {\n _animation?: AnimationObject | null;\n _value?: AnimatableValue | Descriptor;\n value?: AnimatableValue;\n _setValue?: (val: AnimatableValue | Descriptor) => void;\n}\n\nconst testWorklet: BasicWorkletFunction<void> = () => {\n 'worklet';\n};\n\nconst throwUninitializedReanimatedException = () => {\n throw new Error(\n \"Failed to initialize react-native-reanimated library, make sure you followed installation steps here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ \\n1) Make sure reanimated's babel plugin is installed in your babel.config.js (you should have 'react-native-reanimated/plugin' listed there - also see the above link for details) \\n2) Make sure you reset build cache after updating the config, run: yarn start --reset-cache\"\n );\n};\n\nexport const checkPluginState: (throwError: boolean) => boolean = (\n throwError = true\n) => {\n if (!testWorklet.__workletHash && !shouldBeUseWeb()) {\n if (throwError) {\n throwUninitializedReanimatedException();\n }\n return false;\n }\n return true;\n};\n\nexport const isConfigured: (throwError?: boolean) => boolean = (\n throwError = false\n) => {\n return checkPluginState(throwError);\n};\n\nexport const isConfiguredCheck: () => void = () => {\n checkPluginState(true);\n};\n\nfunction pushFrame(frame: (timestamp: Timestamp) => void): void {\n (NativeReanimatedModule as JSReanimated).pushFrame(frame);\n}\n\nexport function requestFrame(frame: (timestamp: Timestamp) => void): void {\n 'worklet';\n if (NativeReanimatedModule.native) {\n requestAnimationFrame(frame);\n } else {\n pushFrame(frame);\n }\n}\n\nglobal._WORKLET = false;\nglobal._log = function (s: string) {\n console.log(s);\n};\n\nexport function runOnUI<A extends any[], R>(\n worklet: ComplexWorkletFunction<A, R>\n): (...args: A) => void {\n return makeShareable(worklet);\n}\n\nexport function makeShareable<T>(value: T): T {\n isConfiguredCheck();\n return NativeReanimatedModule.makeShareable(value);\n}\n\nexport function getViewProp<T>(viewTag: string, propName: string): Promise<T> {\n if (global._IS_FABRIC) {\n throw new Error(\n '[react-native-reanimated] `getViewProp` is not supported on Fabric yet'\n );\n }\n\n return new Promise((resolve, reject) => {\n return NativeReanimatedModule.getViewProp(\n viewTag,\n propName,\n (result: T) => {\n if (typeof result === 'string' && result.substr(0, 6) === 'error:') {\n reject(result);\n } else {\n resolve(result);\n }\n }\n );\n });\n}\n\nlet _getTimestamp: () => number;\nif (nativeShouldBeMock()) {\n _getTimestamp = () => {\n return (NativeReanimatedModule as JSReanimated).getTimestamp();\n };\n} else {\n _getTimestamp = () => {\n 'worklet';\n if (_frameTimestamp) {\n return _frameTimestamp;\n }\n if (_eventTimestamp) {\n return _eventTimestamp;\n }\n return _getCurrentTime();\n };\n}\n\nexport function getTimestamp(): number {\n 'worklet';\n if (Platform.OS === 'web') {\n return (NativeReanimatedModule as JSReanimated).getTimestamp();\n }\n return _getTimestamp();\n}\n\nfunction workletValueSetter<T extends WorkletValue>(\n this: WorkletValueSetterContext,\n value: T\n): void {\n 'worklet';\n const previousAnimation = this._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n this._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame !== undefined)\n ) {\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n // this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)\n // built in animations that are not higher order(withTiming, withSpring) hold target value in .current\n if (this._value === animation.current && !animation.isHigherOrder) {\n animation.callback && animation.callback(true);\n return;\n }\n // animated set\n const initializeAnimation = (timestamp: number) => {\n animation.onStart(animation, this.value, timestamp, previousAnimation);\n };\n const currentTimestamp = getTimestamp();\n initializeAnimation(currentTimestamp);\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.finished = true;\n animation.timestamp = timestamp;\n this._value = animation.current;\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestAnimationFrame(step);\n }\n };\n\n this._animation = animation;\n step(currentTimestamp);\n } else {\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n if (this._value === value) {\n return;\n }\n this._value = value as Descriptor | AnimatableValue;\n }\n}\n\n// We cannot use pushFrame\n// so we use own implementation for js\nfunction workletValueSetterJS<T extends WorkletValue>(\n this: WorkletValueSetterContext,\n value: T\n): void {\n const previousAnimation = this._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n this._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame)\n ) {\n // animated set\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n let initializeAnimation: ((timestamp: number) => void) | null = (\n timestamp: number\n ) => {\n animation.onStart(animation, this.value, timestamp, previousAnimation);\n };\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n if (initializeAnimation) {\n initializeAnimation(timestamp);\n initializeAnimation = null; // prevent closure from keeping ref to previous animation\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.timestamp = timestamp;\n this._setValue && this._setValue(animation.current as AnimatableValue);\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestFrame(step);\n }\n };\n\n this._animation = animation;\n step(getTimestamp());\n } else {\n this._setValue && this._setValue(value as AnimatableValue | Descriptor);\n }\n}\n\nexport function makeMutable<T>(value: T): SharedValue<T> {\n isConfiguredCheck();\n return NativeReanimatedModule.makeMutable(value);\n}\n\nexport function makeRemote<T>(object = {}): T {\n isConfiguredCheck();\n return NativeReanimatedModule.makeRemote(object);\n}\n\nexport function startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void = () => {\n // noop\n },\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]> = []\n): number {\n isConfiguredCheck();\n return NativeReanimatedModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n}\n\nexport function stopMapper(mapperId: number): void {\n NativeReanimatedModule.stopMapper(mapperId);\n}\n\nexport interface RunOnJSFunction<A extends any[], R> {\n __callAsync?: (...args: A) => void;\n (...args: A): R;\n}\n\nexport function runOnJS<A extends any[], R>(\n fun: RunOnJSFunction<A, R>\n): () => void {\n 'worklet';\n if (!_WORKLET) {\n return fun;\n }\n if (!fun.__callAsync) {\n throw new Error(\n \"Attempting to call runOnJS with an object that is not a host function. Using runOnJS is only possible with methods that are defined on the main React-Native Javascript thread and that aren't marked as worklets\"\n );\n } else {\n return fun.__callAsync;\n }\n}\n\nNativeReanimatedModule.installCoreFunctions(\n NativeReanimatedModule.native\n ? (workletValueSetter as <T>(value: T) => void)\n : (workletValueSetterJS as <T>(value: T) => void)\n);\n\nif (!isWeb() && isConfigured()) {\n const capturableConsole = console;\n runOnUI(() => {\n 'worklet';\n const console = {\n debug: runOnJS(capturableConsole.debug),\n log: runOnJS(capturableConsole.log),\n warn: runOnJS(capturableConsole.warn),\n error: runOnJS(capturableConsole.error),\n info: runOnJS(capturableConsole.info),\n };\n _setGlobalConsole(console);\n })();\n}\n\ntype FeaturesConfig = {\n enableLayoutAnimations: boolean;\n setByUser: boolean;\n};\n\nlet featuresConfig: FeaturesConfig = {\n enableLayoutAnimations: false,\n setByUser: false,\n};\n\nexport function enableLayoutAnimations(\n flag: boolean,\n isCallByUser = true\n): void {\n if (isCallByUser) {\n featuresConfig = {\n enableLayoutAnimations: flag,\n setByUser: true,\n };\n NativeReanimatedModule.enableLayoutAnimations(flag);\n } else if (\n !featuresConfig.setByUser &&\n featuresConfig.enableLayoutAnimations !== flag\n ) {\n featuresConfig.enableLayoutAnimations = flag;\n NativeReanimatedModule.enableLayoutAnimations(flag);\n }\n}\n\nexport function configureLayoutAnimations(\n viewTag: number,\n type: string,\n config: LayoutAnimationFunction | Keyframe,\n viewSharedValue: SharedValue<null | Record<string, unknown>> | null\n): void {\n NativeReanimatedModule.configureLayoutAnimation(\n viewTag,\n type,\n config,\n viewSharedValue\n );\n}\n\nexport function configureProps(uiProps: string[], nativeProps: string[]): void {\n if (!nativeShouldBeMock()) {\n NativeReanimatedModule.configureProps(uiProps, nativeProps);\n }\n}\n\nexport function jestResetJsReanimatedModule() {\n (NativeReanimatedModule as JSReanimated).jestResetModule();\n}\n"],"mappings":"A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,CAACoF,sBAAvB,CAA8CE,IAA9C;EACD,CAND,MAMO,IACL,CAACH,cAAc,CAACE,SAAhB,IACAF,cAAc,CAACC,sBAAf,KAA0CE,IAFrC,EAGL;IACAH,cAAc,CAACC,sBAAf,GAAwCE,IAAxC;IACAtF,sBAAsB,CAACoF,sBAAvB,CAA8CE,IAA9C;EACD;AACF;AAED,OAAO,SAASE,yBAAT,CACLzD,OADK,EAEL0D,IAFK,EAGLC,MAHK,EAILC,eAJK,EAKC;EACN3F,sBAAsB,CAAC4F,wBAAvB,CACE7D,OADF,EAEE0D,IAFF,EAGEC,MAHF,EAIEC,eAJF;AAMD;AAED,OAAO,SAASE,cAAT,CAAwBC,OAAxB,EAA2CC,WAA3C,EAAwE;EAC7E,IAAI,CAAC7F,kBAAkB,EAAvB,EAA2B;IACzBF,sBAAsB,CAAC6F,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;AACF;AAED,OAAO,SAASC,2BAAT,GAAuC;EAC3ChG,sBAAD,CAAyCiG,eAAzC;AACD"}
|
|
1
|
+
{"version":3,"names":["NativeReanimatedModule","nativeShouldBeMock","shouldBeUseWeb","isWeb","makeShareableCloneRecursive","makeShareable","makeShareableUnwrapped","runOnUI","runOnJS","startMapper","startMapperUnwrapped","makeMutable","makeMutableUnwrapped","makeRemote","makeRemoteUnwrapped","stopMapper","getTimestamp","global","_setGlobalConsole","undefined","testWorklet","throwUninitializedReanimatedException","Error","checkPluginState","throwError","__workletHash","isConfigured","isConfiguredCheck","configurationCheckWrapper","__DEV__","fn","_WORKLET","_log","s","console","log","getViewProp","viewTag","propName","_IS_FABRIC","Promise","resolve","reject","result","substr","valueUnpacker","objectToUnpack","category","workletsCache","__workletsCache","handleCache","__handleCache","Map","WeakMap","workletFun","get","eval","asString","set","functionInstance","bind","_recur","__init","value","fun","__remoteFunction","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","listenerId","registerSensor","sensorType","interval","unregisterSensor","installCoreFunctions","capturableConsole","debug","warn","error","info","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimations","type","config","configureLayoutAnimation","configureProps","uiProps","nativeProps"],"sources":["core.ts"],"sourcesContent":["/* global _setGlobalConsole */\nimport NativeReanimatedModule from './NativeReanimated';\nimport { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';\nimport { BasicWorkletFunction, Value3D, ValueRotation } from './commonTypes';\nimport {\n makeShareableCloneRecursive,\n makeShareable as makeShareableUnwrapped,\n} from './shareables';\nimport { runOnUI, runOnJS } from './threads';\nimport { startMapper as startMapperUnwrapped } from './mappers';\nimport {\n makeMutable as makeMutableUnwrapped,\n makeRemote as makeRemoteUnwrapped,\n} from './mutables';\nimport { LayoutAnimationFunction } from './layoutReanimation';\n\nexport { stopMapper } from './mappers';\nexport { runOnJS, runOnUI } from './threads';\nexport { getTimestamp } from './time';\n\nif (global._setGlobalConsole === undefined) {\n // it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1\n global._setGlobalConsole = () => {\n // noop\n };\n}\n\nexport type ReanimatedConsole = Pick<\n Console,\n 'debug' | 'log' | 'warn' | 'info' | 'error'\n>;\n\nconst testWorklet: BasicWorkletFunction<void> = () => {\n 'worklet';\n};\n\nconst throwUninitializedReanimatedException = () => {\n throw new Error(\n \"Failed to initialize react-native-reanimated library, make sure you followed installation steps here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ \\n1) Make sure reanimated's babel plugin is installed in your babel.config.js (you should have 'react-native-reanimated/plugin' listed there - also see the above link for details) \\n2) Make sure you reset build cache after updating the config, run: yarn start --reset-cache\"\n );\n};\n\nexport const checkPluginState: (throwError: boolean) => boolean = (\n throwError = true\n) => {\n if (!testWorklet.__workletHash && !shouldBeUseWeb()) {\n if (throwError) {\n throwUninitializedReanimatedException();\n }\n return false;\n }\n return true;\n};\n\nexport const isConfigured: (throwError?: boolean) => boolean = (\n throwError = false\n) => {\n return checkPluginState(throwError);\n};\n\nexport const isConfiguredCheck: () => void = () => {\n checkPluginState(true);\n};\n\nconst configurationCheckWrapper = __DEV__\n ? <T extends Array<any>, U>(fn: (...args: T) => U) => {\n return (...args: T): U => {\n isConfigured(true);\n return fn(...args);\n };\n }\n : <T extends Array<any>, U>(fn: (...args: T) => U) => fn;\n\nexport const startMapper = __DEV__\n ? configurationCheckWrapper(startMapperUnwrapped)\n : startMapperUnwrapped;\n\nexport const makeShareable = __DEV__\n ? configurationCheckWrapper(makeShareableUnwrapped)\n : makeShareableUnwrapped;\n\nexport const makeMutable = __DEV__\n ? configurationCheckWrapper(makeMutableUnwrapped)\n : makeMutableUnwrapped;\n\nexport const makeRemote = __DEV__\n ? configurationCheckWrapper(makeRemoteUnwrapped)\n : makeRemoteUnwrapped;\n\nglobal._WORKLET = false;\nglobal._log = function (s: string) {\n console.log(s);\n};\n\nexport function getViewProp<T>(viewTag: string, propName: string): Promise<T> {\n if (global._IS_FABRIC) {\n throw new Error(\n '[react-native-reanimated] `getViewProp` is not supported on Fabric yet'\n );\n }\n\n return new Promise((resolve, reject) => {\n return NativeReanimatedModule.getViewProp(\n viewTag,\n propName,\n (result: T) => {\n if (typeof result === 'string' && result.substr(0, 6) === 'error:') {\n reject(result);\n } else {\n resolve(result);\n }\n }\n );\n });\n}\n\nfunction valueUnpacker(objectToUnpack: any, category?: string): any {\n 'worklet';\n let workletsCache = global.__workletsCache;\n let handleCache = global.__handleCache;\n if (workletsCache === undefined) {\n // init\n workletsCache = global.__workletsCache = new Map();\n handleCache = global.__handleCache = new WeakMap();\n }\n if (objectToUnpack.__workletHash) {\n let workletFun = workletsCache.get(objectToUnpack.__workletHash);\n if (workletFun === undefined) {\n // eslint-disable-next-line no-eval\n workletFun = eval('(' + objectToUnpack.asString + '\\n)') as (\n ...args: any[]\n ) => any;\n workletsCache.set(objectToUnpack.__workletHash, workletFun);\n }\n const functionInstance = workletFun.bind(objectToUnpack);\n objectToUnpack._recur = functionInstance;\n return functionInstance;\n } else if (objectToUnpack.__init) {\n let value = handleCache!.get(objectToUnpack);\n if (value === undefined) {\n value = objectToUnpack.__init();\n handleCache!.set(objectToUnpack, value);\n }\n return value;\n } else if (category === 'RemoteFunction') {\n const fun = () => {\n throw new Error(`Tried to synchronously call a non-worklet function on the UI thread.\n\nPossible solutions are:\n a) If you want to synchronously execute this method, mark it as a worklet\n b) If you want to execute this function on the JS thread, wrap it using \\`runOnJS\\``);\n };\n fun.__remoteFunction = objectToUnpack;\n return fun;\n } else {\n throw new Error('data type not recognized by unpack method');\n }\n}\n\nexport function registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n): string {\n return NativeReanimatedModule.registerEventHandler(\n eventHash,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unregisterEventHandler(id: string): void {\n return NativeReanimatedModule.unregisterEventHandler(id);\n}\n\nexport function subscribeForKeyboardEvents(\n eventHandler: (state: number, height: number) => void\n): number {\n return NativeReanimatedModule.subscribeForKeyboardEvents(\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unsubscribeFromKeyboardEvents(listenerId: number): void {\n return NativeReanimatedModule.unsubscribeFromKeyboardEvents(listenerId);\n}\n\nexport function registerSensor(\n sensorType: number,\n interval: number,\n eventHandler: (data: Value3D | ValueRotation) => void\n): number {\n return NativeReanimatedModule.registerSensor(\n sensorType,\n interval,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unregisterSensor(listenerId: number): void {\n return NativeReanimatedModule.unregisterSensor(listenerId);\n}\n\nNativeReanimatedModule.installCoreFunctions(valueUnpacker);\n\nif (!isWeb() && isConfigured()) {\n const capturableConsole = console;\n runOnUI(() => {\n 'worklet';\n const console = {\n debug: runOnJS(capturableConsole.debug),\n log: runOnJS(capturableConsole.log),\n warn: runOnJS(capturableConsole.warn),\n error: runOnJS(capturableConsole.error),\n info: runOnJS(capturableConsole.info),\n };\n _setGlobalConsole(console);\n })();\n}\n\ntype FeaturesConfig = {\n enableLayoutAnimations: boolean;\n setByUser: boolean;\n};\n\nlet featuresConfig: FeaturesConfig = {\n enableLayoutAnimations: false,\n setByUser: false,\n};\n\nexport function enableLayoutAnimations(\n flag: boolean,\n isCallByUser = true\n): void {\n if (isCallByUser) {\n featuresConfig = {\n enableLayoutAnimations: flag,\n setByUser: true,\n };\n NativeReanimatedModule.enableLayoutAnimations(flag);\n } else if (\n !featuresConfig.setByUser &&\n featuresConfig.enableLayoutAnimations !== flag\n ) {\n featuresConfig.enableLayoutAnimations = flag;\n NativeReanimatedModule.enableLayoutAnimations(flag);\n }\n}\n\nexport function configureLayoutAnimations(\n viewTag: number,\n type: string,\n config: LayoutAnimationFunction | Keyframe\n): void {\n NativeReanimatedModule.configureLayoutAnimation(\n viewTag,\n type,\n makeShareableCloneRecursive(config)\n );\n}\n\nexport function configureProps(uiProps: string[], nativeProps: string[]): void {\n if (!nativeShouldBeMock()) {\n NativeReanimatedModule.configureProps(uiProps, nativeProps);\n }\n}\n"],"mappings":"AAAA;AACA,OAAOA,sBAAP,MAAmC,oBAAnC;AACA,SAASC,kBAAT,EAA6BC,cAA7B,EAA6CC,KAA7C,QAA0D,mBAA1D;AAEA,SACEC,2BADF,EAEEC,aAAa,IAAIC,sBAFnB,QAGO,cAHP;AAIA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,WAAjC;AACA,SAASC,WAAW,IAAIC,oBAAxB,QAAoD,WAApD;AACA,SACEC,WAAW,IAAIC,oBADjB,EAEEC,UAAU,IAAIC,mBAFhB,QAGO,YAHP;AAMA,SAASC,UAAT,QAA2B,WAA3B;AACA,SAASP,OAAT,EAAkBD,OAAlB,QAAiC,WAAjC;AACA,SAASS,YAAT,QAA6B,QAA7B;;AAEA,IAAIC,MAAM,CAACC,iBAAP,KAA6BC,SAAjC,EAA4C;EAC1C;EACAF,MAAM,CAACC,iBAAP,GAA2B,MAAM,CAC/B;EACD,CAFD;AAGD;;AAOD,MAAME,WAAuC,GAAG,MAAM;EACpD;AAC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