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,6 +1,9 @@
1
1
  import { SharedValue } from './commonTypes';
2
+ import { isJest } from './PlatformChecker';
2
3
  import { runOnUI } from './threads';
3
4
 
5
+ const IS_JEST = isJest();
6
+
4
7
  export type Mapper = {
5
8
  id: number;
6
9
  dirty: boolean;
@@ -14,7 +17,7 @@ export function createMapperRegistry() {
14
17
  const mappers = new Map();
15
18
  let sortedMappers: Mapper[] = [];
16
19
 
17
- let frameRequested = false;
20
+ let runRequested = false;
18
21
 
19
22
  function updateMappersOrder() {
20
23
  // sort mappers topologically
@@ -74,8 +77,8 @@ export function createMapperRegistry() {
74
77
  sortedMappers = newOrder;
75
78
  }
76
79
 
77
- function mapperFrame() {
78
- frameRequested = false;
80
+ function mapperRun() {
81
+ runRequested = false;
79
82
  if (mappers.size !== sortedMappers.length) {
80
83
  updateMappersOrder();
81
84
  }
@@ -88,9 +91,17 @@ export function createMapperRegistry() {
88
91
  }
89
92
 
90
93
  function maybeRequestUpdates() {
91
- if (!frameRequested) {
92
- requestAnimationFrame(mapperFrame);
93
- frameRequested = true;
94
+ if (IS_JEST) {
95
+ // On Jest environment we avoid using setImmediate as that'd require test
96
+ // to advance the clock manually. This on other hand would require tests
97
+ // to know how many times mappers need to run. As we don't want tests to
98
+ // make any assumptions on that number it is easier to execute mappers
99
+ // immediately for testing purposes and only expect test to advance timers
100
+ // if they want to make any assertions on the effects of animations being run.
101
+ mapperRun();
102
+ } else if (!runRequested) {
103
+ setImmediate(mapperRun);
104
+ runRequested = true;
94
105
  }
95
106
  }
96
107
 
@@ -16,7 +16,19 @@ class BaseAnimationMock {
16
16
  return this;
17
17
  }
18
18
 
19
- withCallback(_: (finsihed: boolean) => void) {
19
+ springify(_: number) {
20
+ return this;
21
+ }
22
+
23
+ damping(_: number) {
24
+ return this;
25
+ }
26
+
27
+ stiffness(_: number) {
28
+ return this;
29
+ }
30
+
31
+ withCallback(_: (finished: boolean) => void) {
20
32
  return this;
21
33
  }
22
34
 
@@ -27,6 +39,10 @@ class BaseAnimationMock {
27
39
  withInitialValues() {
28
40
  return this;
29
41
  }
42
+
43
+ build() {
44
+ return () => ({ initialValues: {}, animations: {} });
45
+ }
30
46
  }
31
47
 
32
48
  const ReanimatedV2 = {
@@ -102,7 +118,7 @@ const ReanimatedV2 = {
102
118
  'FadeInRight',
103
119
  'FadeInLeft',
104
120
  'FadeInUp',
105
- 'FadFadeInDown',
121
+ 'FadeInDown',
106
122
  'FadeOut',
107
123
  'FadeOutRight',
108
124
  'FadeOutLeft',
@@ -174,6 +190,13 @@ const ReanimatedV2 = {
174
190
  'RollInRight',
175
191
  'RollOutLeft',
176
192
  'RollOutRight',
193
+
194
+ 'Layout',
195
+ 'CurvedTransition',
196
+ 'JumpingTransition',
197
+ 'SequencedTransition',
198
+ 'FadingTransition',
199
+ 'EntryExitTransition',
177
200
  ].forEach((k) =>
178
201
  Object.assign(ReanimatedV2, {
179
202
  [k]: new BaseAnimationMock(),
@@ -53,6 +53,7 @@ export function makeUIMutable<T>(
53
53
  listeners.delete(id);
54
54
  },
55
55
  _animation: null,
56
+ _isReanimatedSharedValue: true,
56
57
  };
57
58
  return self;
58
59
  }
@@ -134,6 +135,7 @@ export function makeMutable<T>(
134
135
  }
135
136
  listeners!.delete(id);
136
137
  },
138
+ _isReanimatedSharedValue: true,
137
139
  };
138
140
  registerShareableMapping(mutable, handle);
139
141
  return mutable;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * We hardcode the version of Reanimated here in order to compare it
3
+ * with the version used to build the native part of the library in runtime.
4
+ * Remember to keep this in sync with the version declared in `package.json`
5
+ */
6
+ const jsVersion = '3.0.1';
7
+
8
+ /**
9
+ * Checks that native and js versions of reanimated match.
10
+ */
11
+ export function checkVersion(): void {
12
+ const cppVersion = global._REANIMATED_VERSION_CPP;
13
+ if (cppVersion === undefined) {
14
+ console.error(
15
+ `[Reanimated] Couldn't determine the version of the native part of Reanimated. Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must use the exact version which is bundled into Expo SDK.`
16
+ );
17
+ return;
18
+ }
19
+ const ok = (() => {
20
+ if (
21
+ jsVersion.match(/^\d+\.\d+\.\d+$/) &&
22
+ cppVersion.match(/^\d+\.\d+\.\d+$/)
23
+ ) {
24
+ // x.y.z, compare only major and minor, skip patch
25
+ const [jsMajor, jsMinor] = jsVersion.split('.');
26
+ const [cppMajor, cppMinor] = cppVersion.split('.');
27
+ return jsMajor === cppMajor && jsMinor === cppMinor;
28
+ } else {
29
+ // alpha, beta or rc, compare everything
30
+ return jsVersion === cppVersion;
31
+ }
32
+ })();
33
+ if (!ok) {
34
+ console.error(
35
+ `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`
36
+ );
37
+ // TODO: detect Expo managed workflow
38
+ }
39
+ }
@@ -0,0 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/no-empty-function */
2
+ /**
3
+ * Checks that native and js versions of reanimated match.
4
+ * Stubbed for web, where this check is unnecessary.
5
+ */
6
+ export function checkVersion(): void {}
@@ -0,0 +1,8 @@
1
+ export function getUseOfValueInStyleWarning() {
2
+ return (
3
+ "It looks like you might be using shared value's .value inside reanimated inline style. " +
4
+ 'If you want a component to update when shared value changes you should use the shared value' +
5
+ ' directly instead of its current state represented by `.value`. See documentation here: ' +
6
+ 'https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/animations#animations-in-inline-styles'
7
+ );
8
+ }
@@ -17,6 +17,16 @@ const _shareableCache = new WeakMap<
17
17
  // this is used to allow for a converted shareable to be passed to makeShareableClone
18
18
  const _shareableFlag = Symbol('shareable flag');
19
19
 
20
+ const MAGIC_KEY = 'REANIMATED_MAGIC_KEY';
21
+
22
+ function isHostObject(value: any): boolean {
23
+ // We could use JSI to determine whether an object is a host object, however
24
+ // the below workaround works well and is way faster than an additional JSI call.
25
+ // We use the fact that host objects have broken implementation of `hasOwnProperty`
26
+ // and hence return true for all `in` checks regardless of the key we ask for.
27
+ return MAGIC_KEY in value;
28
+ }
29
+
20
30
  export function registerShareableMapping(
21
31
  shareable: any,
22
32
  shareableRef?: ShareableRef<any>
@@ -27,14 +37,10 @@ export function registerShareableMapping(
27
37
  _shareableCache.set(shareable, shareableRef || _shareableFlag);
28
38
  }
29
39
 
30
- export function makeShareableShadowNodeWrapper<T>(shadowNodeWrapper: T): T {
31
- const adoptedSNW =
32
- NativeReanimatedModule.makeShareableClone(shadowNodeWrapper);
33
- registerShareableMapping(shadowNodeWrapper, adoptedSNW);
34
- return shadowNodeWrapper;
35
- }
36
-
37
- export function makeShareableCloneRecursive<T>(value: any): ShareableRef<T> {
40
+ export function makeShareableCloneRecursive<T>(
41
+ value: any,
42
+ shouldPersistRemote = false
43
+ ): ShareableRef<T> {
38
44
  if (USE_STUB_IMPLEMENTATION) {
39
45
  return value;
40
46
  }
@@ -53,14 +59,34 @@ export function makeShareableCloneRecursive<T>(value: any): ShareableRef<T> {
53
59
  } else if (type === 'function' && value.__workletHash === undefined) {
54
60
  // this is a remote function
55
61
  toAdapt = value;
62
+ } else if (isHostObject(value)) {
63
+ // for host objects we pass the reference to the object as shareable and
64
+ // then recreate new host object wrapping the same instance on the UI thread.
65
+ // there is no point of iterating over keys as we do for regular objects.
66
+ toAdapt = value;
56
67
  } else {
57
- if (__DEV__ && value.__workletHash !== undefined) {
58
- registerWorkletStackDetails(
59
- value.__workletHash,
60
- value.__stackDetails
68
+ toAdapt = {};
69
+ if (value.__workletHash !== undefined) {
70
+ // we are converting a worklet
71
+ if (__DEV__) {
72
+ registerWorkletStackDetails(
73
+ value.__workletHash,
74
+ value.__stackDetails
75
+ );
76
+ delete value.__stackDetails;
77
+ }
78
+ // to save on transferring static __initData field of worklet structure
79
+ // we request shareable value to persist its UI counterpart. This means
80
+ // that the __initData field that contains long strings represeting the
81
+ // worklet code, source map, and location, will always be
82
+ // serialized/deserialized once.
83
+ toAdapt.__initData = makeShareableCloneRecursive(
84
+ value.__initData,
85
+ true
61
86
  );
87
+ delete value.__initData;
62
88
  }
63
- toAdapt = {};
89
+
64
90
  for (const [key, element] of Object.entries(value)) {
65
91
  toAdapt[key] = makeShareableCloneRecursive(element);
66
92
  }
@@ -71,16 +97,19 @@ export function makeShareableCloneRecursive<T>(value: any): ShareableRef<T> {
71
97
  // shareable. Meaning that they may be doing a faulty assumption in their
72
98
  // code expecting that the updates are going to automatically populate to
73
99
  // the object sent to the UI thread. If the user really wants some objects
74
- // to be mutable they should use share values instead.
100
+ // to be mutable they should use shared values instead.
75
101
  Object.freeze(value);
76
102
  }
77
- const adopted = NativeReanimatedModule.makeShareableClone(toAdapt);
103
+ const adopted = NativeReanimatedModule.makeShareableClone(
104
+ toAdapt,
105
+ shouldPersistRemote
106
+ );
78
107
  _shareableCache.set(value, adopted);
79
108
  _shareableCache.set(adopted, _shareableFlag);
80
109
  return adopted;
81
110
  }
82
111
  }
83
- return NativeReanimatedModule.makeShareableClone(value);
112
+ return NativeReanimatedModule.makeShareableClone(value, shouldPersistRemote);
84
113
  }
85
114
 
86
115
  export function makeShareableCloneOnUIRecursive<T>(value: T): ShareableRef<T> {
@@ -1,28 +1,127 @@
1
1
  import NativeReanimatedModule from './NativeReanimated';
2
+ import { isJest, shouldBeUseWeb } from './PlatformChecker';
2
3
  import { ComplexWorkletFunction } from './commonTypes';
3
4
  import {
4
5
  makeShareableCloneOnUIRecursive,
5
6
  makeShareableCloneRecursive,
6
7
  } from './shareables';
7
8
 
9
+ const IS_JEST = isJest();
10
+ const IS_WEB = shouldBeUseWeb();
11
+
12
+ let _runOnUIQueue: Array<[ComplexWorkletFunction<any[], any>, any[]]> = [];
13
+
14
+ export function setupSetImmediate() {
15
+ 'worklet';
16
+
17
+ let immediateCallbacks: Array<() => void> = [];
18
+
19
+ // @ts-ignore – typescript expects this to conform to NodeJS definition and expects the return value to be NodeJS.Immediate which is an object and not a number
20
+ global.setImmediate = (callback: () => void): number => {
21
+ immediateCallbacks.push(callback);
22
+ return -1;
23
+ };
24
+
25
+ global.__flushImmediates = () => {
26
+ for (let index = 0; index < immediateCallbacks.length; index += 1) {
27
+ // we use classic 'for' loop because the size of the currentTasks array may change while executing some of the callbacks due to setImmediate calls
28
+ immediateCallbacks[index]();
29
+ }
30
+ immediateCallbacks = [];
31
+ };
32
+ }
33
+
34
+ function flushImmediatesOnUIThread() {
35
+ 'worklet';
36
+ global.__flushImmediates();
37
+ }
38
+
39
+ export const flushImmediates = shouldBeUseWeb()
40
+ ? () => {
41
+ // on web flushing is a noop as immediates are handled by the browser
42
+ }
43
+ : flushImmediatesOnUIThread;
44
+
45
+ /**
46
+ * Schedule a worklet to execute on the UI runtime. This method does not schedule the work immediately but instead
47
+ * waits for other worklets to be scheduled within the same JS loop. It uses setImmediate to schedule all the worklets
48
+ * at once making sure they will run within the same frame boundaries on the UI thread.
49
+ */
8
50
  export function runOnUI<A extends any[], R>(
9
51
  worklet: ComplexWorkletFunction<A, R>
10
52
  ): (...args: A) => void {
11
- if (__DEV__) {
12
- if (worklet.__workletHash === undefined) {
13
- throw new Error('runOnUI() can only be used on worklets');
53
+ if (__DEV__ && !IS_WEB && worklet.__workletHash === undefined) {
54
+ throw new Error('runOnUI() can only be used on worklets');
55
+ }
56
+ return (...args) => {
57
+ if (IS_JEST) {
58
+ // Mocking time in Jest is tricky as both requestAnimationFrame and setImmediate
59
+ // callbacks run on the same queue and can be interleaved. There is no way
60
+ // to flush particular queue in Jest and the only control over mocked timers
61
+ // is by using jest.advanceTimersByTime() method which advances all types
62
+ // of timers including immediate and animation callbacks. Ideally we'd like
63
+ // to have some way here to schedule work along with React updates, but
64
+ // that's not possible, and hence in Jest environment instead of using scheduling
65
+ // mechanism we just schedule the work ommiting the queue. This is ok for the
66
+ // uses that we currently have but may not be ok for future tests that we write.
67
+ NativeReanimatedModule.scheduleOnUI(
68
+ makeShareableCloneRecursive(() => {
69
+ 'worklet';
70
+ worklet(...args);
71
+ })
72
+ );
73
+ return;
14
74
  }
75
+ _runOnUIQueue.push([worklet, args]);
76
+ if (_runOnUIQueue.length === 1) {
77
+ setImmediate(() => {
78
+ const queue = _runOnUIQueue;
79
+ _runOnUIQueue = [];
80
+ NativeReanimatedModule.scheduleOnUI(
81
+ makeShareableCloneRecursive(() => {
82
+ 'worklet';
83
+ queue.forEach(([worklet, args]) => {
84
+ worklet(...args);
85
+ });
86
+ flushImmediates();
87
+ })
88
+ );
89
+ });
90
+ }
91
+ };
92
+ }
93
+
94
+ /**
95
+ * Schedule a worklet to execute on the UI runtime skipping batching mechanism.
96
+ */
97
+ export function runOnUIImmediately<A extends any[], R>(
98
+ worklet: ComplexWorkletFunction<A, R>
99
+ ): (...args: A) => void {
100
+ if (__DEV__ && !IS_WEB && worklet.__workletHash === undefined) {
101
+ throw new Error('runOnUI() can only be used on worklets');
15
102
  }
16
103
  return (...args) => {
17
104
  NativeReanimatedModule.scheduleOnUI(
18
105
  makeShareableCloneRecursive(() => {
19
106
  'worklet';
20
- return worklet(...args);
107
+ worklet(...args);
21
108
  })
22
109
  );
23
110
  };
24
111
  }
25
112
 
113
+ if (__DEV__) {
114
+ try {
115
+ runOnUI(() => {
116
+ 'worklet';
117
+ });
118
+ } catch (e) {
119
+ throw new Error(
120
+ 'Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js? See installation docs at https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation#babel-plugin.'
121
+ );
122
+ }
123
+ }
124
+
26
125
  export function runOnJS<A extends any[], R>(
27
126
  fun: ComplexWorkletFunction<A, R>
28
127
  ): (...args: A) => void {
@@ -1,6 +1,7 @@
1
1
  import { Component } from 'react';
2
2
  import { measure } from './NativeMethods';
3
3
  import { RefObjectFunction } from './hook/commonTypes';
4
+ import { SharedValue } from './commonTypes';
4
5
 
5
6
  export interface ComponentCoords {
6
7
  x: number;
@@ -26,3 +27,8 @@ export function getRelativeCoords(
26
27
  y: absoluteY - parentCoords.y,
27
28
  };
28
29
  }
30
+
31
+ export function isSharedValue<T>(value: any): value is SharedValue<T> {
32
+ 'worklet';
33
+ return value?._isReanimatedSharedValue === true;
34
+ }
@@ -1,6 +1,5 @@
1
1
  import { AnimationObject, AnimatableValue } from './commonTypes';
2
2
  import { Descriptor } from './hook/commonTypes';
3
- import { getTimestamp } from './time';
4
3
  export { stopMapper } from './mappers';
5
4
 
6
5
  export function valueSetter(sv: any, value: any): void {
@@ -32,7 +31,7 @@ export function valueSetter(sv: any, value: any): void {
32
31
  const initializeAnimation = (timestamp: number) => {
33
32
  animation.onStart(animation, sv.value, timestamp, previousAnimation);
34
33
  };
35
- const currentTimestamp = getTimestamp();
34
+ const currentTimestamp = global.__frameTimestamp || performance.now();
36
35
  initializeAnimation(currentTimestamp);
37
36
  const step = (timestamp: number) => {
38
37
  if (animation.cancelled) {
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTimestamp = getTimestamp;
7
- Object.defineProperty(exports, "stopMapper", {
8
- enumerable: true,
9
- get: function () {
10
- return _mappers.stopMapper;
11
- }
12
- });
13
-
14
- var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
15
-
16
- var _reactNative = require("react-native");
17
-
18
- var _PlatformChecker = require("./PlatformChecker");
19
-
20
- var _mappers = require("./mappers");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- let _getTimestamp;
25
-
26
- if ((0, _PlatformChecker.nativeShouldBeMock)()) {
27
- _getTimestamp = () => {
28
- return _NativeReanimated.default.getTimestamp();
29
- };
30
- } else {
31
- _getTimestamp = () => {
32
- 'worklet';
33
-
34
- if (_frameTimestamp) {
35
- return _frameTimestamp;
36
- }
37
-
38
- if (_eventTimestamp) {
39
- return _eventTimestamp;
40
- }
41
-
42
- return _getCurrentTime();
43
- };
44
- }
45
-
46
- function getTimestamp() {
47
- 'worklet';
48
-
49
- if (_reactNative.Platform.OS === 'web') {
50
- return _NativeReanimated.default.getTimestamp();
51
- }
52
-
53
- return _getTimestamp();
54
- }
55
- //# sourceMappingURL=time.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_getTimestamp","nativeShouldBeMock","NativeReanimatedModule","getTimestamp","_frameTimestamp","_eventTimestamp","_getCurrentTime","Platform","OS"],"sources":["time.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { Platform } from 'react-native';\nimport { nativeShouldBeMock } from './PlatformChecker';\nexport { stopMapper } from './mappers';\n\nlet _getTimestamp: () => number;\nif (nativeShouldBeMock()) {\n _getTimestamp = () => {\n return NativeReanimatedModule.getTimestamp();\n };\n} else {\n _getTimestamp = () => {\n 'worklet';\n if (_frameTimestamp) {\n return _frameTimestamp;\n }\n if (_eventTimestamp) {\n return _eventTimestamp;\n }\n return _getCurrentTime();\n };\n}\n\nexport function getTimestamp(): number {\n 'worklet';\n if (Platform.OS === 'web') {\n return NativeReanimatedModule.getTimestamp();\n }\n return _getTimestamp();\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,IAAIA,aAAJ;;AACA,IAAI,IAAAC,mCAAA,GAAJ,EAA0B;EACxBD,aAAa,GAAG,MAAM;IACpB,OAAOE,yBAAA,CAAuBC,YAAvB,EAAP;EACD,CAFD;AAGD,CAJD,MAIO;EACLH,aAAa,GAAG,MAAM;IACpB;;IACA,IAAII,eAAJ,EAAqB;MACnB,OAAOA,eAAP;IACD;;IACD,IAAIC,eAAJ,EAAqB;MACnB,OAAOA,eAAP;IACD;;IACD,OAAOC,eAAe,EAAtB;EACD,CATD;AAUD;;AAEM,SAASH,YAAT,GAAgC;EACrC;;EACA,IAAII,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;IACzB,OAAON,yBAAA,CAAuBC,YAAvB,EAAP;EACD;;EACD,OAAOH,aAAa,EAApB;AACD"}
@@ -1,37 +0,0 @@
1
- import NativeReanimatedModule from './NativeReanimated';
2
- import { Platform } from 'react-native';
3
- import { nativeShouldBeMock } from './PlatformChecker';
4
- export { stopMapper } from './mappers';
5
-
6
- let _getTimestamp;
7
-
8
- if (nativeShouldBeMock()) {
9
- _getTimestamp = () => {
10
- return NativeReanimatedModule.getTimestamp();
11
- };
12
- } else {
13
- _getTimestamp = () => {
14
- 'worklet';
15
-
16
- if (_frameTimestamp) {
17
- return _frameTimestamp;
18
- }
19
-
20
- if (_eventTimestamp) {
21
- return _eventTimestamp;
22
- }
23
-
24
- return _getCurrentTime();
25
- };
26
- }
27
-
28
- export function getTimestamp() {
29
- 'worklet';
30
-
31
- if (Platform.OS === 'web') {
32
- return NativeReanimatedModule.getTimestamp();
33
- }
34
-
35
- return _getTimestamp();
36
- }
37
- //# sourceMappingURL=time.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeReanimatedModule","Platform","nativeShouldBeMock","stopMapper","_getTimestamp","getTimestamp","_frameTimestamp","_eventTimestamp","_getCurrentTime","OS"],"sources":["time.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { Platform } from 'react-native';\nimport { nativeShouldBeMock } from './PlatformChecker';\nexport { stopMapper } from './mappers';\n\nlet _getTimestamp: () => number;\nif (nativeShouldBeMock()) {\n _getTimestamp = () => {\n return NativeReanimatedModule.getTimestamp();\n };\n} else {\n _getTimestamp = () => {\n 'worklet';\n if (_frameTimestamp) {\n return _frameTimestamp;\n }\n if (_eventTimestamp) {\n return _eventTimestamp;\n }\n return _getCurrentTime();\n };\n}\n\nexport function getTimestamp(): number {\n 'worklet';\n if (Platform.OS === 'web') {\n return NativeReanimatedModule.getTimestamp();\n }\n return _getTimestamp();\n}\n"],"mappings":"AAAA,OAAOA,sBAAP,MAAmC,oBAAnC;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,kBAAT,QAAmC,mBAAnC;AACA,SAASC,UAAT,QAA2B,WAA3B;;AAEA,IAAIC,aAAJ;;AACA,IAAIF,kBAAkB,EAAtB,EAA0B;EACxBE,aAAa,GAAG,MAAM;IACpB,OAAOJ,sBAAsB,CAACK,YAAvB,EAAP;EACD,CAFD;AAGD,CAJD,MAIO;EACLD,aAAa,GAAG,MAAM;IACpB;;IACA,IAAIE,eAAJ,EAAqB;MACnB,OAAOA,eAAP;IACD;;IACD,IAAIC,eAAJ,EAAqB;MACnB,OAAOA,eAAP;IACD;;IACD,OAAOC,eAAe,EAAtB;EACD,CATD;AAUD;;AAED,OAAO,SAASH,YAAT,GAAgC;EACrC;;EACA,IAAIJ,QAAQ,CAACQ,EAAT,KAAgB,KAApB,EAA2B;IACzB,OAAOT,sBAAsB,CAACK,YAAvB,EAAP;EACD;;EACD,OAAOD,aAAa,EAApB;AACD"}
@@ -1,30 +0,0 @@
1
- import NativeReanimatedModule from './NativeReanimated';
2
- import { Platform } from 'react-native';
3
- import { nativeShouldBeMock } from './PlatformChecker';
4
- export { stopMapper } from './mappers';
5
-
6
- let _getTimestamp: () => number;
7
- if (nativeShouldBeMock()) {
8
- _getTimestamp = () => {
9
- return NativeReanimatedModule.getTimestamp();
10
- };
11
- } else {
12
- _getTimestamp = () => {
13
- 'worklet';
14
- if (_frameTimestamp) {
15
- return _frameTimestamp;
16
- }
17
- if (_eventTimestamp) {
18
- return _eventTimestamp;
19
- }
20
- return _getCurrentTime();
21
- };
22
- }
23
-
24
- export function getTimestamp(): number {
25
- 'worklet';
26
- if (Platform.OS === 'web') {
27
- return NativeReanimatedModule.getTimestamp();
28
- }
29
- return _getTimestamp();
30
- }