react-native-reanimated 3.0.0-rc.9 → 3.0.1

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 (331) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +30 -12
  2. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +2 -0
  3. package/Common/cpp/Fabric/FabricUtils.cpp +3 -107
  4. package/Common/cpp/Fabric/FabricUtils.h +3 -24
  5. package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +54 -37
  6. package/Common/cpp/LayoutAnimations/LayoutAnimationType.h +8 -0
  7. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +81 -26
  8. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +20 -3
  9. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +105 -109
  10. package/Common/cpp/NativeModules/NativeReanimatedModule.h +19 -12
  11. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
  12. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -2
  13. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +20 -1
  14. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +9 -0
  15. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +5 -1
  16. package/Common/cpp/Registries/EventHandlerRegistry.cpp +8 -34
  17. package/Common/cpp/Registries/EventHandlerRegistry.h +7 -13
  18. package/Common/cpp/SharedItems/Shareables.cpp +9 -63
  19. package/Common/cpp/SharedItems/Shareables.h +77 -72
  20. package/Common/cpp/Tools/CollectionUtils.h +14 -0
  21. package/Common/cpp/Tools/JsiUtils.cpp +26 -0
  22. package/Common/cpp/Tools/JsiUtils.h +176 -0
  23. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +5 -5
  24. package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
  25. package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
  26. package/Common/cpp/Tools/RuntimeDecorator.cpp +49 -230
  27. package/Common/cpp/Tools/RuntimeDecorator.h +0 -2
  28. package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
  29. package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
  30. package/README.md +1 -1
  31. package/RNReanimated.podspec +2 -1
  32. package/android/CMakeLists.txt +188 -181
  33. package/android/build.gradle +362 -311
  34. package/android/proguard-rules.pro +2 -0
  35. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
  36. package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
  37. package/android/src/main/cpp/LayoutAnimations.h +23 -6
  38. package/android/src/main/cpp/NativeProxy.cpp +143 -98
  39. package/android/src/main/cpp/NativeProxy.h +22 -28
  40. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
  41. package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
  42. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
  43. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
  44. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
  45. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
  46. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
  47. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
  48. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
  49. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
  50. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
  51. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
  52. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
  53. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
  54. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
  55. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
  56. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
  57. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
  58. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
  59. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
  60. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
  61. package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
  62. package/ios/LayoutReanimation/REAAnimationsManager.h +28 -4
  63. package/ios/LayoutReanimation/REAAnimationsManager.m +216 -61
  64. package/ios/LayoutReanimation/REAFrame.h +10 -0
  65. package/ios/LayoutReanimation/REAFrame.m +15 -0
  66. package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
  67. package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
  68. package/ios/LayoutReanimation/REASharedElement.h +15 -0
  69. package/ios/LayoutReanimation/REASharedElement.m +16 -0
  70. package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
  71. package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
  72. package/ios/LayoutReanimation/REASnapshot.h +1 -0
  73. package/ios/LayoutReanimation/REASnapshot.m +96 -11
  74. package/ios/LayoutReanimation/REAUIManager.mm +64 -17
  75. package/ios/REAModule.mm +2 -7
  76. package/ios/REANodesManager.mm +1 -21
  77. package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
  78. package/ios/native/NativeProxy.mm +75 -114
  79. package/ios/native/REAInitializer.mm +2 -7
  80. package/ios/native/REAJSIUtils.h +60 -2
  81. package/ios/sensor/ReanimatedSensor.h +6 -2
  82. package/ios/sensor/ReanimatedSensor.m +43 -7
  83. package/ios/sensor/ReanimatedSensorContainer.h +4 -1
  84. package/ios/sensor/ReanimatedSensorContainer.m +8 -2
  85. package/lib/commonjs/createAnimatedComponent.js +244 -28
  86. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  87. package/lib/commonjs/reanimated2/Colors.js +43 -22
  88. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  89. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +16 -33
  90. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  91. package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
  92. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  93. package/lib/commonjs/reanimated2/animation/util.js +17 -15
  94. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  95. package/lib/commonjs/reanimated2/commonTypes.js +33 -1
  96. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  97. package/lib/commonjs/reanimated2/core.js +33 -14
  98. package/lib/commonjs/reanimated2/core.js.map +1 -1
  99. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  100. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  101. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  102. package/lib/commonjs/reanimated2/hook/index.js +0 -6
  103. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  104. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  105. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  106. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
  107. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  108. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
  109. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +91 -15
  111. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -40
  113. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  114. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
  115. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  116. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
  117. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  118. package/lib/commonjs/reanimated2/hook/utils.js +18 -65
  119. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  120. package/lib/commonjs/reanimated2/index.js +13 -0
  121. package/lib/commonjs/reanimated2/index.js.map +1 -1
  122. package/lib/commonjs/reanimated2/initializers.js +71 -32
  123. package/lib/commonjs/reanimated2/initializers.js.map +1 -1
  124. package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
  125. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  126. package/lib/commonjs/reanimated2/jestUtils.js +1 -1
  127. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  128. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +103 -13
  129. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  130. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
  131. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  132. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
  133. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  134. package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  135. package/lib/commonjs/reanimated2/js-reanimated/global.js +0 -2
  136. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  137. package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
  138. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  139. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
  140. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  141. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
  142. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  143. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +22 -9
  144. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  145. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
  146. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  147. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
  148. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  149. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
  150. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  151. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
  152. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  153. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
  154. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  155. package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
  156. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  157. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
  158. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  159. package/lib/commonjs/reanimated2/mappers.js +18 -6
  160. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  161. package/lib/commonjs/reanimated2/mock.js +20 -1
  162. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  163. package/lib/commonjs/reanimated2/mutables.js +4 -2
  164. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  165. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -0
  166. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
  167. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
  168. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  169. package/lib/commonjs/reanimated2/pluginUtils.js +11 -0
  170. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
  171. package/lib/commonjs/reanimated2/shareables.js +36 -15
  172. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  173. package/lib/commonjs/reanimated2/threads.js +114 -7
  174. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  175. package/lib/commonjs/reanimated2/utils.js +7 -0
  176. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  177. package/lib/commonjs/reanimated2/valueSetter.js +1 -3
  178. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  179. package/lib/module/createAnimatedComponent.js +241 -29
  180. package/lib/module/createAnimatedComponent.js.map +1 -1
  181. package/lib/module/reanimated2/Colors.js +35 -19
  182. package/lib/module/reanimated2/Colors.js.map +1 -1
  183. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -32
  184. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  185. package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
  186. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  187. package/lib/module/reanimated2/animation/util.js +17 -16
  188. package/lib/module/reanimated2/animation/util.js.map +1 -1
  189. package/lib/module/reanimated2/commonTypes.js +29 -0
  190. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  191. package/lib/module/reanimated2/core.js +32 -7
  192. package/lib/module/reanimated2/core.js.map +1 -1
  193. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  194. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  195. package/lib/module/reanimated2/globals.d.js.map +1 -1
  196. package/lib/module/reanimated2/hook/index.js +1 -1
  197. package/lib/module/reanimated2/hook/index.js.map +1 -1
  198. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  199. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  200. package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
  201. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  202. package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
  203. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  204. package/lib/module/reanimated2/hook/useAnimatedSensor.js +90 -13
  205. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  206. package/lib/module/reanimated2/hook/useAnimatedStyle.js +46 -43
  207. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  208. package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
  209. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  210. package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
  211. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  212. package/lib/module/reanimated2/hook/utils.js +17 -60
  213. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  214. package/lib/module/reanimated2/index.js +1 -0
  215. package/lib/module/reanimated2/index.js.map +1 -1
  216. package/lib/module/reanimated2/initializers.js +72 -33
  217. package/lib/module/reanimated2/initializers.js.map +1 -1
  218. package/lib/module/reanimated2/interpolateColor.js +96 -19
  219. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  220. package/lib/module/reanimated2/jestUtils.js +1 -1
  221. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  222. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +103 -13
  223. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  224. package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
  225. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  226. package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
  227. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  228. package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  229. package/lib/module/reanimated2/js-reanimated/global.js +0 -2
  230. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  231. package/lib/module/reanimated2/js-reanimated/index.js +0 -1
  232. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  233. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
  234. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  235. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
  236. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  237. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +20 -8
  238. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  239. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
  240. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  241. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
  242. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  243. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
  244. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  245. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
  246. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  247. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
  248. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  249. package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
  250. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  251. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
  252. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  253. package/lib/module/reanimated2/mappers.js +16 -6
  254. package/lib/module/reanimated2/mappers.js.map +1 -1
  255. package/lib/module/reanimated2/mock.js +20 -1
  256. package/lib/module/reanimated2/mock.js.map +1 -1
  257. package/lib/module/reanimated2/mutables.js +4 -2
  258. package/lib/module/reanimated2/mutables.js.map +1 -1
  259. package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -0
  260. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
  261. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
  262. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  263. package/lib/module/reanimated2/pluginUtils.js +4 -0
  264. package/lib/module/reanimated2/pluginUtils.js.map +1 -0
  265. package/lib/module/reanimated2/shareables.js +36 -12
  266. package/lib/module/reanimated2/shareables.js.map +1 -1
  267. package/lib/module/reanimated2/threads.js +105 -7
  268. package/lib/module/reanimated2/threads.js.map +1 -1
  269. package/lib/module/reanimated2/utils.js +5 -0
  270. package/lib/module/reanimated2/utils.js.map +1 -1
  271. package/lib/module/reanimated2/valueSetter.js +1 -2
  272. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  273. package/mock.js +1 -211
  274. package/package.json +10 -10
  275. package/{plugin.js → plugin/index.js} +128 -249
  276. package/react-native-reanimated.d.ts +55 -417
  277. package/scripts/reanimated_utils.rb +15 -2
  278. package/src/createAnimatedComponent.tsx +247 -28
  279. package/src/reanimated2/Colors.ts +38 -11
  280. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +52 -39
  281. package/src/reanimated2/animation/styleAnimation.ts +8 -1
  282. package/src/reanimated2/animation/util.ts +29 -16
  283. package/src/reanimated2/commonTypes.ts +28 -1
  284. package/src/reanimated2/core.ts +42 -9
  285. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
  286. package/src/reanimated2/globals.d.ts +12 -15
  287. package/src/reanimated2/hook/index.ts +1 -1
  288. package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
  289. package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
  290. package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
  291. package/src/reanimated2/hook/useAnimatedSensor.ts +90 -11
  292. package/src/reanimated2/hook/useAnimatedStyle.ts +44 -36
  293. package/src/reanimated2/hook/useDerivedValue.ts +8 -1
  294. package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
  295. package/src/reanimated2/hook/utils.ts +15 -61
  296. package/src/reanimated2/index.ts +1 -0
  297. package/src/reanimated2/initializers.ts +76 -35
  298. package/src/reanimated2/interpolateColor.ts +104 -20
  299. package/src/reanimated2/jestUtils.ts +1 -1
  300. package/src/reanimated2/js-reanimated/JSReanimated.ts +98 -15
  301. package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
  302. package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
  303. package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
  304. package/src/reanimated2/js-reanimated/global.ts +0 -1
  305. package/src/reanimated2/js-reanimated/index.ts +0 -1
  306. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
  307. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
  308. package/src/reanimated2/layoutReanimation/animationsManager.ts +20 -9
  309. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
  310. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
  311. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
  312. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
  313. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
  314. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  315. package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
  316. package/src/reanimated2/mappers.ts +17 -6
  317. package/src/reanimated2/mock.ts +25 -2
  318. package/src/reanimated2/mutables.ts +2 -0
  319. package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
  320. package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
  321. package/src/reanimated2/pluginUtils.ts +8 -0
  322. package/src/reanimated2/shareables.ts +45 -16
  323. package/src/reanimated2/threads.ts +103 -4
  324. package/src/reanimated2/utils.ts +6 -0
  325. package/src/reanimated2/valueSetter.ts +1 -2
  326. package/lib/commonjs/reanimated2/time.js +0 -55
  327. package/lib/commonjs/reanimated2/time.js.map +0 -1
  328. package/lib/module/reanimated2/time.js +0 -37
  329. package/lib/module/reanimated2/time.js.map +0 -1
  330. package/src/reanimated2/time.ts +0 -30
  331. /package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["defineAnimation","withTiming","ColorProperties","processColor","resolvePath","obj","path","keys","Array","isArray","reduce","acc","current","undefined","setPath","value","currObj","i","length","withStyleAnimation","styleAnimations","onFrame","animation","now","stillGoing","entriesToCheck","currentEntry","pop","index","push","concat","key","Object","currentStyleAnimation","finished","callback","includes","onStart","previousAnimation","prevAnimation","prevVal","currentAnimation","duration","animationsToCheck","element","values","isHigherOrder"],"sources":["styleAnimation.ts"],"sourcesContent":["import { defineAnimation } from './util';\nimport {\n Timestamp,\n AnimatableValue,\n AnimationObject,\n Animation,\n AnimatedStyle,\n NestedObject,\n NestedObjectValues,\n} from '../commonTypes';\nimport { StyleLayoutAnimation } from './commonTypes';\nimport { withTiming } from './timing';\nimport { ColorProperties } from '../UpdateProps';\nimport { processColor } from '../Colors';\n\n// resolves path to value for nested objects\n// if path cannot be resolved returns undefined\nexport function resolvePath<T>(\n obj: NestedObject<T>,\n path: AnimatableValue[] | AnimatableValue\n): NestedObjectValues<T> | undefined {\n 'worklet';\n const keys: AnimatableValue[] = Array.isArray(path) ? path : [path];\n return keys.reduce<NestedObjectValues<T> | undefined>((acc, current) => {\n if (Array.isArray(acc) && typeof current === 'number') {\n return acc[current];\n } else if (typeof acc === 'object' && (current as number | string) in acc) {\n return (acc as { [key: string]: NestedObjectValues<T> })[\n current as number | string\n ];\n }\n return undefined;\n }, obj);\n}\n\n// set value at given path\ntype Path = Array<string | number> | string | number;\nexport function setPath<T>(\n obj: NestedObject<T>,\n path: Path,\n value: NestedObjectValues<T>\n): void {\n 'worklet';\n const keys: Path = Array.isArray(path) ? path : [path];\n let currObj: NestedObjectValues<T> = obj;\n for (let i = 0; i < keys.length - 1; i++) {\n // creates entry if there isn't one\n currObj = currObj as { [key: string]: NestedObjectValues<T> };\n if (!currObj[keys[i]]) {\n // if next key is a number create an array\n if (typeof keys[i + 1] === 'number') {\n currObj[keys[i]] = [];\n } else {\n currObj[keys[i]] = {};\n }\n }\n currObj = currObj[keys[i]];\n }\n\n (currObj as { [key: string]: NestedObjectValues<T> })[keys[keys.length - 1]] =\n value;\n}\n\ninterface NestedObjectEntry<T> {\n value: NestedObjectValues<T>;\n path: (string | number)[];\n}\n\nexport function withStyleAnimation(\n styleAnimations: AnimatedStyle\n): StyleLayoutAnimation {\n 'worklet';\n return defineAnimation<StyleLayoutAnimation>({}, () => {\n 'worklet';\n\n const onFrame = (\n animation: StyleLayoutAnimation,\n now: Timestamp\n ): boolean => {\n let stillGoing = false;\n const entriesToCheck: NestedObjectEntry<AnimationObject>[] = [\n { value: animation.styleAnimations, path: [] },\n ];\n while (entriesToCheck.length > 0) {\n const currentEntry: NestedObjectEntry<AnimationObject> =\n entriesToCheck.pop() as NestedObjectEntry<AnimationObject>;\n if (Array.isArray(currentEntry.value)) {\n for (let index = 0; index < currentEntry.value.length; index++) {\n entriesToCheck.push({\n value: currentEntry.value[index],\n path: currentEntry.path.concat(index),\n });\n }\n } else if (\n typeof currentEntry.value === 'object' &&\n currentEntry.value.onFrame === undefined\n ) {\n // nested object\n for (const key of Object.keys(currentEntry.value)) {\n entriesToCheck.push({\n value: currentEntry.value[key],\n path: currentEntry.path.concat(key),\n });\n }\n } else {\n const currentStyleAnimation: AnimationObject =\n currentEntry.value as AnimationObject;\n if (currentStyleAnimation.finished) {\n continue;\n }\n const finished = currentStyleAnimation.onFrame(\n currentStyleAnimation,\n now\n );\n if (finished) {\n currentStyleAnimation.finished = true;\n if (currentStyleAnimation.callback) {\n currentStyleAnimation.callback(true);\n }\n } else {\n stillGoing = true;\n }\n\n if (ColorProperties.includes(currentEntry.path[0] as string)) {\n currentStyleAnimation.current = processColor(\n currentStyleAnimation.current\n ) as number;\n }\n\n setPath(\n animation.current,\n currentEntry.path,\n currentStyleAnimation.current\n );\n }\n }\n return !stillGoing;\n };\n\n const onStart = (\n animation: StyleLayoutAnimation,\n value: AnimatedStyle,\n now: Timestamp,\n previousAnimation: StyleLayoutAnimation\n ): void => {\n const entriesToCheck: NestedObjectEntry<\n AnimationObject | AnimatableValue\n >[] = [{ value: styleAnimations, path: [] }];\n while (entriesToCheck.length > 0) {\n const currentEntry: NestedObjectEntry<\n AnimationObject | AnimatableValue\n > = entriesToCheck.pop() as NestedObjectEntry<\n AnimationObject | AnimatableValue\n >;\n if (Array.isArray(currentEntry.value)) {\n for (let index = 0; index < currentEntry.value.length; index++) {\n entriesToCheck.push({\n value: currentEntry.value[index],\n path: currentEntry.path.concat(index),\n });\n }\n } else if (\n typeof currentEntry.value === 'object' &&\n currentEntry.value.onStart === undefined\n ) {\n for (const key of Object.keys(currentEntry.value)) {\n entriesToCheck.push({\n value: currentEntry.value[key],\n path: currentEntry.path.concat(key),\n });\n }\n } else {\n const prevAnimation = resolvePath(\n previousAnimation?.styleAnimations,\n currentEntry.path\n );\n let prevVal = resolvePath(value, currentEntry.path);\n if (prevAnimation && !prevVal) {\n prevVal = prevAnimation.current;\n }\n setPath(animation.current, currentEntry.path, prevVal);\n let currentAnimation: AnimationObject;\n if (\n typeof currentEntry.value !== 'object' ||\n !currentEntry.value.onStart\n ) {\n currentAnimation = withTiming(\n currentEntry.value as AnimatableValue,\n { duration: 0 }\n );\n setPath(\n animation.styleAnimations,\n currentEntry.path,\n currentAnimation\n );\n } else {\n currentAnimation = currentEntry.value as Animation<AnimationObject>;\n }\n currentAnimation.onStart(\n currentAnimation,\n prevVal,\n now,\n prevAnimation\n );\n }\n }\n };\n\n const callback = (finished: boolean): void => {\n if (!finished) {\n const animationsToCheck: NestedObjectValues<AnimationObject>[] = [\n styleAnimations,\n ];\n while (animationsToCheck.length > 0) {\n const currentAnimation: NestedObjectValues<AnimationObject> =\n animationsToCheck.pop() as NestedObjectValues<AnimationObject>;\n if (Array.isArray(currentAnimation)) {\n for (const element of currentAnimation) {\n animationsToCheck.push(element);\n }\n } else if (\n typeof currentAnimation === 'object' &&\n currentAnimation.onStart === undefined\n ) {\n for (const value of Object.values(currentAnimation)) {\n animationsToCheck.push(value);\n }\n } else {\n const currentStyleAnimation: AnimationObject =\n currentAnimation as AnimationObject;\n if (\n !currentStyleAnimation.finished &&\n currentStyleAnimation.callback\n ) {\n currentStyleAnimation.callback(false);\n }\n }\n }\n }\n };\n\n return {\n isHigherOrder: true,\n onFrame,\n onStart,\n current: {},\n styleAnimations,\n callback,\n } as StyleLayoutAnimation;\n });\n}\n"],"mappings":"AAAA,SAASA,eAAT,QAAgC,QAAhC;AAWA,SAASC,UAAT,QAA2B,UAA3B;AACA,SAASC,eAAT,QAAgC,gBAAhC;AACA,SAASC,YAAT,QAA6B,WAA7B,C,CAEA;AACA;;AACA,OAAO,SAASC,WAAT,CACLC,GADK,EAELC,IAFK,EAG8B;EACnC;;EACA,MAAMC,IAAuB,GAAGC,KAAK,CAACC,OAAN,CAAcH,IA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3,"names":["defineAnimation","withTiming","ColorProperties","processColor","resolvePath","obj","path","keys","Array","isArray","reduce","acc","current","undefined","setPath","value","currObj","i","length","withStyleAnimation","styleAnimations","onFrame","animation","now","stillGoing","entriesToCheck","currentEntry","pop","index","push","concat","key","Object","currentStyleAnimation","finished","callback","includes","onStart","previousAnimation","prevAnimation","prevVal","console","warn","join","currentAnimation","duration","animationsToCheck","element","values","isHigherOrder"],"sources":["styleAnimation.ts"],"sourcesContent":["import { defineAnimation } from './util';\nimport {\n Timestamp,\n AnimatableValue,\n AnimationObject,\n Animation,\n AnimatedStyle,\n NestedObject,\n NestedObjectValues,\n} from '../commonTypes';\nimport { StyleLayoutAnimation } from './commonTypes';\nimport { withTiming } from './timing';\nimport { ColorProperties } from '../UpdateProps';\nimport { processColor } from '../Colors';\n\n// resolves path to value for nested objects\n// if path cannot be resolved returns undefined\nexport function resolvePath<T>(\n obj: NestedObject<T>,\n path: AnimatableValue[] | AnimatableValue\n): NestedObjectValues<T> | undefined {\n 'worklet';\n const keys: AnimatableValue[] = Array.isArray(path) ? path : [path];\n return keys.reduce<NestedObjectValues<T> | undefined>((acc, current) => {\n if (Array.isArray(acc) && typeof current === 'number') {\n return acc[current];\n } else if (typeof acc === 'object' && (current as number | string) in acc) {\n return (acc as { [key: string]: NestedObjectValues<T> })[\n current as number | string\n ];\n }\n return undefined;\n }, obj);\n}\n\n// set value at given path\ntype Path = Array<string | number> | string | number;\nexport function setPath<T>(\n obj: NestedObject<T>,\n path: Path,\n value: NestedObjectValues<T>\n): void {\n 'worklet';\n const keys: Path = Array.isArray(path) ? path : [path];\n let currObj: NestedObjectValues<T> = obj;\n for (let i = 0; i < keys.length - 1; i++) {\n // creates entry if there isn't one\n currObj = currObj as { [key: string]: NestedObjectValues<T> };\n if (!(keys[i] in currObj)) {\n // if next key is a number create an array\n if (typeof keys[i + 1] === 'number') {\n currObj[keys[i]] = [];\n } else {\n currObj[keys[i]] = {};\n }\n }\n currObj = currObj[keys[i]];\n }\n\n (currObj as { [key: string]: NestedObjectValues<T> })[keys[keys.length - 1]] =\n value;\n}\n\ninterface NestedObjectEntry<T> {\n value: NestedObjectValues<T>;\n path: (string | number)[];\n}\n\nexport function withStyleAnimation(\n styleAnimations: AnimatedStyle\n): StyleLayoutAnimation {\n 'worklet';\n return defineAnimation<StyleLayoutAnimation>({}, () => {\n 'worklet';\n\n const onFrame = (\n animation: StyleLayoutAnimation,\n now: Timestamp\n ): boolean => {\n let stillGoing = false;\n const entriesToCheck: NestedObjectEntry<AnimationObject>[] = [\n { value: animation.styleAnimations, path: [] },\n ];\n while (entriesToCheck.length > 0) {\n const currentEntry: NestedObjectEntry<AnimationObject> =\n entriesToCheck.pop() as NestedObjectEntry<AnimationObject>;\n if (Array.isArray(currentEntry.value)) {\n for (let index = 0; index < currentEntry.value.length; index++) {\n entriesToCheck.push({\n value: currentEntry.value[index],\n path: currentEntry.path.concat(index),\n });\n }\n } else if (\n typeof currentEntry.value === 'object' &&\n currentEntry.value.onFrame === undefined\n ) {\n // nested object\n for (const key of Object.keys(currentEntry.value)) {\n entriesToCheck.push({\n value: currentEntry.value[key],\n path: currentEntry.path.concat(key),\n });\n }\n } else {\n const currentStyleAnimation: AnimationObject =\n currentEntry.value as AnimationObject;\n if (currentStyleAnimation.finished) {\n continue;\n }\n const finished = currentStyleAnimation.onFrame(\n currentStyleAnimation,\n now\n );\n if (finished) {\n currentStyleAnimation.finished = true;\n if (currentStyleAnimation.callback) {\n currentStyleAnimation.callback(true);\n }\n } else {\n stillGoing = true;\n }\n\n if (ColorProperties.includes(currentEntry.path[0] as string)) {\n currentStyleAnimation.current = processColor(\n currentStyleAnimation.current\n ) as number;\n }\n\n setPath(\n animation.current,\n currentEntry.path,\n currentStyleAnimation.current\n );\n }\n }\n return !stillGoing;\n };\n\n const onStart = (\n animation: StyleLayoutAnimation,\n value: AnimatedStyle,\n now: Timestamp,\n previousAnimation: StyleLayoutAnimation\n ): void => {\n const entriesToCheck: NestedObjectEntry<\n AnimationObject | AnimatableValue\n >[] = [{ value: styleAnimations, path: [] }];\n while (entriesToCheck.length > 0) {\n const currentEntry: NestedObjectEntry<\n AnimationObject | AnimatableValue\n > = entriesToCheck.pop() as NestedObjectEntry<\n AnimationObject | AnimatableValue\n >;\n if (Array.isArray(currentEntry.value)) {\n for (let index = 0; index < currentEntry.value.length; index++) {\n entriesToCheck.push({\n value: currentEntry.value[index],\n path: currentEntry.path.concat(index),\n });\n }\n } else if (\n typeof currentEntry.value === 'object' &&\n currentEntry.value.onStart === undefined\n ) {\n for (const key of Object.keys(currentEntry.value)) {\n entriesToCheck.push({\n value: currentEntry.value[key],\n path: currentEntry.path.concat(key),\n });\n }\n } else {\n const prevAnimation = resolvePath(\n previousAnimation?.styleAnimations,\n currentEntry.path\n );\n let prevVal = resolvePath(value, currentEntry.path);\n if (prevAnimation && !prevVal) {\n prevVal = prevAnimation.current;\n }\n if (prevVal === undefined) {\n console.warn(\n `Initial values for animation are missing for property ${currentEntry.path.join(\n '.'\n )}`\n );\n }\n setPath(animation.current, currentEntry.path, prevVal);\n let currentAnimation: AnimationObject;\n if (\n typeof currentEntry.value !== 'object' ||\n !currentEntry.value.onStart\n ) {\n currentAnimation = withTiming(\n currentEntry.value as AnimatableValue,\n { duration: 0 }\n );\n setPath(\n animation.styleAnimations,\n currentEntry.path,\n currentAnimation\n );\n } else {\n currentAnimation = currentEntry.value as Animation<AnimationObject>;\n }\n currentAnimation.onStart(\n currentAnimation,\n prevVal,\n now,\n prevAnimation\n );\n }\n }\n };\n\n const callback = (finished: boolean): void => {\n if (!finished) {\n const animationsToCheck: NestedObjectValues<AnimationObject>[] = [\n styleAnimations,\n ];\n while (animationsToCheck.length > 0) {\n const currentAnimation: NestedObjectValues<AnimationObject> =\n animationsToCheck.pop() as NestedObjectValues<AnimationObject>;\n if (Array.isArray(currentAnimation)) {\n for (const element of currentAnimation) {\n animationsToCheck.push(element);\n }\n } else if (\n typeof currentAnimation === 'object' &&\n currentAnimation.onStart === undefined\n ) {\n for (const value of Object.values(currentAnimation)) {\n animationsToCheck.push(value);\n }\n } else {\n const currentStyleAnimation: AnimationObject =\n currentAnimation as AnimationObject;\n if (\n !currentStyleAnimation.finished &&\n currentStyleAnimation.callback\n ) {\n currentStyleAnimation.callback(false);\n }\n }\n }\n }\n };\n\n return {\n isHigherOrder: true,\n onFrame,\n onStart,\n current: {},\n styleAnimations,\n callback,\n } as StyleLayoutAnimation;\n });\n}\n"],"mappings":"AAAA,SAASA,eAAT,QAAgC,QAAhC;AAWA,SAASC,UAAT,QAA2B,UAA3B;AACA,SAASC,eAAT,QAAgC,gBAAhC;AACA,SAASC,YAAT,QAA6B,WAA7B,C,CAEA;AACA;;AACA,OAAO,SAASC,WAAT,CACLC,GADK,EAELC,IAFK,EAG8B;EACnC;;EACA,MAAMC,IAAuB,GAAGC,KAAK,CAACC,OAAN,CAAcH,IAAd,IAAsBA,IAAtB,GAA6B,CAACA,IAAD,CAA7D;EACA,OAAOC,IAAI,CAACG,MAAL,CAA+C,CAACC,GAAD,EAAMC,OAAN,KAAkB;IACtE,IAAIJ,KAAK,CAACC,OAAN,CAAcE,GAAd,KAAsB,OAAOC,OAAP,KAAmB,QAA7C,EAAuD;MACrD,OAAOD,GAAG,CAACC,OAAD,CAAV;IACD,CAFD,MAEO,IAAI,OAAOD,GAAP,KAAe,QAAf,IAA4BC,OAAD,IAAgCD,GAA/D,EAAoE;MACzE,OAAQA,GAAD,CACLC,OADK,CAAP;IAGD;;IACD,OAAOC,SAAP;EACD,CATM,EASJR,GATI,CAAP;AAUD,C,CAED;;AAEA,OAAO,SAASS,OAAT,CACLT,GADK,EAELC,IAFK,EAGLS,KAHK,EAIC;EACN;;EACA,MAAMR,IAAU,GAAGC,KAAK,CAACC,OAAN,CAAcH,IAAd,IAAsBA,IAAtB,GAA6B,CAACA,IAAD,CAAhD;EACA,IAAIU,OAA8B,GAAGX,GAArC;;EACA,KAAK,IAAIY,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG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AJ,EAAqC;YACnC,KAAK,MAAMG,OAAX,IAAsBH,gBAAtB,EAAwC;cACtCE,iBAAiB,CAACjB,IAAlB,CAAuBkB,OAAvB;YACD;UACF,CAJD,MAIO,IACL,OAAOH,gBAAP,KAA4B,QAA5B,IACAA,gBAAgB,CAACP,OAAjB,KAA6BxB,SAFxB,EAGL;YACA,KAAK,MAAME,KAAX,IAAoBiB,MAAM,CAACgB,MAAP,CAAcJ,gBAAd,CAApB,EAAqD;cACnDE,iBAAiB,CAACjB,IAAlB,CAAuBd,KAAvB;YACD;UACF,CAPM,MAOA;YACL,MAAMkB,qBAAsC,GAC1CW,gBADF;;YAEA,IACE,CAACX,qBAAqB,CAACC,QAAvB,IACAD,qBAAqB,CAACE,QAFxB,EAGE;cACAF,qBAAqB,CAACE,QAAtB,CAA+B,KAA/B;YACD;UACF;QACF;MACF;IACF,CA/BD;;IAiCA,OAAO;MACLc,aAAa,EAAE,IADV;MAEL5B,OAFK;MAGLgB,OAHK;MAILzB,OAAO,EAAE,EAJJ;MAKLQ,eALK;MAMLe;IANK,CAAP;EAQD,CAxLqB,CAAtB;AAyLD"}
@@ -1,5 +1,5 @@
1
1
  /* global _WORKLET */
2
- import { convertToHSVA, isColor, toRGBA } from '../Colors';
2
+ import { isColor, convertToRGBA, rgbaArrayToRGBAColor, toGammaSpace, toLinearSpace } from '../Colors';
3
3
  import NativeReanimatedModule from '../NativeReanimated';
4
4
  let IN_STYLE_UPDATER = false;
5
5
  export function initialUpdaterRun(updater) {
@@ -91,44 +91,44 @@ function decorateAnimation(animation) {
91
91
  return res;
92
92
  };
93
93
 
94
- const tab = ['H', 'S', 'V', 'A'];
94
+ const tab = ['R', 'G', 'B', 'A'];
95
95
 
96
96
  const colorOnStart = (animation, value, timestamp, previousAnimation) => {
97
- let HSVAValue;
98
- let HSVACurrent;
99
- let HSVAToValue;
97
+ let RGBAValue;
98
+ let RGBACurrent;
99
+ let RGBAToValue;
100
100
  const res = [];
101
101
 
102
102
  if (isColor(value)) {
103
- HSVACurrent = convertToHSVA(animation.current);
104
- HSVAValue = convertToHSVA(value);
103
+ RGBACurrent = toLinearSpace(convertToRGBA(animation.current));
104
+ RGBAValue = toLinearSpace(convertToRGBA(value));
105
105
 
106
106
  if (animation.toValue) {
107
- HSVAToValue = convertToHSVA(animation.toValue);
107
+ RGBAToValue = toLinearSpace(convertToRGBA(animation.toValue));
108
108
  }
109
109
  }
110
110
 
111
111
  tab.forEach((i, index) => {
112
112
  animation[i] = Object.assign({}, animationCopy);
113
- animation[i].current = HSVACurrent[index];
114
- animation[i].toValue = HSVAToValue ? HSVAToValue[index] : undefined;
115
- animation[i].onStart(animation[i], HSVAValue[index], timestamp, previousAnimation ? previousAnimation[i] : undefined);
113
+ animation[i].current = RGBACurrent[index];
114
+ animation[i].toValue = RGBAToValue ? RGBAToValue[index] : undefined;
115
+ animation[i].onStart(animation[i], RGBAValue[index], timestamp, previousAnimation ? previousAnimation[i] : undefined);
116
116
  res.push(animation[i].current);
117
117
  });
118
- animation.current = toRGBA(res);
118
+ animation.current = rgbaArrayToRGBAColor(toGammaSpace(res));
119
119
  };
120
120
 
121
121
  const colorOnFrame = (animation, timestamp) => {
122
- const HSVACurrent = convertToHSVA(animation.current);
122
+ const RGBACurrent = toLinearSpace(convertToRGBA(animation.current));
123
123
  const res = [];
124
124
  let finished = true;
125
125
  tab.forEach((i, index) => {
126
- animation[i].current = HSVACurrent[index]; // @ts-ignore: disable-next-line
126
+ animation[i].current = RGBACurrent[index]; // @ts-ignore: disable-next-line
127
127
 
128
128
  finished &= animation[i].onFrame(animation[i], timestamp);
129
129
  res.push(animation[i].current);
130
130
  });
131
- animation.current = toRGBA(res);
131
+ animation.current = rgbaArrayToRGBAColor(toGammaSpace(res));
132
132
  return finished;
133
133
  };
134
134
 
@@ -171,6 +171,7 @@ function decorateAnimation(animation) {
171
171
  };
172
172
  }
173
173
 
174
+ const IS_NATIVE = NativeReanimatedModule.native;
174
175
  export function defineAnimation(starting, factory) {
175
176
  'worklet';
176
177
 
@@ -186,7 +187,7 @@ export function defineAnimation(starting, factory) {
186
187
  return animation;
187
188
  };
188
189
 
189
- if (_WORKLET || !NativeReanimatedModule.native) {
190
+ if (_WORKLET || !IS_NATIVE) {
190
191
  return create();
191
192
  } // @ts-ignore: eslint-disable-line
192
193
 
@@ -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}\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,E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P;AACD;AAED,OAAO,SAASG,eAAT,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
+ {"version":3,"names":["isColor","convertToRGBA","rgbaArrayToRGBAColor","toGammaSpace","toLinearSpace","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","RGBAValue","RGBACurrent","RGBAToValue","forEach","i","index","undefined","push","colorOnFrame","finished","arrayOnStart","v","arrayOnFrame","Array","isArray","IS_NATIVE","native","defineAnimation","starting","factory","create","_WORKLET","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 {\n ParsedColorArray,\n isColor,\n convertToRGBA,\n rgbaArrayToRGBAColor,\n toGammaSpace,\n toLinearSpace,\n} 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 = ['R', 'G', 'B', 'A'];\n const colorOnStart = (\n animation: Animation<AnimationObject>,\n value: string | number,\n timestamp: Timestamp,\n previousAnimation: Animation<AnimationObject>\n ): void => {\n let RGBAValue: ParsedColorArray;\n let RGBACurrent: ParsedColorArray;\n let RGBAToValue: ParsedColorArray;\n const res: Array<number> = [];\n if (isColor(value)) {\n RGBACurrent = toLinearSpace(convertToRGBA(animation.current));\n RGBAValue = toLinearSpace(convertToRGBA(value));\n if (animation.toValue) {\n RGBAToValue = toLinearSpace(convertToRGBA(animation.toValue));\n }\n }\n tab.forEach((i, index) => {\n animation[i] = Object.assign({}, animationCopy);\n animation[i].current = RGBACurrent[index];\n animation[i].toValue = RGBAToValue ? RGBAToValue[index] : undefined;\n animation[i].onStart(\n animation[i],\n RGBAValue[index],\n timestamp,\n previousAnimation ? previousAnimation[i] : undefined\n );\n res.push(animation[i].current);\n });\n\n animation.current = rgbaArrayToRGBAColor(\n toGammaSpace(res as ParsedColorArray)\n );\n };\n\n const colorOnFrame = (\n animation: Animation<AnimationObject>,\n timestamp: Timestamp\n ): boolean => {\n const RGBACurrent = toLinearSpace(convertToRGBA(animation.current));\n const res: Array<number> = [];\n let finished = true;\n tab.forEach((i, index) => {\n animation[i].current = RGBACurrent[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 = rgbaArrayToRGBAColor(\n toGammaSpace(res as ParsedColorArray)\n );\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\nconst IS_NATIVE = NativeReanimatedModule.native;\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 || !IS_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,SAEEA,OAFF,EAGEC,aAHF,EAIEC,oBAJF,EAKEC,YALF,EAMEC,aANF,QAOO,WAPP;AAiBA,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,w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V,SAAD,EAAYT,KAAZ,EAAmBoB,SAAnB,EAA8BC,iBAA9B,CAArB;MACAZ,SAAS,CAACK,OAAV,GAAoBkB,qBAApB;MACA;IACD;;IACDrB,WAAW,CAACF,SAAD,EAAYT,KAAZ,EAAmBoB,SAAnB,EAA8BC,iBAA9B,CAAX;EACD,CApBD;AAqBD;;AAaD,MAAM8B,SAAS,GAAGzD,sBAAsB,CAAC0D,MAAzC;AAEA,OAAO,SAASC,eAAT,CAELC,QAFK,EAE+BC,OAF/B,EAEoD;EACzD;;EACA,IAAI5D,gBAAJ,EAAsB;IACpB,OAAO2D,QAAP;EACD;;EACD,MAAME,MAAM,GAAG,MAAM;IACnB;;IACA,MAAM/C,SAAS,GAAG8C,OAAO,EAAzB;IACA/C,iBAAiB,CAAIC,SAAJ,CAAjB;IACA,OAAOA,SAAP;EACD,CALD;;EAOA,IAAIgD,QAAQ,IAAI,CAACN,SAAjB,EAA4B;IAC1B,OAAOK,MAAM,EAAb;EACD,CAdwD,CAezD;;;EACA,OAAOA,MAAP;AACD;AAED,OAAO,SAASE,eAAT,CAA4BC,WAA5B,EAA+D;EACpE,UADoE,CAEpE;;EACAA,WAAW,CAAC3D,KAAZ,GAAoB2D,WAAW,CAAC3D,KAAhC,CAHoE,CAG7B;AACxC,C,CAED;;AACA,OAAO,SAAS4D,cAAT,CACLhC,UADK,EAELnB,SAFK,EAGuB;EAC5B;;EACA,OAAO4C,eAAe,CAACzB,UAAD,EAAa,MAAM;IACvC;;IACA,IAAI,CAAC6B,QAAD,IAAa,OAAOhD,SAAP,KAAqB,UAAtC,EAAkD;MAChDA,SAAS,GAAGA,SAAS,EAArB;IACD;;IACAA,SAAD,CAA0CkB,OAA1C,GAAoDC,UAApD;IACA,OAAOnB,SAAP;EACD,CAPqB,CAAtB;AAQD"}
@@ -5,6 +5,35 @@
5
5
  // check other methods that may use them. However, this field is not actually defined
6
6
  // nor should be used for anything else as assigning any data to those objects will
7
7
  // throw an error.
8
+ export let SensorType;
9
+
10
+ (function (SensorType) {
11
+ SensorType[SensorType["ACCELEROMETER"] = 1] = "ACCELEROMETER";
12
+ SensorType[SensorType["GYROSCOPE"] = 2] = "GYROSCOPE";
13
+ SensorType[SensorType["GRAVITY"] = 3] = "GRAVITY";
14
+ SensorType[SensorType["MAGNETIC_FIELD"] = 4] = "MAGNETIC_FIELD";
15
+ SensorType[SensorType["ROTATION"] = 5] = "ROTATION";
16
+ })(SensorType || (SensorType = {}));
17
+
18
+ export let IOSReferenceFrame;
19
+
20
+ (function (IOSReferenceFrame) {
21
+ IOSReferenceFrame[IOSReferenceFrame["XArbitraryZVertical"] = 0] = "XArbitraryZVertical";
22
+ IOSReferenceFrame[IOSReferenceFrame["XArbitraryCorrectedZVertical"] = 1] = "XArbitraryCorrectedZVertical";
23
+ IOSReferenceFrame[IOSReferenceFrame["XMagneticNorthZVertical"] = 2] = "XMagneticNorthZVertical";
24
+ IOSReferenceFrame[IOSReferenceFrame["XTrueNorthZVertical"] = 3] = "XTrueNorthZVertical";
25
+ IOSReferenceFrame[IOSReferenceFrame["Auto"] = 4] = "Auto";
26
+ })(IOSReferenceFrame || (IOSReferenceFrame = {}));
27
+
28
+ export let InterfaceOrientation;
29
+
30
+ (function (InterfaceOrientation) {
31
+ InterfaceOrientation[InterfaceOrientation["ROTATION_0"] = 0] = "ROTATION_0";
32
+ InterfaceOrientation[InterfaceOrientation["ROTATION_90"] = 90] = "ROTATION_90";
33
+ InterfaceOrientation[InterfaceOrientation["ROTATION_180"] = 180] = "ROTATION_180";
34
+ InterfaceOrientation[InterfaceOrientation["ROTATION_270"] = 270] = "ROTATION_270";
35
+ })(InterfaceOrientation || (InterfaceOrientation = {}));
36
+
8
37
  export let KeyboardState;
9
38
 
10
39
  (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 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
+ {"version":3,"names":["SensorType","IOSReferenceFrame","InterfaceOrientation","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}\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 enum SensorType {\n ACCELEROMETER = 1,\n GYROSCOPE = 2,\n GRAVITY = 3,\n MAGNETIC_FIELD = 4,\n ROTATION = 5,\n}\nexport enum IOSReferenceFrame {\n XArbitraryZVertical,\n XArbitraryCorrectedZVertical,\n XMagneticNorthZVertical,\n XTrueNorthZVertical,\n Auto,\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 interfaceOrientation: InterfaceOrientation;\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 interfaceOrientation: InterfaceOrientation;\n};\n\nexport enum InterfaceOrientation {\n ROTATION_0 = 0,\n ROTATION_90 = 90,\n ROTATION_180 = 180,\n ROTATION_270 = 270,\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\nexport interface AnimatedKeyboardOptions {\n isStatusBarTranslucentAndroid?: boolean;\n}\n"],"mappings":"AAmDA;AACA;AACA;AACA;AACA;AACA;AACA;AAyFA,WAAYA,UAAZ;;WAAYA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAOZ,WAAYC,iBAAZ;;WAAYA,iB;EAAAA,iB,CAAAA,iB;EAAAA,iB,CAAAA,iB;EAAAA,iB,CAAAA,iB;EAAAA,iB,CAAAA,iB;EAAAA,iB,CAAAA,iB;GAAAA,iB,KAAAA,iB;;AAqCZ,WAAYC,oBAAZ;;WAAYA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,KAAAA,oB;;AASZ,WAAYC,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"}
@@ -6,7 +6,6 @@ import { makeMutable as makeMutableUnwrapped, makeRemote as makeRemoteUnwrapped
6
6
  import { initializeUIRuntime } from './initializers';
7
7
  export { stopMapper } from './mappers';
8
8
  export { runOnJS, runOnUI } from './threads';
9
- export { getTimestamp } from './time';
10
9
 
11
10
  const testWorklet = () => {
12
11
  'worklet';
@@ -68,19 +67,44 @@ export function getViewProp(viewTag, propName) {
68
67
  });
69
68
  }
70
69
  export function registerEventHandler(eventHash, eventHandler) {
71
- return NativeReanimatedModule.registerEventHandler(eventHash, makeShareableCloneRecursive(eventHandler));
70
+ function handleAndFlushImmediates(eventTimestamp, event) {
71
+ 'worklet';
72
+
73
+ global.__frameTimestamp = eventTimestamp;
74
+ eventHandler(event);
75
+
76
+ global.__flushAnimationFrame(eventTimestamp);
77
+
78
+ global.__frameTimestamp = undefined;
79
+ }
80
+
81
+ return NativeReanimatedModule.registerEventHandler(eventHash, makeShareableCloneRecursive(handleAndFlushImmediates));
72
82
  }
73
83
  export function unregisterEventHandler(id) {
74
84
  return NativeReanimatedModule.unregisterEventHandler(id);
75
85
  }
76
- export function subscribeForKeyboardEvents(eventHandler) {
77
- return NativeReanimatedModule.subscribeForKeyboardEvents(makeShareableCloneRecursive(eventHandler));
86
+ export function subscribeForKeyboardEvents(eventHandler, options) {
87
+ // TODO: this should really go with the same code path as other events, that is
88
+ // via registerEventHandler. For now we are copying the code from there.
89
+ function handleAndFlushImmediates(state, height) {
90
+ 'worklet';
91
+
92
+ const now = performance.now();
93
+ global.__frameTimestamp = now;
94
+ eventHandler(state, height);
95
+
96
+ global.__flushAnimationFrame(now);
97
+
98
+ global.__frameTimestamp = undefined;
99
+ }
100
+
101
+ return NativeReanimatedModule.subscribeForKeyboardEvents(makeShareableCloneRecursive(handleAndFlushImmediates), options.isStatusBarTranslucentAndroid ?? false);
78
102
  }
79
103
  export function unsubscribeFromKeyboardEvents(listenerId) {
80
104
  return NativeReanimatedModule.unsubscribeFromKeyboardEvents(listenerId);
81
105
  }
82
- export function registerSensor(sensorType, interval, eventHandler) {
83
- return NativeReanimatedModule.registerSensor(sensorType, interval, makeShareableCloneRecursive(eventHandler));
106
+ export function registerSensor(sensorType, interval, iosReferenceFrame, eventHandler) {
107
+ return NativeReanimatedModule.registerSensor(sensorType, interval, iosReferenceFrame, makeShareableCloneRecursive(eventHandler));
84
108
  }
85
109
  export function unregisterSensor(listenerId) {
86
110
  return NativeReanimatedModule.unregisterSensor(listenerId);
@@ -109,7 +133,8 @@ export function enableLayoutAnimations(flag) {
109
133
  }
110
134
  }
111
135
  export function configureLayoutAnimations(viewTag, type, config) {
112
- NativeReanimatedModule.configureLayoutAnimation(viewTag, type, makeShareableCloneRecursive(config));
136
+ let sharedTransitionTag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
137
+ NativeReanimatedModule.configureLayoutAnimation(viewTag, type, sharedTransitionTag, makeShareableCloneRecursive(config));
113
138
  }
114
139
  export function configureProps(uiProps, nativeProps) {
115
140
  if (!nativeShouldBeMock()) {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeReanimatedModule","nativeShouldBeMock","shouldBeUseWeb","isWeb","makeShareableCloneRecursive","makeShareable","makeShareableUnwrapped","startMapper","startMapperUnwrapped","makeMutable","makeMutableUnwrapped","makeRemote","makeRemoteUnwrapped","initializeUIRuntime","stopMapper","runOnJS","runOnUI","getTimestamp","testWorklet","throwUninitializedReanimatedException","Error","checkPluginState","throwError","__workletHash","isConfigured","isConfiguredCheck","configurationCheckWrapper","__DEV__","fn","global","_WORKLET","_log","s","console","log","getViewProp","viewTag","propName","_IS_FABRIC","Promise","resolve","reject","result","substr","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","listenerId","registerSensor","sensorType","interval","unregisterSensor","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimations","type","config","configureLayoutAnimation","configureProps","uiProps","nativeProps"],"sources":["core.ts"],"sourcesContent":["import 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 { startMapper as startMapperUnwrapped } from './mappers';\nimport {\n makeMutable as makeMutableUnwrapped,\n makeRemote as makeRemoteUnwrapped,\n} from './mutables';\nimport { LayoutAnimationFunction } from './layoutReanimation';\nimport { initializeUIRuntime } from './initializers';\n\nexport { stopMapper } from './mappers';\nexport { runOnJS, runOnUI } from './threads';\nexport { getTimestamp } from './time';\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\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\n// initialize UI runtime if applicable\nif (!isWeb() && isConfigured()) {\n initializeUIRuntime();\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,OAAOA,sBAAP,MAAmC,oBAAnC;AACA,SAASC,kBAAT,EAA6BC,cAA7B,EAA6CC,KAA7C,QAA0D,mBAA1D;AAEA,SACEC,2BADF,EAEEC,aAAa,IAAIC,sBAFnB,QAGO,cAHP;AAIA,SAASC,WAAW,IAAIC,oBAAxB,QAAoD,WAApD;AACA,SACEC,WAAW,IAAIC,oBADjB,EAEEC,UAAU,IAAIC,mBAFhB,QAGO,YAHP;AAKA,SAASC,mBAAT,QAAoC,gBAApC;AAEA,SAASC,UAAT,QAA2B,WAA3B;AACA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,WAAjC;AACA,SAASC,YAAT,QAA6B,QAA7B;;AAOA,MAAMC,WAAuC,GAAG,MAAM;EACpD;AACD,CAFD;;AAIA,M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AT,CAA0BJ,UAA1B,EAAoD;EACzD,OAAOnD,sBAAsB,CAACuD,gBAAvB,CAAwCJ,UAAxC,CAAP;AACD,C,CAED;;AACA,IAAI,CAAChD,KAAK,EAAN,IAAYqB,YAAY,EAA5B,EAAgC;EAC9BX,mBAAmB;AACpB;;AAOD,IAAI2C,cAA8B,GAAG;EACnCC,sBAAsB,EAAE,KADW;EAEnCC,SAAS,EAAE;AAFwB,CAArC;AAKA,OAAO,SAASD,sBAAT,CACLE,IADK,EAGC;EAAA,IADNC,YACM,uEADS,IACT;;EACN,IAAIA,YAAJ,EAAkB;IAChBJ,cAAc,GAAG;MACfC,sBAAsB,EAAEE,IADT;MAEfD,SAAS,EAAE;IAFI,CAAjB;IAIA1D,sBAAsB,CAACyD,sBAAvB,CAA8CE,IAA9C;EACD,CAND,MAMO,IACL,CAACH,cAAc,CAACE,SAAhB,IACAF,cAAc,CAACC,sBAAf,KAA0CE,IAFrC,EAGL;IACAH,cAAc,CAACC,sBAAf,GAAwCE,IAAxC;IACA3D,sBAAsB,CAACyD,sBAAvB,CAA8CE,IAA9C;EACD;AACF;AAED,OAAO,SAASE,yBAAT,CACLzB,OADK,EAEL0B,IAFK,EAGLC,MAHK,EAIC;EACN/D,sBAAsB,CAACgE,wBAAvB,CACE5B,OADF,EAEE0B,IAFF,EAGE1D,2BAA2B,CAAC2D,MAAD,CAH7B;AAKD;AAED,OAAO,SAASE,cAAT,CAAwBC,OAAxB,EAA2CC,WAA3C,EAAwE;EAC7E,IAAI,CAAClE,kBAAkB,EAAvB,EAA2B;IACzBD,sBAAsB,CAACiE,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;AACF"}
1
+ {"version":3,"names":["NativeReanimatedModule","nativeShouldBeMock","shouldBeUseWeb","isWeb","makeShareableCloneRecursive","makeShareable","makeShareableUnwrapped","startMapper","startMapperUnwrapped","makeMutable","makeMutableUnwrapped","makeRemote","makeRemoteUnwrapped","initializeUIRuntime","stopMapper","runOnJS","runOnUI","testWorklet","throwUninitializedReanimatedException","Error","checkPluginState","throwError","__workletHash","isConfigured","isConfiguredCheck","configurationCheckWrapper","__DEV__","fn","global","_WORKLET","_log","s","console","log","getViewProp","viewTag","propName","_IS_FABRIC","Promise","resolve","reject","result","substr","registerEventHandler","eventHash","eventHandler","handleAndFlushImmediates","eventTimestamp","event","__frameTimestamp","__flushAnimationFrame","undefined","unregisterEventHandler","id","subscribeForKeyboardEvents","options","state","height","now","performance","isStatusBarTranslucentAndroid","unsubscribeFromKeyboardEvents","listenerId","registerSensor","sensorType","interval","iosReferenceFrame","unregisterSensor","featuresConfig","enableLayoutAnimations","setByUser","flag","isCallByUser","configureLayoutAnimations","type","config","sharedTransitionTag","configureLayoutAnimation","configureProps","uiProps","nativeProps"],"sources":["core.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';\nimport {\n AnimatedKeyboardOptions,\n BasicWorkletFunction,\n Value3D,\n ValueRotation,\n} from './commonTypes';\nimport {\n makeShareableCloneRecursive,\n makeShareable as makeShareableUnwrapped,\n} from './shareables';\nimport { startMapper as startMapperUnwrapped } from './mappers';\nimport {\n makeMutable as makeMutableUnwrapped,\n makeRemote as makeRemoteUnwrapped,\n} from './mutables';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from './layoutReanimation';\nimport { initializeUIRuntime } from './initializers';\n\nexport { stopMapper } from './mappers';\nexport { runOnJS, runOnUI } from './threads';\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\nexport function registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n): string {\n function handleAndFlushImmediates(eventTimestamp: number, event: T) {\n 'worklet';\n global.__frameTimestamp = eventTimestamp;\n eventHandler(event);\n global.__flushAnimationFrame(eventTimestamp);\n global.__frameTimestamp = undefined;\n }\n return NativeReanimatedModule.registerEventHandler(\n eventHash,\n makeShareableCloneRecursive(handleAndFlushImmediates)\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 options: AnimatedKeyboardOptions\n): number {\n // TODO: this should really go with the same code path as other events, that is\n // via registerEventHandler. For now we are copying the code from there.\n function handleAndFlushImmediates(state: number, height: number) {\n 'worklet';\n const now = performance.now();\n global.__frameTimestamp = now;\n eventHandler(state, height);\n global.__flushAnimationFrame(now);\n global.__frameTimestamp = undefined;\n }\n return NativeReanimatedModule.subscribeForKeyboardEvents(\n makeShareableCloneRecursive(handleAndFlushImmediates),\n options.isStatusBarTranslucentAndroid ?? false\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 iosReferenceFrame: number,\n eventHandler: (\n data: Value3D | ValueRotation,\n orientationDegrees: number\n ) => void\n): number {\n return NativeReanimatedModule.registerSensor(\n sensorType,\n interval,\n iosReferenceFrame,\n makeShareableCloneRecursive(eventHandler)\n );\n}\n\nexport function unregisterSensor(listenerId: number): void {\n return NativeReanimatedModule.unregisterSensor(listenerId);\n}\n\n// initialize UI runtime if applicable\nif (!isWeb() && isConfigured()) {\n initializeUIRuntime();\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: LayoutAnimationType,\n config: LayoutAnimationFunction | Keyframe,\n sharedTransitionTag = ''\n): void {\n NativeReanimatedModule.configureLayoutAnimation(\n viewTag,\n type,\n sharedTransitionTag,\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,OAAOA,sBAAP,MAAmC,oBAAnC;AACA,SAASC,kBAAT,EAA6BC,cAA7B,EAA6CC,KAA7C,QAA0D,mBAA1D;AAOA,SACEC,2BADF,EAEEC,aAAa,IAAIC,sBAFnB,QAGO,cAHP;AAIA,SAASC,WAAW,IAAIC,oBAAxB,QAAoD,WAApD;AACA,SACEC,WAAW,IAAIC,oBADjB,EAEEC,UAAU,IAAIC,mBAFhB,QAGO,YAHP;AAQA,SAASC,mBAAT,QAAoC,gBAApC;AAEA,SAASC,UAAT,QAA2B,WAA3B;AACA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,WAAjC;;AAOA,MAAMC,WAAuC,GAAG,MAAM;EACpD;AACD,CAFD;;AAIA,MAAMC,qCAAqC,GAAG,MAAM;EAClD,MAAM,IAAIC,KAAJ,CACJ,4cADI,CAAN;AAGD,CAJD;;AAMA,OAAO,MAAMC,gBAAkD,GAAG,YAE7D;EAAA,IADHC,UACG,uEADU,IACV;;EACH,IAAI,CAACJ,WAAW,CAACK,aAAb,IAA8B,CAACpB,cAAc,EAAjD,EAAqD;IACnD,IAAImB,UAAJ,EAAgB;MACdH,qCAAqC;IACtC;;IACD,OAAO,KAAP;EACD;;EACD,OAAO,IAAP;AACD,CAVM;AAYP,OAAO,MAAMK,YAA+C,GAAG,YAE1D;EAAA,IADHF,UACG,uEADU,KACV;EACH,O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IACzBD,sBAAsB,CAAC8E,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;AACF"}
@@ -1,5 +1,5 @@
1
- import { runOnUI } from '../core';
2
- export const prepareUIRegistry = runOnUI(() => {
1
+ import { runOnUIImmediately } from '../threads';
2
+ export const prepareUIRegistry = runOnUIImmediately(() => {
3
3
  'worklet';
4
4
 
5
5
  const frameCallbackRegistry = {
@@ -1 +1 @@
1
- {"version":3,"names":["runOnUI","prepareUIRegistry","frameCallbackRegistry","Map","activeFrameCallbacks","Set","previousFrameTimestamp","runCallbacks","loop","timestamp","delta","forEach","callbackId","callbackDetails","get","startTime","callback","timeSincePreviousFrame","timeSinceFirstFrame","size","requestAnimationFrame","registerFrameCallback","set","unregisterFrameCallback","manageStateFrameCallback","delete","state","add","global","_frameCallbackRegistry"],"sources":["FrameCallbackRegistryUI.ts"],"sourcesContent":["import { runOnUI } from '../core';\n\ntype CallbackDetails = {\n callback: (frameInfo: FrameInfo) => void;\n startTime: number | null;\n};\n\nexport type FrameInfo = {\n timestamp: number;\n timeSincePreviousFrame: number | null;\n timeSinceFirstFrame: number;\n};\n\nexport interface FrameCallbackRegistryUI {\n frameCallbackRegistry: Map<number, CallbackDetails>;\n activeFrameCallbacks: Set<number>;\n previousFrameTimestamp: number | null;\n runCallbacks: () => void;\n registerFrameCallback: (\n callback: (frameInfo: FrameInfo) => void,\n callbackId: number\n ) => void;\n unregisterFrameCallback: (callbackId: number) => void;\n manageStateFrameCallback: (callbackId: number, state: boolean) => void;\n}\n\nexport const prepareUIRegistry = runOnUI(() => {\n 'worklet';\n\n const frameCallbackRegistry: FrameCallbackRegistryUI = {\n frameCallbackRegistry: new Map<number, CallbackDetails>(),\n activeFrameCallbacks: new Set<number>(),\n previousFrameTimestamp: null,\n\n runCallbacks() {\n const loop = (timestamp: number) => {\n if (this.previousFrameTimestamp === null) {\n this.previousFrameTimestamp = timestamp;\n }\n\n const delta = timestamp - this.previousFrameTimestamp;\n\n this.activeFrameCallbacks.forEach((callbackId: number) => {\n const callbackDetails = this.frameCallbackRegistry.get(callbackId)!;\n\n const { startTime } = callbackDetails;\n\n if (startTime === null) {\n // First frame\n callbackDetails.startTime = timestamp;\n\n callbackDetails.callback({\n timestamp,\n timeSincePreviousFrame: null,\n timeSinceFirstFrame: 0,\n });\n } else {\n // Next frame\n callbackDetails.callback({\n timestamp,\n timeSincePreviousFrame: delta,\n timeSinceFirstFrame: timestamp - startTime,\n });\n }\n });\n\n if (this.activeFrameCallbacks.size > 0) {\n this.previousFrameTimestamp = timestamp;\n requestAnimationFrame(loop);\n } else {\n this.previousFrameTimestamp = null;\n }\n };\n\n // runCallback() should only be called after registering a callback,\n // so if there is only one active callback, then it means that there were\n // zero previously and the loop isn't running yet.\n if (this.activeFrameCallbacks.size === 1) {\n requestAnimationFrame(loop);\n }\n },\n\n registerFrameCallback(\n callback: (frameInfo: FrameInfo) => void,\n callbackId: number\n ) {\n this.frameCallbackRegistry.set(callbackId, {\n callback: callback,\n startTime: null,\n });\n },\n\n unregisterFrameCallback(callbackId: number) {\n this.manageStateFrameCallback(callbackId, false);\n this.frameCallbackRegistry.delete(callbackId);\n },\n\n manageStateFrameCallback(callbackId: number, state: boolean) {\n if (callbackId === -1) {\n return;\n }\n if (state) {\n this.activeFrameCallbacks.add(callbackId);\n this.runCallbacks();\n } else {\n const callback = this.frameCallbackRegistry.get(callbackId)!;\n callback.startTime = null;\n\n this.activeFrameCallbacks.delete(callbackId);\n }\n },\n };\n\n global._frameCallbackRegistry = frameCallbackRegistry;\n});\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,SAAxB;AA0BA,OAAO,MAAMC,iBAAiB,GAAGD,OAAO,CAAC,MAAM;EAC7C;;EAEA,MAAME,qBAA8C,GAAG;IACrDA,qBAAqB,EAAE,IAAIC,GAAJ,EAD8B;IAErDC,oBAAoB,EAAE,IAAIC,GAAJ,EAF+B;IAGrDC,sBAAsB,EAAE,IAH6B;;IAKrDC,YAAY,GAAG;MACb,MA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A3C;IAID,CA7DoD;;IA+DrDQ,uBAAuB,CAACX,UAAD,EAAqB;MAC1C,KAAKY,wBAAL,CAA8BZ,UAA9B,EAA0C,KAA1C;MACA,KAAKV,qBAAL,CAA2BuB,MAA3B,CAAkCb,UAAlC;IACD,CAlEoD;;IAoErDY,wBAAwB,CAACZ,UAAD,EAAqBc,KAArB,EAAqC;MAC3D,IAAId,UAAU,KAAK,CAAC,CAApB,EAAuB;QACrB;MACD;;MACD,IAAIc,KAAJ,EAAW;QACT,KAAKtB,oBAAL,CAA0BuB,GAA1B,CAA8Bf,UAA9B;QACA,KAAKL,YAAL;MACD,CAHD,MAGO;QACL,MAAMS,QAAQ,GAAG,KAAKd,qBAAL,CAA2BY,GAA3B,CAA+BF,UAA/B,CAAjB;QACAI,QAAQ,CAACD,SAAT,GAAqB,IAArB;QAEA,KAAKX,oBAAL,CAA0BqB,MAA1B,CAAiCb,UAAjC;MACD;IACF;;EAjFoD,CAAvD;EAoFAgB,MAAM,CAACC,sBAAP,GAAgC3B,qBAAhC;AACD,CAxFuC,CAAjC"}
1
+ {"version":3,"names":["runOnUIImmediately","prepareUIRegistry","frameCallbackRegistry","Map","activeFrameCallbacks","Set","previousFrameTimestamp","runCallbacks","loop","timestamp","delta","forEach","callbackId","callbackDetails","get","startTime","callback","timeSincePreviousFrame","timeSinceFirstFrame","size","requestAnimationFrame","registerFrameCallback","set","unregisterFrameCallback","manageStateFrameCallback","delete","state","add","global","_frameCallbackRegistry"],"sources":["FrameCallbackRegistryUI.ts"],"sourcesContent":["import { runOnUIImmediately } from '../threads';\n\ntype CallbackDetails = {\n callback: (frameInfo: FrameInfo) => void;\n startTime: number | null;\n};\n\nexport type FrameInfo = {\n timestamp: number;\n timeSincePreviousFrame: number | null;\n timeSinceFirstFrame: number;\n};\n\nexport interface FrameCallbackRegistryUI {\n frameCallbackRegistry: Map<number, CallbackDetails>;\n activeFrameCallbacks: Set<number>;\n previousFrameTimestamp: number | null;\n runCallbacks: () => void;\n registerFrameCallback: (\n callback: (frameInfo: FrameInfo) => void,\n callbackId: number\n ) => void;\n unregisterFrameCallback: (callbackId: number) => void;\n manageStateFrameCallback: (callbackId: number, state: boolean) => void;\n}\n\nexport const prepareUIRegistry = runOnUIImmediately(() => {\n 'worklet';\n\n const frameCallbackRegistry: FrameCallbackRegistryUI = {\n frameCallbackRegistry: new Map<number, CallbackDetails>(),\n activeFrameCallbacks: new Set<number>(),\n previousFrameTimestamp: null,\n\n runCallbacks() {\n const loop = (timestamp: number) => {\n if (this.previousFrameTimestamp === null) {\n this.previousFrameTimestamp = timestamp;\n }\n\n const delta = timestamp - this.previousFrameTimestamp;\n\n this.activeFrameCallbacks.forEach((callbackId: number) => {\n const callbackDetails = this.frameCallbackRegistry.get(callbackId)!;\n\n const { startTime } = callbackDetails;\n\n if (startTime === null) {\n // First frame\n callbackDetails.startTime = timestamp;\n\n callbackDetails.callback({\n timestamp,\n timeSincePreviousFrame: null,\n timeSinceFirstFrame: 0,\n });\n } else {\n // Next frame\n callbackDetails.callback({\n timestamp,\n timeSincePreviousFrame: delta,\n timeSinceFirstFrame: timestamp - startTime,\n });\n }\n });\n\n if (this.activeFrameCallbacks.size > 0) {\n this.previousFrameTimestamp = timestamp;\n requestAnimationFrame(loop);\n } else {\n this.previousFrameTimestamp = null;\n }\n };\n\n // runCallback() should only be called after registering a callback,\n // so if there is only one active callback, then it means that there were\n // zero previously and the loop isn't running yet.\n if (this.activeFrameCallbacks.size === 1) {\n requestAnimationFrame(loop);\n }\n },\n\n registerFrameCallback(\n callback: (frameInfo: FrameInfo) => void,\n callbackId: number\n ) {\n this.frameCallbackRegistry.set(callbackId, {\n callback: callback,\n startTime: null,\n });\n },\n\n unregisterFrameCallback(callbackId: number) {\n this.manageStateFrameCallback(callbackId, false);\n this.frameCallbackRegistry.delete(callbackId);\n },\n\n manageStateFrameCallback(callbackId: number, state: boolean) {\n if (callbackId === -1) {\n return;\n }\n if (state) {\n this.activeFrameCallbacks.add(callbackId);\n this.runCallbacks();\n } else {\n const callback = this.frameCallbackRegistry.get(callbackId)!;\n callback.startTime = null;\n\n this.activeFrameCallbacks.delete(callbackId);\n }\n },\n };\n\n global._frameCallbackRegistry = frameCallbackRegistry;\n});\n"],"mappings":"AAAA,SAASA,kBAAT,QAAmC,YAAnC;AA0BA,OAAO,MAAMC,iBAAiB,GAAGD,kBAAkB,CAAC,MAAM;EACxD;;EAEA,MAAME,qBAA8C,GAAG;IACrDA,qBAAqB,EAAE,IAAIC,GAAJ,EAD8B;IAErDC,oBAAoB,EAAE,IAAIC,GAAJ,EAF+B;IAGrDC,sBAAsB,EAAE,IAH6B;;IAKrDC,YAAY,GAAG;MACb,MAAMC,IAAI,GAAIC,SAAD,IAAuB;QAClC,IAAI,KAAKH,sBAAL,KAAgC,IAApC,EAA0C;UACxC,KAAKA,sBAAL,GAA8BG,SAA9B;QACD;;QAED,MAAMC,KAAK,GAAGD,SAAS,GAAG,KAAKH,sBAA/B;QAEA,KAAKF,oBAAL,CAA0BO,OAA1B,CAAmCC,UAAD,IAAwB;UACxD,MAAMC,eAAe,GAAG,KAAKX,qBAAL,CAA2BY,GAA3B,CAA+BF,UAA/B,CAAxB;UAEA,MAAM;YAAEG;UAAF,IAAgBF,eAAtB;;UAEA,IAAIE,SAAS,KAAK,IAAlB,EAAwB;YACtB;YACAF,eAAe,CAACE,SAAhB,GAA4BN,SAA5B;YAEAI,eAAe,CAACG,QAAhB,CAAyB;cACvBP,SADuB;cAEvBQ,sBAAsB,EAAE,IAFD;cAGvBC,mBAAmB,EAAE;YAHE,CAAzB;UAKD,CATD,MASO;YACL;YACAL,eAAe,CAACG,QAAhB,CAAyB;cACvBP,SADuB;cAEvBQ,sBAAsB,EAAEP,KAFD;cAGvBQ,mBAAmB,EAAET,SAAS,GAAGM;YAHV,CAAzB;UAKD;QACF,CAtBD;;QAwBA,IAAI,KAAKX,oBAAL,CAA0Be,IAA1B,GAAiC,CAArC,EAAwC;UACtC,KAAKb,sBAAL,GAA8BG,SAA9B;UACAW,qBAAqB,CAACZ,IAAD,CAArB;QACD,CAHD,MAGO;UACL,KAAKF,sBAAL,GAA8B,IAA9B;QACD;MACF,CArCD,CADa,CAwCb;MACA;MACA;;;MACA,IAAI,KAAKF,oBAAL,CAA0Be,IAA1B,KAAmC,CAAvC,EAA0C;QACxCC,qBAAqB,CAACZ,IAAD,CAArB;MACD;IACF,CAnDoD;;IAqDrDa,qBAAqB,CACnBL,QADmB,EAEnBJ,UAFmB,EAGnB;MACA,KAAKV,qBAAL,CAA2BoB,GAA3B,CAA+BV,UAA/B,EAA2C;QACzCI,QAAQ,EAAEA,QAD+B;QAEzCD,SAAS,EAAE;MAF8B,CAA3C;IAID,CA7DoD;;IA+DrDQ,uBAAuB,CAACX,UAAD,EAAqB;MAC1C,KAAKY,wBAAL,CAA8BZ,UAA9B,EAA0C,KAA1C;MACA,KAAKV,qBAAL,CAA2BuB,MAA3B,CAAkCb,UAAlC;IACD,CAlEoD;;IAoErDY,wBAAwB,CAACZ,UAAD,EAAqBc,KAArB,EAAqC;MAC3D,IAAId,UAAU,KAAK,CAAC,CAApB,EAAuB;QACrB;MACD;;MACD,IAAIc,KAAJ,EAAW;QACT,KAAKtB,oBAAL,CAA0BuB,GAA1B,CAA8Bf,UAA9B;QACA,KAAKL,YAAL;MACD,CAHD,MAGO;QACL,MAAMS,QAAQ,GAAG,KAAKd,qBAAL,CAA2BY,GAA3B,CAA+BF,UAA/B,CAAjB;QACAI,QAAQ,CAACD,SAAT,GAAqB,IAArB;QAEA,KAAKX,oBAAL,CAA0BqB,MAA1B,CAAiCb,UAAjC;MACD;IACF;;EAjFoD,CAAvD;EAoFAgB,MAAM,CAACC,sBAAP,GAAgC3B,qBAAhC;AACD,CAxFkD,CAA5C"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n MapperRegistry,\n ShareableRef,\n ShareableSyncDataHolderRef,\n} from './commonTypes';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport { LayoutAnimationStartFunction } from './layoutReanimation';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _REANIMATED_VERSION_CPP: string;\n const _frameTimestamp: number | null;\n const _eventTimestamp: number;\n const __reanimatedModuleProxy: NativeReanimated;\n const evalWithSourceMap: (\n js: string,\n sourceURL: string,\n sourceMap: string\n ) => any;\n const evalWithSourceUrl: (js: string, sourceURL: string) => any;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _getTimestamp: () => number;\n const _notifyAboutProgress: (tag: number, value: number) => void;\n const _notifyAboutEnd: (\n tag: number,\n finished: boolean,\n removeView: boolean\n ) => void;\n const _setGestureState: (handlerTag: number, newState: number) => void;\n const _makeShareableClone: (value: any) => any;\n const _updateDataSynchronously: (\n dataHolder: ShareableSyncDataHolderRef,\n data: ShareableRef\n ) => void;\n const _scheduleOnJS: (fun: ShareableRef, args?: ShareableRef) => void;\n const _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n const _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n const _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n const _measure: (viewTag: number) => MeasuredDimensions;\n const _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n const _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n const _chronoNow: () => number;\n const performance: { now: () => number };\n const ReanimatedDataMock: {\n now: () => number;\n };\n const ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n const _frameCallbackRegistry: FrameCallbackRegistryUI;\n const requestAnimationFrame: (callback: (time: number) => void) => number;\n const console: Console;\n\n namespace NodeJS {\n interface Global {\n _WORKLET: boolean;\n _IS_FABRIC: boolean;\n _REANIMATED_VERSION_CPP: string;\n _frameTimestamp: number | null;\n _eventTimestamp: number;\n __reanimatedModuleProxy: NativeReanimated;\n evalWithSourceMap: (\n js: string,\n sourceURL: string,\n sourceMap: string\n ) => any;\n evalWithSourceUrl: (js: string, sourceURL: string) => any;\n _log: (s: string) => void;\n _getCurrentTime: () => number;\n _getTimestamp: () => number;\n _setGestureState: (handlerTag: number, newState: number) => void;\n _makeShareableClone: (value: any) => any;\n _updateDataSynchronously: (\n ShareableSyncDataHolderRef,\n ShareableRef\n ) => void;\n _scheduleOnJS: (fun: ShareableRef, args?: ShareableRef) => void;\n _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n _measure: (viewTag: number) => MeasuredDimensions;\n _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n _chronoNow: () => number;\n performance: { now: () => number };\n LayoutAnimationsManager: {\n start: LayoutAnimationStartFunction;\n };\n ReanimatedDataMock: {\n now: () => number;\n };\n ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n _frameCallbackRegistry: FrameCallbackRegistryUI;\n __workletsCache?: Map<string, (...args: any[]) => any>;\n __handleCache?: WeakMap<any, any>;\n __mapperRegistry?: MapperRegistry;\n requestAnimationFrame: (callback: (time: number) => void) => number;\n console: Console;\n }\n }\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n MapperRegistry,\n ShareableRef,\n ShareableSyncDataHolderRef,\n} from './commonTypes';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport { LayoutAnimationStartFunction } from './layoutReanimation';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _REANIMATED_VERSION_CPP: string;\n const __reanimatedModuleProxy: NativeReanimated;\n const evalWithSourceMap: (\n js: string,\n sourceURL: string,\n sourceMap: string\n ) => any;\n const evalWithSourceUrl: (js: string, sourceURL: string) => any;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _notifyAboutProgress: (\n tag: number,\n value: number,\n isSharedTransition: boolean\n ) => void;\n const _notifyAboutEnd: (\n tag: number,\n finished: boolean,\n removeView: boolean\n ) => void;\n const _setGestureState: (handlerTag: number, newState: number) => void;\n const _makeShareableClone: (value: any) => any;\n const _updateDataSynchronously: (\n dataHolder: ShareableSyncDataHolderRef,\n data: ShareableRef\n ) => void;\n const _scheduleOnJS: (fun: ShareableRef, args?: ShareableRef) => void;\n const _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n const _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n const _removeShadowNodeFromRegistry: (viewTag: number) => void;\n const _measure: (viewTag: number) => MeasuredDimensions;\n const _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n const _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n const performance: { now: () => number };\n const ReanimatedDataMock: {\n now: () => number;\n };\n const ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n const _frameCallbackRegistry: FrameCallbackRegistryUI;\n const requestAnimationFrame: (callback: (time: number) => void) => number;\n const setImmediate: (callback: (time: number) => void) => number;\n const console: Console;\n\n namespace NodeJS {\n interface Global {\n _WORKLET: boolean;\n _IS_FABRIC: boolean;\n _REANIMATED_VERSION_CPP: string;\n __reanimatedModuleProxy: NativeReanimated;\n __frameTimestamp?: number;\n evalWithSourceMap: (\n js: string,\n sourceURL: string,\n sourceMap: string\n ) => any;\n evalWithSourceUrl: (js: string, sourceURL: string) => any;\n _log: (s: string) => void;\n _getCurrentTime: () => number;\n _setGestureState: (handlerTag: number, newState: number) => void;\n _makeShareableClone: (value: any) => any;\n _updateDataSynchronously: (\n ShareableSyncDataHolderRef,\n ShareableRef\n ) => void;\n _scheduleOnJS: (fun: ShareableRef, args?: ShareableRef) => void;\n _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n _removeShadowNodeFromRegistry: (viewTag: number) => void;\n _measure: (viewTag: number) => MeasuredDimensions;\n _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n performance: { now: () => number };\n LayoutAnimationsManager: {\n start: LayoutAnimationStartFunction;\n };\n ReanimatedDataMock: {\n now: () => number;\n };\n ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n _frameCallbackRegistry: FrameCallbackRegistryUI;\n __workletsCache?: Map<string, (...args: any[]) => any>;\n __handleCache?: WeakMap<any, any>;\n __mapperRegistry?: MapperRegistry;\n __flushImmediates: () => void;\n __flushAnimationFrame: (frameTimestamp: number) => void;\n requestAnimationFrame: (callback: (time: number) => void) => number;\n setImmediate: (callback: (time: number) => void) => number;\n console: Console;\n }\n }\n}\n"],"mappings":""}
@@ -6,7 +6,7 @@ export { useAnimatedReaction } from './useAnimatedReaction';
6
6
  export { useAnimatedRef } from './useAnimatedRef';
7
7
  export { useAnimatedScrollHandler } from './useAnimatedScrollHandler';
8
8
  export { useDerivedValue } from './useDerivedValue';
9
- export { useAnimatedSensor, SensorType } from './useAnimatedSensor';
9
+ export { useAnimatedSensor } from './useAnimatedSensor';
10
10
  export { useFrameCallback } from './useFrameCallback';
11
11
  export { useAnimatedKeyboard } from './useAnimatedKeyboard';
12
12
  export { useScrollViewOffset } from './useScrollViewOffset';
@@ -1 +1 @@
1
- {"version":3,"names":["useAnimatedProps","useEvent","useHandler","useWorkletCallback","useSharedValue","useAnimatedStyle","useAnimatedGestureHandler","useAnimatedReaction","useAnimatedRef","useAnimatedScrollHandler","useDerivedValue","useAnimatedSensor","SensorType","useFrameCallback","useAnimatedKeyboard","useScrollViewOffset"],"sources":["index.ts"],"sourcesContent":["export type { DependencyList } from './commonTypes';\nexport {\n useAnimatedProps,\n useEvent,\n useHandler,\n useWorkletCallback,\n} from './Hooks';\nexport { useSharedValue } from './useSharedValue';\nexport { useAnimatedStyle } from './useAnimatedStyle';\nexport type { AnimatedStyleResult } from './useAnimatedStyle';\nexport { useAnimatedGestureHandler } from './useAnimatedGestureHandler';\nexport type {\n GestureHandlerEvent,\n GestureHandlers,\n} from './useAnimatedGestureHandler';\nexport { useAnimatedReaction } from './useAnimatedReaction';\nexport type { AnimatedReactionWorkletFunction } from './useAnimatedReaction';\nexport { useAnimatedRef } from './useAnimatedRef';\nexport { useAnimatedScrollHandler } from './useAnimatedScrollHandler';\nexport type { ScrollHandler, ScrollHandlers } from './useAnimatedScrollHandler';\nexport { useDerivedValue } from './useDerivedValue';\nexport type { DerivedValue } from './useDerivedValue';\nexport { useAnimatedSensor, SensorType } from './useAnimatedSensor';\nexport { useFrameCallback } from './useFrameCallback';\nexport type { FrameCallback } from './useFrameCallback';\nexport { useAnimatedKeyboard } from './useAnimatedKeyboard';\nexport { useScrollViewOffset } from './useScrollViewOffset';\n"],"mappings":"AACA,SACEA,gBADF,EAEEC,QAFF,EAGEC,UAHF,EAIEC,kBAJF,QAKO,SALP;AAMA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA,SAASC,yBAAT,QAA0C,6BAA1C;AAKA,SAASC,mBAAT,QAAoC,uBAApC;AAEA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AAEA,SAASC,eAAT,QAAgC,mBAAhC;AAEA,SAASC,iBAAT,EAA4BC,UAA5B,QAA8C,qBAA9C;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,mBAAT,QAAoC,uBAApC"}
1
+ {"version":3,"names":["useAnimatedProps","useEvent","useHandler","useWorkletCallback","useSharedValue","useAnimatedStyle","useAnimatedGestureHandler","useAnimatedReaction","useAnimatedRef","useAnimatedScrollHandler","useDerivedValue","useAnimatedSensor","useFrameCallback","useAnimatedKeyboard","useScrollViewOffset"],"sources":["index.ts"],"sourcesContent":["export type { DependencyList } from './commonTypes';\nexport {\n useAnimatedProps,\n useEvent,\n useHandler,\n useWorkletCallback,\n} from './Hooks';\nexport { useSharedValue } from './useSharedValue';\nexport { useAnimatedStyle } from './useAnimatedStyle';\nexport type { AnimatedStyleResult } from './useAnimatedStyle';\nexport { useAnimatedGestureHandler } from './useAnimatedGestureHandler';\nexport type {\n GestureHandlerEvent,\n GestureHandlers,\n} from './useAnimatedGestureHandler';\nexport { useAnimatedReaction } from './useAnimatedReaction';\nexport type { AnimatedReactionWorkletFunction } from './useAnimatedReaction';\nexport { useAnimatedRef } from './useAnimatedRef';\nexport { useAnimatedScrollHandler } from './useAnimatedScrollHandler';\nexport type { ScrollHandler, ScrollHandlers } from './useAnimatedScrollHandler';\nexport { useDerivedValue } from './useDerivedValue';\nexport type { DerivedValue } from './useDerivedValue';\nexport { useAnimatedSensor } from './useAnimatedSensor';\nexport { useFrameCallback } from './useFrameCallback';\nexport type { FrameCallback } from './useFrameCallback';\nexport { useAnimatedKeyboard } from './useAnimatedKeyboard';\nexport { useScrollViewOffset } from './useScrollViewOffset';\n"],"mappings":"AACA,SACEA,gBADF,EAEEC,QAFF,EAGEC,UAHF,EAIEC,kBAJF,QAKO,SALP;AAMA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA,SAASC,yBAAT,QAA0C,6BAA1C;AAKA,SAASC,mBAAT,QAAoC,uBAApC;AAEA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AAEA,SAASC,eAAT,QAAgC,mBAAhC;AAEA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,mBAAT,QAAoC,uBAApC"}
@@ -2,6 +2,9 @@ import { useEffect, useRef } from 'react';
2
2
  import { makeMutable, subscribeForKeyboardEvents, unsubscribeFromKeyboardEvents } from '../core';
3
3
  import { KeyboardState } from '../commonTypes';
4
4
  export function useAnimatedKeyboard() {
5
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
6
+ isStatusBarTranslucentAndroid: false
7
+ };
5
8
  const ref = useRef(null);
6
9
  const listenerId = useRef(-1);
7
10
  const isSubscribed = useRef(false);
@@ -16,7 +19,7 @@ export function useAnimatedKeyboard() {
16
19
 
17
20
  keyboardEventData.state.value = state;
18
21
  keyboardEventData.height.value = height;
19
- });
22
+ }, options);
20
23
  ref.current = keyboardEventData;
21
24
  isSubscribed.current = true;
22
25
  }
@@ -30,7 +33,7 @@ export function useAnimatedKeyboard() {
30
33
 
31
34
  keyboardEventData.state.value = state;
32
35
  keyboardEventData.height.value = height;
33
- });
36
+ }, options);
34
37
  isSubscribed.current = true;
35
38
  }
36
39
 
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useRef","makeMutable","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","KeyboardState","useAnimatedKeyboard","ref","listenerId","isSubscribed","current","keyboardEventData","state","UNKNOWN","height","value"],"sources":["useAnimatedKeyboard.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n makeMutable,\n subscribeForKeyboardEvents,\n unsubscribeFromKeyboardEvents,\n} from '../core';\nimport { AnimatedKeyboardInfo, KeyboardState } from '../commonTypes';\n\nexport function useAnimatedKeyboard(): AnimatedKeyboardInfo {\n const ref = useRef<AnimatedKeyboardInfo | null>(null);\n const listenerId = useRef<number>(-1);\n const isSubscribed = useRef<boolean>(false);\n\n if (ref.current === null) {\n const keyboardEventData: AnimatedKeyboardInfo = {\n state: makeMutable<KeyboardState>(KeyboardState.UNKNOWN),\n height: makeMutable(0),\n };\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n });\n ref.current = keyboardEventData;\n isSubscribed.current = true;\n }\n useEffect(() => {\n if (isSubscribed.current === false && ref.current !== null) {\n const keyboardEventData = ref.current;\n // subscribe again after Fast Refresh\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n });\n isSubscribed.current = true;\n }\n return () => {\n unsubscribeFromKeyboardEvents(listenerId.current);\n isSubscribed.current = false;\n };\n }, []);\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,OAAlC;AACA,SACEC,WADF,EAEEC,0BAFF,EAGEC,6BAHF,QAIO,SAJP;AAKA,SAA+BC,aAA/B,QAAoD,gBAApD;AAEA,OAAO,SAASC,mBAAT,GAAqD;EAC1D,MAAMC,GAAG,GAAGN,MAAM,CAA8B,IAA9B,CAAlB;EACA,MAAMO,UAAU,GAAGP,MAAM,CAAS,CAAC,CAAV,CAAzB;EACA,MAAMQ,YAAY,GAAGR,MAAM,CAAU,KAAV,CAA3B;;EAEA,IAAIM,GAAG,CAACG,OAAJ,KAAgB,IAApB,EAA0B;IACxB,MAAMC,iBAAuC,GAAG;MAC9CC,KAAK,EAAEV,WAAW,CAAgBG,aAAa,CAACQ,OAA9B,CAD4B;MAE9CC,MAAM,EAAEZ,WAAW,CAAC,CAAD;IAF2B,CAAhD;IAIAM,UAAU,CAACE,OAAX,GAAqBP,0BAA0B,CAAC,CAACS,KAAD,EAAQE,MAAR,KAAmB;MACjE;;MACAH,iBAAiB,CAACC,KAAlB,CAAwBG,KAAxB,GAAgCH,KAAhC;MACAD,iBAAiB,CAACG,MAAlB,CAAyBC,KAAzB,GAAiCD,MAAjC;IACD,CAJ8C,CAA/C;IAKAP,GAAG,CAACG,OAAJ,GAAcC,iBAAd;IACAF,YAAY,CAACC,OAAb,GAAuB,IAAvB;EACD;;EACDV,SAAS,CAAC,MAAM;IACd,IAAIS,YAAY,CAACC,OAAb,KAAyB,KAAzB,IAAkCH,GAAG,CAACG,OAAJ,KAAgB,IAAtD,EAA4D;MAC1D,MAAMC,iBAAiB,GAAGJ,GAAG,CAACG,OAA9B,CAD0D,CAE1D;;MACAF,UAAU,CAACE,OAAX,GAAqBP,0BAA0B,CAAC,CAACS,KAAD,EAAQE,MAAR,KAAmB;QACjE;;QACAH,iBAAiB,CAACC,KAAlB,CAAwBG,KAAxB,GAAgCH,KAAhC;QACAD,iBAAiB,CAACG,MAAlB,CAAyBC,KAAzB,GAAiCD,MAAjC;MACD,CAJ8C,CAA/C;MAKAL,YAAY,CAACC,OAAb,GAAuB,IAAvB;IACD;;IACD,OAAO,MAAM;MACXN,6BAA6B,CAACI,UAAU,CAACE,OAAZ,CAA7B;MACAD,YAAY,CAACC,OAAb,GAAuB,KAAvB;IACD,CAHD;EAID,CAfQ,EAeN,EAfM,CAAT;EAgBA,OAAOH,GAAG,CAACG,OAAX;AACD"}
1
+ {"version":3,"names":["useEffect","useRef","makeMutable","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","KeyboardState","useAnimatedKeyboard","options","isStatusBarTranslucentAndroid","ref","listenerId","isSubscribed","current","keyboardEventData","state","UNKNOWN","height","value"],"sources":["useAnimatedKeyboard.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport {\n makeMutable,\n subscribeForKeyboardEvents,\n unsubscribeFromKeyboardEvents,\n} from '../core';\nimport {\n AnimatedKeyboardInfo,\n AnimatedKeyboardOptions,\n KeyboardState,\n} from '../commonTypes';\n\nexport function useAnimatedKeyboard(\n options: AnimatedKeyboardOptions = { isStatusBarTranslucentAndroid: false }\n): AnimatedKeyboardInfo {\n const ref = useRef<AnimatedKeyboardInfo | null>(null);\n const listenerId = useRef<number>(-1);\n const isSubscribed = useRef<boolean>(false);\n\n if (ref.current === null) {\n const keyboardEventData: AnimatedKeyboardInfo = {\n state: makeMutable<KeyboardState>(KeyboardState.UNKNOWN),\n height: makeMutable(0),\n };\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n }, options);\n ref.current = keyboardEventData;\n isSubscribed.current = true;\n }\n useEffect(() => {\n if (isSubscribed.current === false && ref.current !== null) {\n const keyboardEventData = ref.current;\n // subscribe again after Fast Refresh\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n }, options);\n isSubscribed.current = true;\n }\n return () => {\n unsubscribeFromKeyboardEvents(listenerId.current);\n isSubscribed.current = false;\n };\n }, []);\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,OAAlC;AACA,SACEC,WADF,EAEEC,0BAFF,EAGEC,6BAHF,QAIO,SAJP;AAKA,SAGEC,aAHF,QAIO,gBAJP;AAMA,OAAO,SAASC,mBAAT,GAEiB;EAAA,IADtBC,OACsB,uEADa;IAAEC,6BAA6B,EAAE;EAAjC,CACb;EACtB,MAAMC,GAAG,GAAGR,MAAM,CAA8B,IAA9B,CAAlB;EACA,MAAMS,UAAU,GAAGT,MAAM,CAAS,CAAC,CAAV,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