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.
Files changed (177) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +32 -37
  2. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +4 -3
  3. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
  4. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
  5. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +161 -165
  6. package/Common/cpp/NativeModules/NativeReanimatedModule.h +36 -34
  7. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +22 -34
  8. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +13 -14
  9. package/Common/cpp/SharedItems/RuntimeManager.h +1 -34
  10. package/Common/cpp/SharedItems/Shareables.cpp +142 -0
  11. package/Common/cpp/SharedItems/Shareables.h +455 -0
  12. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -0
  13. package/Common/cpp/Tools/RuntimeDecorator.cpp +54 -26
  14. package/Common/cpp/Tools/RuntimeDecorator.h +11 -2
  15. package/Common/cpp/Tools/Scheduler.cpp +10 -0
  16. package/Common/cpp/Tools/SingleInstanceChecker.h +1 -1
  17. package/android/src/main/cpp/LayoutAnimations.cpp +6 -16
  18. package/android/src/main/cpp/LayoutAnimations.h +4 -4
  19. package/android/src/main/cpp/NativeProxy.cpp +50 -63
  20. package/ios/native/NativeProxy.mm +26 -42
  21. package/lib/commonjs/createAnimatedComponent.js +7 -11
  22. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  23. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
  24. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  25. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +27 -55
  26. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
  27. package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -3
  28. package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
  29. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  30. package/lib/commonjs/reanimated2/commonTypes.js +7 -0
  31. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  32. package/lib/commonjs/reanimated2/core.js +111 -209
  33. package/lib/commonjs/reanimated2/core.js.map +1 -1
  34. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  35. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +15 -9
  36. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  37. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +18 -8
  38. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  39. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +27 -36
  40. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  41. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +24 -50
  42. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  43. package/lib/commonjs/reanimated2/hook/useSharedValue.js +3 -2
  44. package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
  45. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  46. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  47. package/lib/commonjs/reanimated2/jestUtils.js +8 -33
  48. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  49. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +16 -100
  50. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  51. package/lib/commonjs/reanimated2/js-reanimated/index.js +5 -0
  52. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  53. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  54. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  55. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +91 -0
  56. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
  57. package/lib/commonjs/reanimated2/layoutReanimation/index.js +1 -1
  58. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  59. package/lib/commonjs/reanimated2/mappers.js +186 -0
  60. package/lib/commonjs/reanimated2/mappers.js.map +1 -0
  61. package/lib/commonjs/reanimated2/mutables.js +173 -0
  62. package/lib/commonjs/reanimated2/mutables.js.map +1 -0
  63. package/lib/commonjs/reanimated2/shareables.js +153 -0
  64. package/lib/commonjs/reanimated2/shareables.js.map +1 -0
  65. package/lib/commonjs/reanimated2/threads.js +58 -0
  66. package/lib/commonjs/reanimated2/threads.js.map +1 -0
  67. package/lib/commonjs/reanimated2/time.js +55 -0
  68. package/lib/commonjs/reanimated2/time.js.map +1 -0
  69. package/lib/commonjs/reanimated2/valueSetter.js +81 -0
  70. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
  71. package/lib/module/createAnimatedComponent.js +7 -12
  72. package/lib/module/createAnimatedComponent.js.map +1 -1
  73. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
  74. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  75. package/lib/module/reanimated2/ViewDescriptorsSet.js +27 -53
  76. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  77. package/lib/module/reanimated2/WorkletEventHandler.js +4 -3
  78. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  79. package/lib/module/reanimated2/animation/util.js.map +1 -1
  80. package/lib/module/reanimated2/commonTypes.js +7 -0
  81. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  82. package/lib/module/reanimated2/core.js +66 -188
  83. package/lib/module/reanimated2/core.js.map +1 -1
  84. package/lib/module/reanimated2/globals.d.js.map +1 -1
  85. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +16 -6
  86. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  87. package/lib/module/reanimated2/hook/useAnimatedRef.js +17 -8
  88. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  89. package/lib/module/reanimated2/hook/useAnimatedSensor.js +29 -34
  90. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  91. package/lib/module/reanimated2/hook/useAnimatedStyle.js +26 -52
  92. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  93. package/lib/module/reanimated2/hook/useSharedValue.js +3 -2
  94. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  95. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  96. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  97. package/lib/module/reanimated2/jestUtils.js +8 -31
  98. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  99. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +16 -95
  100. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  101. package/lib/module/reanimated2/js-reanimated/index.js +5 -0
  102. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  103. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  104. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  105. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +84 -0
  106. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
  107. package/lib/module/reanimated2/layoutReanimation/index.js +1 -1
  108. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  109. package/lib/module/reanimated2/mappers.js +173 -0
  110. package/lib/module/reanimated2/mappers.js.map +1 -0
  111. package/lib/module/reanimated2/mutables.js +149 -0
  112. package/lib/module/reanimated2/mutables.js.map +1 -0
  113. package/lib/module/reanimated2/shareables.js +133 -0
  114. package/lib/module/reanimated2/shareables.js.map +1 -0
  115. package/lib/module/reanimated2/threads.js +45 -0
  116. package/lib/module/reanimated2/threads.js.map +1 -0
  117. package/lib/module/reanimated2/time.js +37 -0
  118. package/lib/module/reanimated2/time.js.map +1 -0
  119. package/lib/module/reanimated2/valueSetter.js +66 -0
  120. package/lib/module/reanimated2/valueSetter.js.map +1 -0
  121. package/package.json +1 -1
  122. package/plugin.js +31 -15
  123. package/src/createAnimatedComponent.tsx +8 -24
  124. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +34 -53
  125. package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
  126. package/src/reanimated2/WorkletEventHandler.ts +4 -11
  127. package/src/reanimated2/animation/util.ts +1 -0
  128. package/src/reanimated2/commonTypes.ts +29 -4
  129. package/src/reanimated2/core.ts +103 -230
  130. package/src/reanimated2/globals.d.ts +26 -26
  131. package/src/reanimated2/hook/useAnimatedKeyboard.ts +18 -9
  132. package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
  133. package/src/reanimated2/hook/useAnimatedSensor.ts +33 -31
  134. package/src/reanimated2/hook/useAnimatedStyle.ts +26 -64
  135. package/src/reanimated2/hook/useSharedValue.ts +6 -3
  136. package/src/reanimated2/hook/utils.ts +1 -1
  137. package/src/reanimated2/interpolateColor.ts +2 -2
  138. package/src/reanimated2/jestUtils.ts +14 -29
  139. package/src/reanimated2/js-reanimated/JSReanimated.ts +19 -93
  140. package/src/reanimated2/js-reanimated/index.ts +4 -0
  141. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +7 -0
  142. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
  143. package/src/reanimated2/layoutReanimation/animationsManager.ts +94 -0
  144. package/src/reanimated2/layoutReanimation/index.ts +1 -1
  145. package/src/reanimated2/mappers.ts +179 -0
  146. package/src/reanimated2/mutables.ts +151 -0
  147. package/src/reanimated2/shareables.ts +121 -0
  148. package/src/reanimated2/threads.ts +46 -0
  149. package/src/reanimated2/time.ts +30 -0
  150. package/src/reanimated2/valueSetter.ts +64 -0
  151. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -127
  152. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +0 -56
  153. package/Common/cpp/Registries/MapperRegistry.cpp +0 -147
  154. package/Common/cpp/Registries/MapperRegistry.h +0 -29
  155. package/Common/cpp/Registries/WorkletsCache.cpp +0 -45
  156. package/Common/cpp/Registries/WorkletsCache.h +0 -24
  157. package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
  158. package/Common/cpp/SharedItems/FrozenObject.h +0 -36
  159. package/Common/cpp/SharedItems/HostFunctionHandler.h +0 -28
  160. package/Common/cpp/SharedItems/MutableValue.cpp +0 -134
  161. package/Common/cpp/SharedItems/MutableValue.h +0 -54
  162. package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
  163. package/Common/cpp/SharedItems/MutableValueSetterProxy.h +0 -25
  164. package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
  165. package/Common/cpp/SharedItems/RemoteObject.h +0 -35
  166. package/Common/cpp/SharedItems/ShareableValue.cpp +0 -529
  167. package/Common/cpp/SharedItems/ShareableValue.h +0 -63
  168. package/Common/cpp/SharedItems/ValueWrapper.h +0 -183
  169. package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
  170. package/Common/cpp/Tools/JSIStoreValueUser.h +0 -37
  171. package/Common/cpp/Tools/Mapper.cpp +0 -86
  172. package/Common/cpp/Tools/Mapper.h +0 -51
  173. package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -58
  174. package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
  175. package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -52
  176. package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
  177. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -49
@@ -55,41 +55,40 @@ class NativeReanimated {
55
55
  }
56
56
  }
57
57
 
58
- installCoreFunctions(valueSetter) {
59
- return this.InnerNativeModule.installCoreFunctions(valueSetter);
58
+ getTimestamp() {
59
+ throw new Error('stub implementation, used on the web only');
60
60
  }
61
61
 
62
- makeShareable(value) {
63
- return this.InnerNativeModule.makeShareable(value);
62
+ installCoreFunctions(valueUnpacker) {
63
+ return this.InnerNativeModule.installCoreFunctions(valueUnpacker);
64
64
  }
65
65
 
66
- makeMutable(value) {
67
- return this.InnerNativeModule.makeMutable(value);
66
+ makeShareableClone(value) {
67
+ return this.InnerNativeModule.makeShareableClone(value);
68
68
  }
69
69
 
70
- makeRemote() {
71
- let object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
72
- return this.InnerNativeModule.makeRemote(object);
70
+ makeSynchronizedDataHolder(valueRef) {
71
+ return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);
73
72
  }
74
73
 
75
- registerSensor(sensorType, interval, sensorData) {
76
- return this.InnerNativeModule.registerSensor(sensorType, interval, sensorData);
74
+ getDataSynchronously(ref) {
75
+ return this.InnerNativeModule.getDataSynchronously(ref);
77
76
  }
78
77
 
79
- unregisterSensor(sensorId) {
80
- return this.InnerNativeModule.unregisterSensor(sensorId);
78
+ updateDataSynchronously(ref, value) {
79
+ this.InnerNativeModule.updateDataSynchronously(ref, value);
80
+ }
81
+
82
+ scheduleOnUI(shareable) {
83
+ return this.InnerNativeModule.scheduleOnUI(shareable);
81
84
  }
82
85
 
83
- startMapper(mapper) {
84
- let inputs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
85
- let outputs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
86
- let updater = arguments.length > 3 ? arguments[3] : undefined;
87
- let viewDescriptors = arguments.length > 4 ? arguments[4] : undefined;
88
- return this.InnerNativeModule.startMapper(mapper, inputs, outputs, updater, viewDescriptors);
86
+ registerSensor(sensorType, interval, handler) {
87
+ return this.InnerNativeModule.registerSensor(sensorType, interval, handler);
89
88
  }
90
89
 
91
- stopMapper(mapperId) {
92
- return this.InnerNativeModule.stopMapper(mapperId);
90
+ unregisterSensor(sensorId) {
91
+ return this.InnerNativeModule.unregisterSensor(sensorId);
93
92
  }
94
93
 
95
94
  registerEventHandler(eventHash, eventHandler) {
@@ -104,8 +103,8 @@ class NativeReanimated {
104
103
  return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
105
104
  }
106
105
 
107
- configureLayoutAnimation(viewTag, type, config, viewSharedValue) {
108
- this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config, viewSharedValue);
106
+ configureLayoutAnimation(viewTag, type, config) {
107
+ this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config);
109
108
  }
110
109
 
111
110
  enableLayoutAnimations(flag) {
@@ -116,8 +115,8 @@ class NativeReanimated {
116
115
  this.InnerNativeModule.configureProps(uiProps, nativeProps);
117
116
  }
118
117
 
119
- subscribeForKeyboardEvents(keyboardEventData) {
120
- return this.InnerNativeModule.subscribeForKeyboardEvents(keyboardEventData);
118
+ subscribeForKeyboardEvents(handler) {
119
+ return this.InnerNativeModule.subscribeForKeyboardEvents(handler);
121
120
  }
122
121
 
123
122
  unsubscribeFromKeyboardEvents(listenerId) {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","NativeModules","installTurboModule","InnerNativeModule","checkVersion","cppVersion","_REANIMATED_VERSION_CPP","ok","jsVersion","match","jsMajor","jsMinor","split","cppMajor","cppMinor","console","error","installCoreFunctions","valueSetter","makeShareable","value","makeMutable","makeRemote","object","registerSensor","sensorType","interval","sensorData","unregisterSensor","sensorId","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","viewSharedValue","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","keyboardEventData","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n SharedValue,\n SensorValue3D,\n SensorValueRotation,\n AnimatedKeyboardInfo,\n} from '../commonTypes';\nimport { Descriptor } from '../hook/commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\nimport { version as jsVersion } from '../../../package.json';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n this.checkVersion();\n }\n }\n\n checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`\n );\n // TODO: detect Expo managed workflow\n }\n }\n\n installCoreFunctions(valueSetter: <T>(value: T) => void): void {\n return this.InnerNativeModule.installCoreFunctions(valueSetter);\n }\n\n makeShareable<T>(value: T): T {\n return this.InnerNativeModule.makeShareable(value);\n }\n\n makeMutable<T>(value: T): SharedValue<T> {\n return this.InnerNativeModule.makeMutable(value);\n }\n\n makeRemote<T>(object = {}): T {\n return this.InnerNativeModule.makeRemote(object);\n }\n\n registerSensor(\n sensorType: number,\n interval: number,\n sensorData: SensorValue3D | SensorValueRotation\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n sensorData\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void,\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>\n ): number {\n return this.InnerNativeModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n }\n\n stopMapper(mapperId: number): void {\n return this.InnerNativeModule.stopMapper(mapperId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: Keyframe | LayoutAnimationFunction,\n viewSharedValue: SharedValue<null | Record<string, unknown>> | null\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n config,\n viewSharedValue\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(keyboardEventData: AnimatedKeyboardInfo): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(keyboardEventData);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AASA;;;;AAEO,MAAMA,gBAAN,CAAuB;EAI5BC,WAAW,GAAgB;IAAA,IAAfC,MAAe,uEAAN,IAAM;;IAAA;;IAAA;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AwB,CACtBH,OADsB,EAEtBI,IAFsB,EAGtBC,MAHsB,EAItBC,eAJsB,EAKtB;IACA,KAAK/C,iBAAL,CAAuB4C,wBAAvB,CACEH,OADF,EAEEI,IAFF,EAGEC,MAHF,EAIEC,eAJF;EAMD;;EAEDC,sBAAsB,CAACC,IAAD,EAAsB;IAC1C,KAAKjD,iBAAL,CAAuBgD,sBAAvB,CAA8CC,IAA9C;EACD;;EAEDC,cAAc,CAACC,OAAD,EAAoBC,WAApB,EAAiD;IAC7D,KAAKpD,iBAAL,CAAuBkD,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;;EAEDC,0BAA0B,CAACC,iBAAD,EAAkD;IAC1E,OAAO,KAAKtD,iBAAL,CAAuBqD,0BAAvB,CAAkDC,iBAAlD,CAAP;EACD;;EAEDC,6BAA6B,CAACC,UAAD,EAA2B;IACtD,KAAKxD,iBAAL,CAAuBuD,6BAAvB,CAAqDC,UAArD;EACD;;AA3I2B"}
1
+ {"version":3,"names":["NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","NativeModules","installTurboModule","InnerNativeModule","checkVersion","cppVersion","_REANIMATED_VERSION_CPP","ok","jsVersion","match","jsMajor","jsMinor","split","cppMajor","cppMinor","console","error","getTimestamp","Error","installCoreFunctions","valueUnpacker","makeShareableClone","value","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { ShareableRef, ShareableSyncDataHolderRef } from '../commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\nimport { version as jsVersion } from '../../../package.json';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n this.checkVersion();\n }\n }\n\n checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`\n );\n // TODO: detect Expo managed workflow\n }\n }\n\n getTimestamp(): number {\n throw new Error('stub implementation, used on the web only');\n }\n\n installCoreFunctions(valueUnpacker: <T>(value: T) => T): void {\n return this.InnerNativeModule.installCoreFunctions(valueUnpacker);\n }\n\n makeShareableClone<T>(value: T): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(value);\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n handler: ShareableRef<T>\n ) {\n return this.InnerNativeModule.registerSensor(sensorType, interval, handler);\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config);\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(handler: ShareableRef<number>): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(handler);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAGA;;;;AAEO,MAAMA,gBAAN,CAAuB;EAI5BC,WAAW,GAAgB;IAAA,IAAfC,MAAe,uEAAN,IAAM;;IAAA;;IAAA;;IACzB,IAAIC,MAAM,CAACC,uBAAP,KAAmCC,SAAnC,IAAgDH,MAApD,EAA4D;MAC1D,MAAM;QAAEI;MAAF,IAAuBC,0BAA7B;MACAD,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAEE,kBAAl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EACD;;EAEDC,cAAc,CAACC,OAAD,EAAoBC,WAApB,EAAiD;IAC7D,KAAKjD,iBAAL,CAAuB+C,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;;EAEDC,0BAA0B,CAACpB,OAAD,EAAwC;IAChE,OAAO,KAAK9B,iBAAL,CAAuBkD,0BAAvB,CAAkDpB,OAAlD,CAAP;EACD;;EAEDqB,6BAA6B,CAACC,UAAD,EAA2B;IACtD,KAAKpD,iBAAL,CAAuBmD,6BAAvB,CAAqDC,UAArD;EACD;;AA9H2B"}
@@ -10,68 +10,40 @@ var _react = require("react");
10
10
 
11
11
  var _core = require("./core");
12
12
 
13
- var _PlatformChecker = require("./PlatformChecker");
14
-
15
- const scheduleUpdates = (0, _PlatformChecker.shouldBeUseWeb)() ? requestAnimationFrame : setImmediate;
16
-
17
13
  function makeViewDescriptorsSet() {
18
- const ref = (0, _react.useRef)(null);
19
-
20
- if (ref.current === null) {
21
- const data = {
22
- batchToRemove: new Set(),
23
- tags: new Set(),
24
- waitForInsertSync: false,
25
- waitForRemoveSync: false,
26
- sharableViewDescriptors: (0, _core.makeMutable)([]),
27
- items: [],
28
- add: item => {
29
- if (data.tags.has(item.tag)) {
30
- return;
14
+ const sharableViewDescriptors = (0, _core.makeMutable)([]);
15
+ const data = {
16
+ sharableViewDescriptors,
17
+ add: item => {
18
+ sharableViewDescriptors.modify(descriptors => {
19
+ 'worklet';
20
+
21
+ const index = descriptors.findIndex(descriptor => descriptor.tag === item.tag);
22
+
23
+ if (index !== -1) {
24
+ descriptors[index] = item;
25
+ } else {
26
+ descriptors.push(item);
31
27
  }
32
28
 
33
- data.tags.add(item.tag);
34
- data.items.push(item);
29
+ return descriptors;
30
+ });
31
+ },
32
+ remove: viewTag => {
33
+ sharableViewDescriptors.modify(descriptors => {
34
+ 'worklet';
35
35
 
36
- if (!data.waitForInsertSync) {
37
- data.waitForInsertSync = true;
38
- scheduleUpdates(() => {
39
- data.sharableViewDescriptors.value = data.items;
40
- data.waitForInsertSync = false;
41
- });
42
- }
43
- },
44
- remove: viewTag => {
45
- data.batchToRemove.add(viewTag);
36
+ const index = descriptors.findIndex(descriptor => descriptor.tag === viewTag);
46
37
 
47
- if (!data.waitForRemoveSync) {
48
- data.waitForRemoveSync = true;
49
- scheduleUpdates(() => {
50
- const items = [];
51
-
52
- for (const item of data.items) {
53
- if (data.batchToRemove.has(item.tag)) {
54
- data.tags.delete(item.tag);
55
- } else {
56
- items.push(item);
57
- }
58
- }
59
-
60
- data.items = items;
61
- data.sharableViewDescriptors.value = items;
62
- data.batchToRemove = new Set();
63
- data.waitForRemoveSync = false;
64
- });
38
+ if (index !== -1) {
39
+ descriptors.splice(index, 1);
65
40
  }
66
- },
67
- rebuildsharableViewDescriptors: sharableViewDescriptors => {
68
- data.sharableViewDescriptors = sharableViewDescriptors;
69
- }
70
- };
71
- ref.current = data;
72
- }
73
41
 
74
- return ref.current;
42
+ return descriptors;
43
+ });
44
+ }
45
+ };
46
+ return data;
75
47
  }
76
48
 
77
49
  function makeViewsRefSet() {
@@ -1 +1 @@
1
- {"version":3,"names":["scheduleUpdates","shouldBeUseWeb","requestAnimationFrame","setImmediate","makeViewDescriptorsSet","ref","useRef","current","data","batchToRemove","Set","tags","waitForInsertSync","waitForRemoveSync","sharableViewDescriptors","makeMutable","items","add","item","has","tag","push","value","remove","viewTag","delete","rebuildsharableViewDescriptors","makeViewsRefSet"],"sources":["ViewDescriptorsSet.ts"],"sourcesContent":["import { useRef } from 'react';\nimport { makeMutable } from './core';\nimport { SharedValue } from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\nimport { shouldBeUseWeb } from './PlatformChecker';\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 batchToRemove: Set<number>;\n tags: Set<number>;\n waitForInsertSync: boolean;\n waitForRemoveSync: boolean;\n sharableViewDescriptors: SharedValue<Descriptor[]>;\n items: Descriptor[];\n add: (item: Descriptor) => void;\n remove: (viewTag: number) => void;\n rebuildsharableViewDescriptors: (\n sharableViewDescriptor: SharedValue<Descriptor[]>\n ) => void;\n}\n\nconst scheduleUpdates = shouldBeUseWeb() ? requestAnimationFrame : setImmediate;\n\nexport function makeViewDescriptorsSet(): ViewDescriptorsSet {\n const ref = useRef<ViewDescriptorsSet | null>(null);\n if (ref.current === null) {\n const data: ViewDescriptorsSet = {\n batchToRemove: new Set(),\n tags: new Set(),\n waitForInsertSync: false,\n waitForRemoveSync: false,\n sharableViewDescriptors: makeMutable([]),\n items: [],\n\n add: (item: Descriptor) => {\n if (data.tags.has(item.tag)) {\n return;\n }\n data.tags.add(item.tag);\n data.items.push(item);\n\n if (!data.waitForInsertSync) {\n data.waitForInsertSync = true;\n\n scheduleUpdates(() => {\n data.sharableViewDescriptors.value = data.items;\n data.waitForInsertSync = false;\n });\n }\n },\n\n remove: (viewTag: number) => {\n data.batchToRemove.add(viewTag);\n\n if (!data.waitForRemoveSync) {\n data.waitForRemoveSync = true;\n\n scheduleUpdates(() => {\n const items = [];\n for (const item of data.items) {\n if (data.batchToRemove.has(item.tag)) {\n data.tags.delete(item.tag);\n } else {\n items.push(item);\n }\n }\n data.items = items;\n data.sharableViewDescriptors.value = items;\n data.batchToRemove = new Set();\n data.waitForRemoveSync = false;\n });\n }\n },\n\n rebuildsharableViewDescriptors: (\n sharableViewDescriptors: SharedValue<Descriptor[]>\n ) => {\n data.sharableViewDescriptors = sharableViewDescriptors;\n },\n };\n ref.current = data;\n }\n\n return ref.current;\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;;AACA;;AAG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ED,OAAOH,GAAG,CAACE,OAAX;AACD"}
1
+ {"version":3,"names":["makeViewDescriptorsSet","sharableViewDescriptors","makeMutable","data","add","item","modify","descriptors","index","findIndex","descriptor","tag","push","remove","viewTag","splice","makeViewsRefSet","ref","useRef","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;;AACA;;AAgBO,SAASA,sBAAT,GAAsD;EAC3D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B,KAAL,CAAWhB,GAAX,CAAeC,IAAf;MACD,CANyB;MAQ1BQ,MAAM,EAAGR,IAAD,IAAa;QACnBF,IAAI,CAACiB,KAAL,CAAWG,MAAX,CAAkBlB,IAAlB;MACD;IAVyB,CAA5B;IAYAY,GAAG,CAACE,OAAJ,GAAchB,IAAd;EACD;;EAED,OAAOc,GAAG,CAACE,OAAX;AACD"}
@@ -7,6 +7,8 @@ exports.default = void 0;
7
7
 
8
8
  var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
9
9
 
10
+ var _core = require("./core");
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  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; }
@@ -57,15 +59,15 @@ class WorkletEventHandler {
57
59
 
58
60
  registerForEvents(viewTag, fallbackEventName) {
59
61
  this.viewTag = viewTag;
60
- this.registrations = this.eventNames.map(eventName => _NativeReanimated.default.registerEventHandler(viewTag + eventName, this.worklet));
62
+ this.registrations = this.eventNames.map(eventName => (0, _core.registerEventHandler)(viewTag + eventName, this.worklet));
61
63
 
62
64
  if (this.registrations.length === 0 && fallbackEventName) {
63
- this.registrations.push(_NativeReanimated.default.registerEventHandler(viewTag + fallbackEventName, this.worklet));
65
+ this.registrations.push((0, _core.registerEventHandler)(viewTag + fallbackEventName, this.worklet));
64
66
  }
65
67
  }
66
68
 
67
69
  unregisterFromEvents() {
68
- this.registrations.forEach(id => _NativeReanimated.default.unregisterEventHandler(id));
70
+ this.registrations.forEach(id => (0, _core.unregisterEventHandler)(id));
69
71
  this.registrations = [];
70
72
  }
71
73
 
@@ -1 +1 @@
1
- {"version":3,"names":["jsListener","eventName","handler","evt","nativeEvent","WorkletEventHandler","constructor","worklet","eventNames","reattachNeeded","listeners","viewTag","undefined","registrations","NativeReanimatedModule","native","reduce","acc","updateWorklet","newWorklet","registerForEvents","fallbackEventName","map","registerEventHandler","length","push","unregisterFromEvents","forEach","id","unregisterEventHandler"],"sources":["WorkletEventHandler.ts"],"sourcesContent":["import { NativeEvent } from './commonTypes';\nimport NativeReanimatedModule from './NativeReanimated';\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 NativeReanimatedModule.registerEventHandler(\n viewTag + eventName,\n this.worklet\n )\n );\n if (this.registrations.length === 0 && fallbackEventName) {\n this.registrations.push(\n NativeReanimatedModule.registerEventHandler(\n viewTag + fallbackEventName,\n this.worklet\n )\n );\n }\n }\n\n unregisterFromEvents(): void {\n this.registrations.forEach((id) =>\n NativeReanimatedModule.unregisterEventHandler(id)\n );\n this.registrations = [];\n }\n}\n"],"mappings":";;;;;;;AACA;;;;;;AAEA,SAASA,UAAT,CACEC,SADF,EAEEC,OAFF,EAGE;EACA,OAAQC,GAAD,IAAY;IACjBD,OAAO,CAAC,EAAE,GAAGC,GAAG,CAACC,WAAT;MAAsBH;IAAtB,CAAD,CAAP;E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CAAmBc,OAAnB,CAA4BC,EAAD,IACzBd,yBAAA,CAAuBe,sBAAvB,CAA8CD,EAA9C,CADF;IAGA,KAAKf,aAAL,GAAqB,EAArB;EACD;;AAtDgE"}
1
+ {"version":3,"names":["jsListener","eventName","handler","evt","nativeEvent","WorkletEventHandler","constructor","worklet","eventNames","reattachNeeded","listeners","viewTag","undefined","registrations","NativeReanimatedModule","native","reduce","acc","updateWorklet","newWorklet","registerForEvents","fallbackEventName","map","registerEventHandler","length","push","unregisterFromEvents","forEach","id","unregisterEventHandler"],"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;;AACA;;;;;;AAEA,SAASA,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;;AAEc,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,CAACC,yBAAA,CAAuBC,MAA5B,EAAoC;MAClC,KAAKL,SAAL,GAAiBF,UAAU,CAACQ,MAAX,CACf,CAACC,GAAD,EAA0ChB,SAA1C,KAAgE;QAC9DgB,GAAG,CAAChB,SAAD,CAAH,GAAiBD,UAAU,CAACC,SAAD,EAAYM,OAAZ,CAA3B;QACA,OAAOU,GAAP;MACD,CAJc,EAKf,EALe,CAAjB;IAOD;EACF;;EAEDC,aAAa,CAACC,UAAD,EAAuC;IAClD,KAAKZ,OAAL,GAAeY,UAAf;IACA,KAAKV,cAAL,GAAsB,IAAtB;EACD;;EAEDW,iBAAiB,CAACT,OAAD,EAAkBU,iBAAlB,EAAoD;IACnE,KAAKV,OAAL,GAAeA,OAAf;IACA,KAAKE,aAAL,GAAqB,KAAKL,UAAL,CAAgBc,GAAhB,CAAqBrB,SAAD,IACvC,IAAAsB,0BAAA,EAAqBZ,OAAO,GAAGV,SAA/B,EAA0C,KAAKM,OAA/C,CADmB,CAArB;;IAGA,IAAI,KAAKM,aAAL,CAAmBW,MAAnB,KAA8B,CAA9B,IAAmCH,iBAAvC,EAA0D;MACxD,KAAKR,aAAL,CAAmBY,IAAnB,CACE,IAAAF,0BAAA,EAAqBZ,OAAO,GAAGU,iBAA/B,EAAkD,KAAKd,OAAvD,CADF;IAGD;EACF;;EAEDmB,oBAAoB,GAAS;IAC3B,KAAKb,aAAL,CAAmBc,OAAnB,CAA4BC,EAAD,IAAQ,IAAAC,4BAAA,EAAuBD,EAAvB,CAAnC;IACA,KAAKf,aAAL,GAAqB,EAArB;EACD;;AA9CgE"}
@@ -1 +1 @@
1
- {"version":3,"names":["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","isColor","convertToHSVA","forEach","i","index","undefined","push","toRGBA","colorOnFrame","finished","arrayOnStart","v","arrayOnFrame","Array","isArray","defineAnimation","starting","factory","create","_WORKLET","NativeReanimatedModule","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":";;;;;;;;;;AASA;;AAUA;;;;AAXA;AAaA,IAAIA,gBAAgB,GAAG,KAAvB;;AAIO,SAASC,iBAAT,CAA8BC,OAA9B,EAAmD;EACxDF,gBAAgB,GAAG,IAAnB;EACA,MAAMG,MAAM,GAAGD,OAAO,EAAtB;EACAF,gBAAgB,GAAG,KAAnB;EACA,OAAOG,MAAP;AACD;;AAOD,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,M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;;EAOA,IAAIiD,QAAQ,IAAI,CAACC,yBAAA,CAAuBC,MAAxC,EAAgD;IAC9C,OAAOH,MAAM,EAAb;EACD,CAdwD,CAezD;;;EACA,OAAOA,MAAP;AACD;;AAEM,SAASI,eAAT,CAA4BC,WAA5B,EAA+D;EACpE,UADoE,CAEpE;;EACAA,WAAW,CAAC9D,KAAZ,GAAoB8D,WAAW,CAAC9D,KAAhC,CAHoE,CAG7B;AACxC,C,CAED;;;AACO,SAAS+D,cAAT,CACLnC,UADK,EAELnB,SAFK,EAGuB;EAC5B;;EACA,OAAO6C,eAAe,CAAC1B,UAAD,EAAa,MAAM;IACvC;;IACA,IAAI,CAAC8B,QAAD,IAAa,OAAOjD,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":["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","isColor","convertToHSVA","forEach","i","index","undefined","push","toRGBA","colorOnFrame","finished","arrayOnStart","v","arrayOnFrame","Array","isArray","defineAnimation","starting","factory","create","_WORKLET","NativeReanimatedModule","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":";;;;;;;;;;AASA;;AAUA;;;;AAXA;AAaA,IAAIA,gBAAgB,GAAG,KAAvB;;AAIO,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,CA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AF/B,EAEoD;EACzD;;EACA,IAAI7D,gBAAJ,EAAsB;IACpB,OAAO4D,QAAP;EACD;;EACD,MAAME,MAAM,GAAG,MAAM;IACnB;;IACA,MAAMhD,SAAS,GAAG+C,OAAO,EAAzB;IACAhD,iBAAiB,CAAIC,SAAJ,CAAjB;IACA,OAAOA,SAAP;EACD,CALD;;EAOA,IAAIiD,QAAQ,IAAI,CAACC,yBAAA,CAAuBC,MAAxC,EAAgD;IAC9C,OAAOH,MAAM,EAAb;EACD,CAdwD,CAezD;;;EACA,OAAOA,MAAP;AACD;;AAEM,SAASI,eAAT,CAA4BC,WAA5B,EAA+D;EACpE,UADoE,CAEpE;;EACAA,WAAW,CAAC9D,KAAZ,GAAoB8D,WAAW,CAAC9D,KAAhC,CAHoE,CAG7B;AACxC,C,CAED;;;AACO,SAAS+D,cAAT,CACLnC,UADK,EAELnB,SAFK,EAGuB;EAC5B;;EACA,OAAO6C,eAAe,CAAC1B,UAAD,EAAa,MAAM;IACvC;;IACA,IAAI,CAAC8B,QAAD,IAAa,OAAOjD,SAAP,KAAqB,UAAtC,EAAkD;MAChDA,SAAS,GAAGA,SAAS,EAArB;IACD;;IACAA,SAAD,CAA0CkB,OAA1C,GAAoDC,UAApD;IACA,OAAOnB,SAAP;EACD,CAPqB,CAAtB;AAQD"}
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.KeyboardState = void 0;
7
+ // The below type is used for HostObjects retured by the JSI API that don't have
8
+ // any accessable fields or methods but can carry data that is accessed from the
9
+ // c++ side. We add a field to the type to make it possible for typescript to recognize
10
+ // which JSI methods accept those types as arguments and to be able to correctly type
11
+ // check other methods that may use them. However, this field is not actually defined
12
+ // nor should be used for anything else as assigning any data to those objects will
13
+ // throw an error.
7
14
  let KeyboardState;
8
15
  exports.KeyboardState = KeyboardState;
9
16
 
@@ -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 SensorValue3D = SharedValue<Value3D>;\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 SensorValueRotation = SharedValue<ValueRotation>;\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":";;;;;;IAuJYA,a;;;WAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a"}
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;IAuHYA,a;;;WAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a"}