react-native-reanimated 3.0.0-rc.8 → 3.0.0

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 (339) 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 +122 -121
  10. package/Common/cpp/NativeModules/NativeReanimatedModule.h +21 -14
  11. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
  12. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +8 -4
  13. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +50 -1
  14. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +10 -1
  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 +11 -63
  19. package/Common/cpp/SharedItems/Shareables.h +113 -93
  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 +67 -247
  27. package/Common/cpp/Tools/RuntimeDecorator.h +2 -3
  28. package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
  29. package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
  30. package/RNReanimated.podspec +2 -1
  31. package/android/CMakeLists.txt +188 -181
  32. package/android/build.gradle +362 -311
  33. package/android/proguard-rules.pro +2 -0
  34. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
  35. package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
  36. package/android/src/main/cpp/LayoutAnimations.h +23 -6
  37. package/android/src/main/cpp/NativeProxy.cpp +143 -98
  38. package/android/src/main/cpp/NativeProxy.h +22 -28
  39. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
  40. package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
  41. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
  42. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
  43. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
  44. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
  45. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
  46. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
  47. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
  48. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
  49. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
  50. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
  51. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
  52. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
  53. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
  54. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
  55. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
  56. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
  57. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
  58. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
  59. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
  60. package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
  61. package/ios/LayoutReanimation/REAAnimationsManager.h +31 -5
  62. package/ios/LayoutReanimation/REAAnimationsManager.m +265 -77
  63. package/ios/LayoutReanimation/REAFrame.h +10 -0
  64. package/ios/LayoutReanimation/REAFrame.m +15 -0
  65. package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
  66. package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
  67. package/ios/LayoutReanimation/REASharedElement.h +15 -0
  68. package/ios/LayoutReanimation/REASharedElement.m +16 -0
  69. package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
  70. package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
  71. package/ios/LayoutReanimation/REASnapshot.h +1 -0
  72. package/ios/LayoutReanimation/REASnapshot.m +96 -11
  73. package/ios/LayoutReanimation/REAUIManager.mm +67 -60
  74. package/ios/REAModule.mm +2 -7
  75. package/ios/REANodesManager.mm +1 -21
  76. package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
  77. package/ios/native/NativeProxy.mm +75 -114
  78. package/ios/native/REAInitializer.mm +2 -7
  79. package/ios/native/REAJSIUtils.h +60 -2
  80. package/ios/sensor/ReanimatedSensor.h +6 -2
  81. package/ios/sensor/ReanimatedSensor.m +43 -7
  82. package/ios/sensor/ReanimatedSensorContainer.h +4 -1
  83. package/ios/sensor/ReanimatedSensorContainer.m +8 -2
  84. package/lib/commonjs/createAnimatedComponent.js +232 -28
  85. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  86. package/lib/commonjs/reanimated2/Colors.js +43 -22
  87. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  88. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +18 -35
  89. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  90. package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
  91. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  92. package/lib/commonjs/reanimated2/animation/util.js +17 -15
  93. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  94. package/lib/commonjs/reanimated2/commonTypes.js +33 -1
  95. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  96. package/lib/commonjs/reanimated2/component/FlatList.js +19 -3
  97. package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
  98. package/lib/commonjs/reanimated2/core.js +34 -83
  99. package/lib/commonjs/reanimated2/core.js.map +1 -1
  100. package/lib/commonjs/reanimated2/errors.js +66 -0
  101. package/lib/commonjs/reanimated2/errors.js.map +1 -0
  102. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  103. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  104. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  105. package/lib/commonjs/reanimated2/hook/index.js +0 -6
  106. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  107. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  108. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  109. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  111. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  113. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +89 -16
  114. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  115. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -50
  116. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  117. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
  118. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  119. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
  120. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  121. package/lib/commonjs/reanimated2/hook/utils.js +18 -65
  122. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  123. package/lib/commonjs/reanimated2/index.js +13 -0
  124. package/lib/commonjs/reanimated2/index.js.map +1 -1
  125. package/lib/commonjs/reanimated2/initializers.js +196 -0
  126. package/lib/commonjs/reanimated2/initializers.js.map +1 -0
  127. package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
  128. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  129. package/lib/commonjs/reanimated2/jestUtils.js +1 -1
  130. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  131. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +101 -16
  132. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  133. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
  134. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  135. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
  136. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  137. package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  138. package/lib/commonjs/reanimated2/js-reanimated/global.js +4 -9
  139. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  140. package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
  141. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  142. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
  143. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  144. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
  145. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  146. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +16 -12
  147. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  148. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
  149. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  150. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
  151. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  152. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
  153. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  154. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
  155. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  156. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
  157. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  158. package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
  159. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  160. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
  161. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  162. package/lib/commonjs/reanimated2/mappers.js +18 -6
  163. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  164. package/lib/commonjs/reanimated2/mock.js +45 -0
  165. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  166. package/lib/commonjs/reanimated2/mutables.js +4 -2
  167. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  168. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -0
  169. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
  170. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
  171. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  172. package/lib/commonjs/reanimated2/pluginUtils.js +11 -0
  173. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
  174. package/lib/commonjs/reanimated2/shareables.js +38 -11
  175. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  176. package/lib/commonjs/reanimated2/threads.js +114 -4
  177. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  178. package/lib/commonjs/reanimated2/utils.js +7 -0
  179. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  180. package/lib/commonjs/reanimated2/valueSetter.js +1 -3
  181. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  182. package/lib/module/createAnimatedComponent.js +229 -29
  183. package/lib/module/createAnimatedComponent.js.map +1 -1
  184. package/lib/module/reanimated2/Colors.js +35 -19
  185. package/lib/module/reanimated2/Colors.js.map +1 -1
  186. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +18 -34
  187. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  188. package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
  189. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  190. package/lib/module/reanimated2/animation/util.js +17 -16
  191. package/lib/module/reanimated2/animation/util.js.map +1 -1
  192. package/lib/module/reanimated2/commonTypes.js +29 -0
  193. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  194. package/lib/module/reanimated2/component/FlatList.js +18 -4
  195. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  196. package/lib/module/reanimated2/core.js +30 -76
  197. package/lib/module/reanimated2/core.js.map +1 -1
  198. package/lib/module/reanimated2/errors.js +58 -0
  199. package/lib/module/reanimated2/errors.js.map +1 -0
  200. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  201. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  202. package/lib/module/reanimated2/globals.d.js.map +1 -1
  203. package/lib/module/reanimated2/hook/index.js +1 -1
  204. package/lib/module/reanimated2/hook/index.js.map +1 -1
  205. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  206. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  207. package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
  208. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  209. package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
  210. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  211. package/lib/module/reanimated2/hook/useAnimatedSensor.js +88 -13
  212. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  213. package/lib/module/reanimated2/hook/useAnimatedStyle.js +45 -52
  214. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  215. package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
  216. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  217. package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
  218. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  219. package/lib/module/reanimated2/hook/utils.js +17 -60
  220. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  221. package/lib/module/reanimated2/index.js +1 -0
  222. package/lib/module/reanimated2/index.js.map +1 -1
  223. package/lib/module/reanimated2/initializers.js +182 -0
  224. package/lib/module/reanimated2/initializers.js.map +1 -0
  225. package/lib/module/reanimated2/interpolateColor.js +96 -19
  226. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  227. package/lib/module/reanimated2/jestUtils.js +1 -1
  228. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  229. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +101 -16
  230. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  231. package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
  232. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  233. package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
  234. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  235. package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  236. package/lib/module/reanimated2/js-reanimated/global.js +4 -9
  237. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  238. package/lib/module/reanimated2/js-reanimated/index.js +0 -1
  239. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  240. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
  241. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  242. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
  243. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  244. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +15 -10
  245. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  246. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
  247. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  248. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
  249. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  250. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
  251. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  252. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
  253. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  254. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
  255. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  256. package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
  257. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  258. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
  259. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  260. package/lib/module/reanimated2/mappers.js +16 -6
  261. package/lib/module/reanimated2/mappers.js.map +1 -1
  262. package/lib/module/reanimated2/mock.js +45 -0
  263. package/lib/module/reanimated2/mock.js.map +1 -1
  264. package/lib/module/reanimated2/mutables.js +4 -2
  265. package/lib/module/reanimated2/mutables.js.map +1 -1
  266. package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -0
  267. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
  268. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
  269. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  270. package/lib/module/reanimated2/pluginUtils.js +4 -0
  271. package/lib/module/reanimated2/pluginUtils.js.map +1 -0
  272. package/lib/module/reanimated2/shareables.js +38 -9
  273. package/lib/module/reanimated2/shareables.js.map +1 -1
  274. package/lib/module/reanimated2/threads.js +105 -4
  275. package/lib/module/reanimated2/threads.js.map +1 -1
  276. package/lib/module/reanimated2/utils.js +5 -0
  277. package/lib/module/reanimated2/utils.js.map +1 -1
  278. package/lib/module/reanimated2/valueSetter.js +1 -2
  279. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  280. package/package.json +9 -8
  281. package/{plugin.js → plugin/index.js} +173 -228
  282. package/react-native-reanimated.d.ts +57 -10
  283. package/scripts/reanimated_utils.rb +15 -2
  284. package/src/createAnimatedComponent.tsx +238 -28
  285. package/src/reanimated2/Colors.ts +38 -11
  286. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +63 -41
  287. package/src/reanimated2/animation/styleAnimation.ts +8 -1
  288. package/src/reanimated2/animation/util.ts +29 -16
  289. package/src/reanimated2/commonTypes.ts +28 -1
  290. package/src/reanimated2/component/FlatList.tsx +30 -5
  291. package/src/reanimated2/core.ts +45 -75
  292. package/src/reanimated2/errors.ts +57 -0
  293. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
  294. package/src/reanimated2/globals.d.ts +34 -18
  295. package/src/reanimated2/hook/index.ts +1 -1
  296. package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
  297. package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
  298. package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
  299. package/src/reanimated2/hook/useAnimatedSensor.ts +88 -11
  300. package/src/reanimated2/hook/useAnimatedStyle.ts +43 -45
  301. package/src/reanimated2/hook/useDerivedValue.ts +8 -1
  302. package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
  303. package/src/reanimated2/hook/utils.ts +15 -61
  304. package/src/reanimated2/index.ts +1 -0
  305. package/src/reanimated2/initializers.ts +184 -0
  306. package/src/reanimated2/interpolateColor.ts +104 -20
  307. package/src/reanimated2/jestUtils.ts +1 -1
  308. package/src/reanimated2/js-reanimated/JSReanimated.ts +105 -18
  309. package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
  310. package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
  311. package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
  312. package/src/reanimated2/js-reanimated/global.ts +4 -8
  313. package/src/reanimated2/js-reanimated/index.ts +0 -1
  314. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
  315. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
  316. package/src/reanimated2/layoutReanimation/animationsManager.ts +17 -12
  317. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
  318. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
  319. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
  320. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
  321. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
  322. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  323. package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
  324. package/src/reanimated2/mappers.ts +17 -6
  325. package/src/reanimated2/mock.ts +128 -0
  326. package/src/reanimated2/mutables.ts +2 -0
  327. package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
  328. package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
  329. package/src/reanimated2/pluginUtils.ts +8 -0
  330. package/src/reanimated2/shareables.ts +47 -11
  331. package/src/reanimated2/threads.ts +103 -1
  332. package/src/reanimated2/utils.ts +6 -0
  333. package/src/reanimated2/valueSetter.ts +1 -2
  334. package/lib/commonjs/reanimated2/time.js +0 -55
  335. package/lib/commonjs/reanimated2/time.js.map +0 -1
  336. package/lib/module/reanimated2/time.js +0 -37
  337. package/lib/module/reanimated2/time.js.map +0 -1
  338. package/src/reanimated2/time.ts +0 -30
  339. /package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
@@ -44,4 +44,17 @@ Object.keys(_defaultTransitions).forEach(function (key) {
44
44
  }
45
45
  });
46
46
  });
47
+
48
+ var _sharedTransitions = require("./sharedTransitions");
49
+
50
+ Object.keys(_sharedTransitions).forEach(function (key) {
51
+ if (key === "default" || key === "__esModule") return;
52
+ if (key in exports && exports[key] === _sharedTransitions[key]) return;
53
+ Object.defineProperty(exports, key, {
54
+ enumerable: true,
55
+ get: function () {
56
+ return _sharedTransitions[key];
57
+ }
58
+ });
59
+ });
47
60
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import './animationsManager';\nexport * from './animationBuilder';\nexport * from './defaultAnimations';\nexport * from './defaultTransitions';\n"],"mappings":";;;;;;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import './animationsManager';\nexport * from './animationBuilder';\nexport * from './defaultAnimations';\nexport * from './defaultTransitions';\nexport * from './sharedTransitions';\n"],"mappings":";;;;;;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SharedTransition = exports.DefaultSharedTransition = void 0;
7
+
8
+ var _animation = require("../../animation");
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
12
+ const supportedProps = ['width', 'height', 'originX', 'originY', 'transform'];
13
+
14
+ class SharedTransition {
15
+ constructor() {
16
+ _defineProperty(this, "animationFactory", null);
17
+
18
+ _defineProperty(this, "defaultDuration", 500);
19
+ }
20
+
21
+ static createInstance() {
22
+ return new SharedTransition();
23
+ }
24
+
25
+ static custom(animationFactory) {
26
+ return this.createInstance().custom(animationFactory);
27
+ }
28
+
29
+ custom(animationFactory) {
30
+ this.animationFactory = animationFactory;
31
+ return this;
32
+ }
33
+
34
+ static build() {
35
+ return this.createInstance().build();
36
+ }
37
+
38
+ build() {
39
+ const animationFactory = this.animationFactory;
40
+ const animationDuration = this.defaultDuration;
41
+ return values => {
42
+ 'worklet';
43
+
44
+ let animations = {};
45
+ const initialValues = {};
46
+
47
+ if (animationFactory) {
48
+ animations = animationFactory(values);
49
+
50
+ for (const key in animations) {
51
+ if (!supportedProps.includes(key)) {
52
+ throw Error(`The prop '${key}' is not supported yet.`);
53
+ }
54
+ }
55
+ } else {
56
+ for (const propName of supportedProps) {
57
+ if (propName === 'transform') {
58
+ const matrix = values.targetTransformMatrix;
59
+ animations.transformMatrix = (0, _animation.withTiming)(matrix, {
60
+ // native screen transition takes around 500ms
61
+ duration: animationDuration
62
+ });
63
+ } else {
64
+ const keyToTargetValue = 'target' + propName.charAt(0).toUpperCase() + propName.slice(1);
65
+ animations[propName] = (0, _animation.withTiming)(values[keyToTargetValue], {
66
+ // native screen transition takes around 500ms
67
+ duration: animationDuration
68
+ });
69
+ }
70
+ }
71
+ }
72
+
73
+ for (const propName in animations) {
74
+ if (propName === 'transform') {
75
+ initialValues.transformMatrix = values.currentTransformMatrix;
76
+ } else {
77
+ const keyToCurrentValue = 'current' + propName.charAt(0).toUpperCase() + propName.slice(1);
78
+ initialValues[propName] = values[keyToCurrentValue];
79
+ }
80
+ }
81
+
82
+ return {
83
+ initialValues,
84
+ animations
85
+ };
86
+ };
87
+ }
88
+
89
+ }
90
+
91
+ exports.SharedTransition = SharedTransition;
92
+ const DefaultSharedTransition = SharedTransition;
93
+ exports.DefaultSharedTransition = DefaultSharedTransition;
94
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["supportedProps","SharedTransition","createInstance","custom","animationFactory","build","animationDuration","defaultDuration","values","animations","initialValues","key","includes","Error","propName","matrix","targetTransformMatrix","transformMatrix","withTiming","duration","keyToTargetValue","charAt","toUpperCase","slice","currentTransformMatrix","keyToCurrentValue","DefaultSharedTransition"],"sources":["index.ts"],"sourcesContent":["import { withTiming } from '../../animation';\nimport {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n LayoutAnimationsValues,\n} from '../animationBuilder/commonTypes';\nimport { StyleProps } from '../../commonTypes';\n\nconst supportedProps = ['width', 'height', 'originX', 'originY', 'transform'];\n\ntype AnimationFactoryType = (values: LayoutAnimationsValues) => StyleProps;\n\nexport class SharedTransition implements ILayoutAnimationBuilder {\n animationFactory: AnimationFactoryType | null = null;\n defaultDuration = 500;\n\n static createInstance(): SharedTransition {\n return new SharedTransition();\n }\n\n static custom(animationFactory: AnimationFactoryType): SharedTransition {\n return this.createInstance().custom(animationFactory);\n }\n\n custom(animationFactory: AnimationFactoryType): SharedTransition {\n this.animationFactory = animationFactory;\n return this;\n }\n\n static build(): LayoutAnimationFunction {\n return this.createInstance().build();\n }\n\n build(): LayoutAnimationFunction {\n const animationFactory = this.animationFactory;\n const animationDuration = this.defaultDuration;\n return (values: LayoutAnimationsValues) => {\n 'worklet';\n let animations: {\n [key: string]: any;\n } = {};\n const initialValues: {\n [key: string]: any;\n } = {};\n\n if (animationFactory) {\n animations = animationFactory(values);\n for (const key in animations) {\n if (!supportedProps.includes(key)) {\n throw Error(`The prop '${key}' is not supported yet.`);\n }\n }\n } else {\n for (const propName of supportedProps) {\n if (propName === 'transform') {\n const matrix = values.targetTransformMatrix;\n animations.transformMatrix = withTiming(matrix, {\n // native screen transition takes around 500ms\n duration: animationDuration,\n });\n } else {\n const keyToTargetValue =\n 'target' + propName.charAt(0).toUpperCase() + propName.slice(1);\n animations[propName] = withTiming(values[keyToTargetValue], {\n // native screen transition takes around 500ms\n duration: animationDuration,\n });\n }\n }\n }\n\n for (const propName in animations) {\n if (propName === 'transform') {\n initialValues.transformMatrix = values.currentTransformMatrix;\n } else {\n const keyToCurrentValue =\n 'current' + propName.charAt(0).toUpperCase() + propName.slice(1);\n initialValues[propName] = values[keyToCurrentValue];\n }\n }\n\n return { initialValues, animations };\n };\n }\n}\n\nexport const DefaultSharedTransition = SharedTransition;\n"],"mappings":";;;;;;;AAAA;;;;AAQA,MAAMA,cAAc,GAAG,CAAC,OAAD,EAAU,QAAV,EAAoB,SAApB,EAA+B,SAA/B,EAA0C,WAA1C,CAAvB;;AAIO,MAAMC,gBAAN,CAA0D;EAAA;IAAA,0CACf,IADe;;IAAA,yCAE7C,GAF6C;EAAA;;EAI1C,OAAdC,cAAc,GAAqB;IACxC,OAAO,IAAID,gBAAJ,EAAP;EACD;;EAEY,OAANE,MAAM,CAACC,gBAAD,EAA2D;IACtE,OAAO,KAAKF,cAAL,GAAsBC,MAAtB,CAA6BC,gBAA7B,CAAP;EACD;;EAEDD,MAAM,CAACC,gBAAD,EAA2D;IAC/D,KAAKA,gBAAL,GAAwBA,gBAAxB;IACA,OAAO,IAAP;EACD;;EAEW,OAALC,KAAK,GAA4B;IACtC,OAAO,KAAKH,cAAL,GAAsBG,KAAtB,EAAP;EACD;;EAEDA,KAAK,GAA4B;IAC/B,MAAMD,gBAAgB,GAAG,KAAKA,gBAA9B;IACA,MAAME,iBAAiB,GAAG,KAAKC,eAA/B;IACA,OAAQC,MAAD,IAAoC;MACzC;;MACA,IAAIC,UAEH,GAAG,EAFJ;MAGA,MAAMC,aAEL,GAAG,EAFJ;;MAIA,IAAIN,gBAAJ,EAAsB;QACpBK,UAAU,GAAGL,gBAAgB,CAACI,MAAD,CAA7B;;QACA,KAAK,MAAMG,GAAX,IAAkBF,UAAlB,EAA8B;UAC5B,IAAI,CAACT,cAAc,CAACY,QAAf,CAAwBD,GAAxB,C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Mapper = stopMapper;
9
9
 
10
+ var _PlatformChecker = require("./PlatformChecker");
11
+
10
12
  var _threads = require("./threads");
11
13
 
14
+ const IS_JEST = (0, _PlatformChecker.isJest)();
15
+
12
16
  function createMapperRegistry() {
13
17
  'worklet';
14
18
 
15
19
  const mappers = new Map();
16
20
  let sortedMappers = [];
17
- let frameRequested = false;
21
+ let runRequested = false;
18
22
 
19
23
  function updateMappersOrder() {
20
24
  // sort mappers topologically
@@ -81,8 +85,8 @@ function createMapperRegistry() {
81
85
  sortedMappers = newOrder;
82
86
  }
83
87
 
84
- function mapperFrame() {
85
- frameRequested = false;
88
+ function mapperRun() {
89
+ runRequested = false;
86
90
 
87
91
  if (mappers.size !== sortedMappers.length) {
88
92
  updateMappersOrder();
@@ -97,9 +101,17 @@ function createMapperRegistry() {
97
101
  }
98
102
 
99
103
  function maybeRequestUpdates() {
100
- if (!frameRequested) {
101
- requestAnimationFrame(mapperFrame);
102
- frameRequested = true;
104
+ if (IS_JEST) {
105
+ // On Jest environment we avoid using setImmediate as that'd require test
106
+ // to advance the clock manually. This on other hand would require tests
107
+ // to know how many times mappers need to run. As we don't want tests to
108
+ // make any assumptions on that number it is easier to execute mappers
109
+ // immediately for testing purposes and only expect test to advance timers
110
+ // if they want to make any assertions on the effects of animations being run.
111
+ mapperRun();
112
+ } else if (!runRequested) {
113
+ setImmediate(mapperRun);
114
+ runRequested = true;
103
115
  }
104
116
  }
105
117
 
@@ -1 +1 @@
1
- {"version":3,"names":["createMapperRegistry","mappers","Map","sortedMappers","frameRequested","updateMappersOrder","pre","forEach","mapper","outputs","output","preMappers","get","undefined","set","push","visited","Set","newOrder","dfs","add","input","inputs","preMapper","has","mapperFrame","size","length","dirty","worklet","maybeRequestUpdates","requestAnimationFrame","extractInputs","resultArray","Array","isArray","addListener","element","Object","values","start","mapperID","id","sv","stop","delete","removeListener","MAPPER_ID","startMapper","runOnUI","mapperRegistry","global","__mapperRegistry","stopMapper"],"sources":["mappers.ts"],"sourcesContent":["import { SharedValue } from './commonTypes';\nimport { runOnUI } from './threads';\n\nexport type Mapper = {\n id: number;\n dirty: boolean;\n worklet: () => void;\n inputs: SharedValue<any>[];\n outputs?: SharedValue<any>[];\n};\n\nexport function createMapperRegistry() {\n 'worklet';\n const mappers = new Map();\n let sortedMappers: Mapper[] = [];\n\n let frameRequested = false;\n\n function updateMappersOrder() {\n // sort mappers topologically\n // the algorithm here takes adventage of a fact that the topological order\n // of a transposed graph is a reverse topological order of the original graph\n // The graph in our case consists of mappers and an edge between two mappers\n // A and B exists if there is a shared value that's on A's output lists and on\n // B's input list.\n //\n // We don't need however to calculate that graph as it is easier to work with\n // the transposed version of it that can be calculated ad-hoc. For the transposed\n // version to be traversed we use \"pre\" map that maps share value to mappers that\n // output that shared value. Then we can infer all the outgoing edges for a given\n // mapper simply by scanning it's input list and checking if any of the shared values\n // from that list exists in the \"pre\" map. If they do, then we have an edge between\n // that mapper and the mappers from the \"pre\" list for the given shared value.\n //\n // For topological sorting we use a dfs-based approach that requires the graph to\n // be traversed in dfs order and each node after being processed lands at the\n // beginning of the topological order list. Since we traverse a transposed graph,\n // instead of reversing that order we can use a normal array and push processed\n // mappers to the end. There is no need to reverse that array after we are done.\n const pre = new Map(); // map from sv -> mapper that outputs that sv\n mappers.forEach((mapper) => {\n if (mapper.outputs) {\n for (const output of mapper.outputs) {\n const preMappers = pre.get(output);\n if (preMappers === undefined) {\n pre.set(output, [mapper]);\n } else {\n preMappers.push(mapper);\n }\n }\n }\n });\n const visited = new Set();\n const newOrder: Mapper[] = [];\n function dfs(mapper: Mapper) {\n visited.add(mapper);\n for (const input of mapper.inputs) {\n const preMappers = pre.get(input);\n if (preMappers) {\n for (const preMapper of preMappers) {\n if (!visited.has(preMapper)) {\n dfs(preMapper);\n }\n }\n }\n }\n newOrder.push(mapper);\n }\n mappers.forEach((mapper) => {\n if (!visited.has(mapper)) {\n dfs(mapper);\n }\n });\n sortedMappers = newOrder;\n }\n\n function mapperFrame() {\n frameRequested = false;\n if (mappers.size !== sortedMappers.length) {\n updateMappersOrder();\n }\n for (const mapper of sortedMappers) {\n if (mapper.dirty) {\n mapper.dirty = false;\n mapper.worklet();\n }\n }\n }\n\n function maybeRequestUpdates() {\n if (!frameRequested) {\n requestAnimationFrame(mapperFrame);\n frameRequested = true;\n }\n }\n\n function extractInputs(\n inputs: any,\n resultArray: SharedValue<any>[]\n ): SharedValue<any>[] {\n if (Array.isArray(inputs)) {\n for (const input of inputs) {\n input && extractInputs(input, resultArray);\n }\n } else if (inputs.addListener) {\n resultArray.push(inputs);\n } else if (typeof inputs === 'object') {\n for (const element of Object.values(inputs)) {\n element && extractInputs(element, resultArray);\n }\n }\n return resultArray;\n }\n\n return {\n start: (\n mapperID: number,\n worklet: () => void,\n inputs: SharedValue<any>[],\n outputs?: SharedValue<any>[]\n ) => {\n const mapper = {\n id: mapperID,\n dirty: true,\n worklet,\n inputs: extractInputs(inputs, []),\n outputs,\n };\n mappers.set(mapper.id, mapper);\n sortedMappers = [];\n for (const sv of mapper.inputs) {\n sv.addListener(mapper.id, () => {\n mapper.dirty = true;\n maybeRequestUpdates();\n });\n }\n maybeRequestUpdates();\n },\n stop: (mapperID: number) => {\n const mapper = mappers.get(mapperID);\n if (mapper) {\n mappers.delete(mapper.id);\n sortedMappers = [];\n for (const sv of mapper.inputs) {\n sv.removeListener(mapper.id);\n }\n }\n },\n };\n}\n\nlet MAPPER_ID = 9999;\n\nexport function startMapper(\n worklet: () => void,\n inputs: any[] = [],\n outputs: any[] = []\n): number {\n const mapperID = (MAPPER_ID += 1);\n\n runOnUI(() => {\n 'worklet';\n let mapperRegistry = global.__mapperRegistry;\n if (mapperRegistry === undefined) {\n mapperRegistry = global.__mapperRegistry = createMapperRegistry();\n }\n mapperRegistry.start(mapperID, worklet, inputs, outputs);\n })();\n\n return mapperID;\n}\n\nexport function stopMapper(mapperID: number): void {\n runOnUI(() => {\n 'worklet';\n const mapperRegistry = global.__mapperRegistry;\n mapperRegistry?.stop(mapperID);\n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,IAAIF,cAAc,KAAKrC,SAAvB,EAAkC;MAChCqC,cAAc,GAAGC,MAAM,CAACC,gBAAP,GAA0BpD,oBAAoB,EAA/D;IACD;;IACDkD,cAAc,CAACV,KAAf,CAAqBC,QAArB,EAA+BZ,OAA/B,EAAwCP,MAAxC,EAAgDb,OAAhD;EACD,CAPD;EASA,OAAOgC,QAAP;AACD;;AAEM,SAASY,UAAT,CAAoBZ,QAApB,EAA4C;EACjD,IAAAQ,gBAAA,EAAQ,MAAM;IACZ;;IACA,MAAMC,cAAc,GAAGC,MAAM,CAACC,gBAA9B;IACAF,cAAc,SAAd,IAAAA,cAAc,WAAd,YAAAA,cAAc,CAAEN,IAAhB,CAAqBH,QAArB;EACD,CAJD;AAKD"}
1
+ {"version":3,"names":["IS_JEST","isJest","createMapperRegistry","mappers","Map","sortedMappers","runRequested","updateMappersOrder","pre","forEach","mapper","outputs","output","preMappers","get","undefined","set","push","visited","Set","newOrder","dfs","add","input","inputs","preMapper","has","mapperRun","size","length","dirty","worklet","maybeRequestUpdates","setImmediate","extractInputs","resultArray","Array","isArray","addListener","element","Object","values","start","mapperID","id","sv","stop","delete","removeListener","MAPPER_ID","startMapper","runOnUI","mapperRegistry","global","__mapperRegistry","stopMapper"],"sources":["mappers.ts"],"sourcesContent":["import { SharedValue } from './commonTypes';\nimport { isJest } from './PlatformChecker';\nimport { runOnUI } from './threads';\n\nconst IS_JEST = isJest();\n\nexport type Mapper = {\n id: number;\n dirty: boolean;\n worklet: () => void;\n inputs: SharedValue<any>[];\n outputs?: SharedValue<any>[];\n};\n\nexport function createMapperRegistry() {\n 'worklet';\n const mappers = new Map();\n let sortedMappers: Mapper[] = [];\n\n let runRequested = false;\n\n function updateMappersOrder() {\n // sort mappers topologically\n // the algorithm here takes adventage of a fact that the topological order\n // of a transposed graph is a reverse topological order of the original graph\n // The graph in our case consists of mappers and an edge between two mappers\n // A and B exists if there is a shared value that's on A's output lists and on\n // B's input list.\n //\n // We don't need however to calculate that graph as it is easier to work with\n // the transposed version of it that can be calculated ad-hoc. For the transposed\n // version to be traversed we use \"pre\" map that maps share value to mappers that\n // output that shared value. Then we can infer all the outgoing edges for a given\n // mapper simply by scanning it's input list and checking if any of the shared values\n // from that list exists in the \"pre\" map. If they do, then we have an edge between\n // that mapper and the mappers from the \"pre\" list for the given shared value.\n //\n // For topological sorting we use a dfs-based approach that requires the graph to\n // be traversed in dfs order and each node after being processed lands at the\n // beginning of the topological order list. Since we traverse a transposed graph,\n // instead of reversing that order we can use a normal array and push processed\n // mappers to the end. There is no need to reverse that array after we are done.\n const pre = new Map(); // map from sv -> mapper that outputs that sv\n mappers.forEach((mapper) => {\n if (mapper.outputs) {\n for (const output of mapper.outputs) {\n const preMappers = pre.get(output);\n if (preMappers === undefined) {\n pre.set(output, [mapper]);\n } else {\n preMappers.push(mapper);\n }\n }\n }\n });\n const visited = new Set();\n const newOrder: Mapper[] = [];\n function dfs(mapper: Mapper) {\n visited.add(mapper);\n for (const input of mapper.inputs) {\n const preMappers = pre.get(input);\n if (preMappers) {\n for (const preMapper of preMappers) {\n if (!visited.has(preMapper)) {\n dfs(preMapper);\n }\n }\n }\n }\n newOrder.push(mapper);\n }\n mappers.forEach((mapper) => {\n if (!visited.has(mapper)) {\n dfs(mapper);\n }\n });\n sortedMappers = newOrder;\n }\n\n function mapperRun() {\n runRequested = false;\n if (mappers.size !== sortedMappers.length) {\n updateMappersOrder();\n }\n for (const mapper of sortedMappers) {\n if (mapper.dirty) {\n mapper.dirty = false;\n mapper.worklet();\n }\n }\n }\n\n function maybeRequestUpdates() {\n if (IS_JEST) {\n // On Jest environment we avoid using setImmediate as that'd require test\n // to advance the clock manually. This on other hand would require tests\n // to know how many times mappers need to run. As we don't want tests to\n // make any assumptions on that number it is easier to execute mappers\n // immediately for testing purposes and only expect test to advance timers\n // if they want to make any assertions on the effects of animations being run.\n mapperRun();\n } else if (!runRequested) {\n setImmediate(mapperRun);\n runRequested = true;\n }\n }\n\n function extractInputs(\n inputs: any,\n resultArray: SharedValue<any>[]\n ): SharedValue<any>[] {\n if (Array.isArray(inputs)) {\n for (const input of inputs) {\n input && extractInputs(input, resultArray);\n }\n } else if (inputs.addListener) {\n resultArray.push(inputs);\n } else if (typeof inputs === 'object') {\n for (const element of Object.values(inputs)) {\n element && extractInputs(element, resultArray);\n }\n }\n return resultArray;\n }\n\n return {\n start: (\n mapperID: number,\n worklet: () => void,\n inputs: SharedValue<any>[],\n outputs?: SharedValue<any>[]\n ) => {\n const mapper = {\n id: mapperID,\n dirty: true,\n worklet,\n inputs: extractInputs(inputs, []),\n outputs,\n };\n mappers.set(mapper.id, mapper);\n sortedMappers = [];\n for (const sv of mapper.inputs) {\n sv.addListener(mapper.id, () => {\n mapper.dirty = true;\n maybeRequestUpdates();\n });\n }\n maybeRequestUpdates();\n },\n stop: (mapperID: number) => {\n const mapper = mappers.get(mapperID);\n if (mapper) {\n mappers.delete(mapper.id);\n sortedMappers = [];\n for (const sv of mapper.inputs) {\n sv.removeListener(mapper.id);\n }\n }\n },\n };\n}\n\nlet MAPPER_ID = 9999;\n\nexport function startMapper(\n worklet: () => void,\n inputs: any[] = [],\n outputs: any[] = []\n): number {\n const mapperID = (MAPPER_ID += 1);\n\n runOnUI(() => {\n 'worklet';\n let mapperRegistry = global.__mapperRegistry;\n if (mapperRegistry === undefined) {\n mapperRegistry = global.__mapperRegistry = createMapperRegistry();\n }\n mapperRegistry.start(mapperID, worklet, inputs, outputs);\n })();\n\n return mapperID;\n}\n\nexport function stopMapper(mapperID: number): void {\n runOnUI(() => {\n 'worklet';\n const mapperRegistry = global.__mapperRegistry;\n mapperRegistry?.stop(mapperID);\n })();\n}\n"],"mappings":";;;;;;;;;AACA;;AACA;;AAEA,MAAMA,OAAO,GAAG,IAAAC,uBAAA,GAAhB;;AAUO,SAASC,oBAAT,GAAgC;EACrC;;EACA,MAAMC,OAAO,GAAG,IAAIC,GAAJ,EAAhB;EACA,IAAIC,aAAuB,GAAG,EAA9B;EAEA,IAAIC,YA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D,oBAAoB,EAA/D;IACD;;IACDkD,cAAc,CAACV,KAAf,CAAqBC,QAArB,EAA+BZ,OAA/B,EAAwCP,MAAxC,EAAgDb,OAAhD;EACD,CAPD;EASA,OAAOgC,QAAP;AACD;;AAEM,SAASY,UAAT,CAAoBZ,QAApB,EAA4C;EACjD,IAAAQ,gBAAA,EAAQ,MAAM;IACZ;;IACA,MAAMC,cAAc,GAAGC,MAAM,CAACC,gBAA9B;IACAF,cAAc,SAAd,IAAAA,cAAc,WAAd,YAAAA,cAAc,CAAEN,IAAhB,CAAqBH,QAArB;EACD,CAJD;AAKD"}
@@ -10,6 +10,48 @@ const ID = t => t;
10
10
 
11
11
  const IMMEDIATE_CB_INVOCATION = cb => cb();
12
12
 
13
+ class BaseAnimationMock {
14
+ duration(_) {
15
+ return this;
16
+ }
17
+
18
+ delay(_) {
19
+ return this;
20
+ }
21
+
22
+ springify(_) {
23
+ return this;
24
+ }
25
+
26
+ damping(_) {
27
+ return this;
28
+ }
29
+
30
+ stiffness(_) {
31
+ return this;
32
+ }
33
+
34
+ withCallback(_) {
35
+ return this;
36
+ }
37
+
38
+ randomDelay() {
39
+ return this;
40
+ }
41
+
42
+ withInitialValues() {
43
+ return this;
44
+ }
45
+
46
+ build() {
47
+ return () => ({
48
+ initialValues: {},
49
+ animations: {}
50
+ });
51
+ }
52
+
53
+ }
54
+
13
55
  const ReanimatedV2 = {
14
56
  useSharedValue: v => ({
15
57
  value: v
@@ -83,6 +125,9 @@ const ReanimatedV2 = {
83
125
  runOnJS: fn => fn,
84
126
  runOnUI: fn => fn
85
127
  };
128
+ ['FadeIn', 'FadeInRight', 'FadeInLeft', 'FadeInUp', 'FadeInDown', 'FadeOut', 'FadeOutRight', 'FadeOutLeft', 'FadeOutUp', 'FadeOutDown', 'FlipInYLeft', 'FlipInXDown', 'FlipInYRight', 'FlipInEasyX', 'FlipInEasyY', 'FlipOutXUp', 'FlipOutYLeft', 'FlipOutXDown', 'FlipOutYRight', 'FlipOutEasyX', 'FlipOutEasyY', 'StretchInY', 'StretchOutX', 'StretchOutY', 'SlideInLeft', 'SlideOutRight', 'SlideOutLeft', 'SlideInUp', 'SlideInDown', 'SlideOutUp', 'ZoomInRotate', 'ZoomInLeft', 'ZoomInRight', 'ZoomInUp', 'ZoomInDown', 'ZoomInEasyUp', 'ZoomInEasyDown', 'ZoomOut', 'ZoomOutRotate', 'ZoomOutLeft', 'ZoomOutRight', 'ZoomOutUp', 'ZoomOutDown', 'ZoomOutEasyUp', 'ZoomOutEasyDown', 'BounceInDown', 'BounceInUp', 'BounceInLeft', 'BounceInRight', 'BounceOut', 'BounceOutDown', 'BounceOutUp', 'BounceOutLeft', 'BounceOutRight', 'LightSpeedInLeft', 'LightSpeedOutRight', 'LightSpeedOutLeft', 'PinwheelOut', 'RotateInDownRight', 'RotateInUpLeft', 'RotateInUpRight', 'RotateOutDownLeft', 'RotateOutDownRight', 'RotateOutUpLeft', 'RotateOutUpRight', 'RollInRight', 'RollOutLeft', 'RollOutRight', 'Layout', 'CurvedTransition', 'JumpingTransition', 'SequencedTransition', 'FadingTransition', 'EntryExitTransition'].forEach(k => Object.assign(ReanimatedV2, {
129
+ [k]: new BaseAnimationMock()
130
+ }));
86
131
  module.exports = { ...ReanimatedV2
87
132
  };
88
133
  //# sourceMappingURL=mock.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NOOP","ID","t","IMMEDIATE_CB_INVOCATION","cb","ReanimatedV2","useSharedValue","v","value","useDerivedValue","a","useAnimatedScrollHandler","useAnimatedGestureHandler","useAnimatedStyle","useAnimatedRef","current","useAnimatedReaction","useAnimatedProps","withTiming","toValue","_","withSpring","withDecay","withDelay","animationValue","withSequence","withRepeat","animation","cancelAnimation","measure","x","y","width","height","pageX","pageY","Easing","linear","ease","quad","cubic","poly","sin","circle","exp","elastic","back","bounce","bezier","factory","bezierFn","in","out","inOut","Extrapolation","EXTEND","CLAMP","IDENTITY","runOnJS","fn","runOnUI","module","exports"],"sources":["mock.ts"],"sourcesContent":["/* eslint-disable node/no-callback-literal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nconst NOOP = () => {\n // noop\n};\nconst ID = (t) => t;\nconst IMMEDIATE_CB_INVOCATION = (cb: () => unknown) => cb();\n\nconst ReanimatedV2 = {\n useSharedValue: (v) => ({ value: v }),\n useDerivedValue: (a) => ({ value: a() }),\n useAnimatedScrollHandler: () => NOOP,\n useAnimatedGestureHandler: () => NOOP,\n useAnimatedStyle: IMMEDIATE_CB_INVOCATION,\n useAnimatedRef: () => ({ current: null }),\n useAnimatedReaction: NOOP,\n useAnimatedProps: IMMEDIATE_CB_INVOCATION,\n\n withTiming: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withSpring: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withDecay: (_, cb) => {\n cb && cb(true);\n return 0;\n },\n withDelay: (_, animationValue) => {\n return animationValue;\n },\n withSequence: (..._animations) => {\n return 0;\n },\n withRepeat: (animation) => {\n return animation;\n },\n cancelAnimation: NOOP,\n measure: () => ({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n }),\n Easing: {\n linear: ID,\n ease: ID,\n quad: ID,\n cubic: ID,\n poly: ID,\n sin: ID,\n circle: ID,\n exp: ID,\n elastic: ID,\n back: ID,\n bounce: ID,\n bezier: () => ({ factory: ID }),\n bezierFn: ID,\n in: ID,\n out: ID,\n inOut: ID,\n },\n Extrapolation: {\n EXTEND: 'extend',\n CLAMP: 'clamp',\n IDENTITY: 'identity',\n },\n\n runOnJS: (fn) => fn,\n runOnUI: (fn) => fn,\n};\n\nmodule.exports = {\n ...ReanimatedV2,\n};\n"],"mappings":";;AAAA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,EAAE,GAAIC,CAAD,IAAOA,CAAlB;;AACA,MAAMC,uBAAuB,GAAIC,EAAD,IAAuBA,EAAE,EAAzD;;A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EANO,CAAP,CAhCU;EAwCnBC,MAAM,EAAE;IACNC,MAAM,EAAEpC,EADF;IAENqC,IAAI,EAAErC,EAFA;IAGNsC,IAAI,EAAEtC,EAHA;IAINuC,KAAK,EAAEvC,EAJD;IAKNwC,IAAI,EAAExC,EALA;IAMNyC,GAAG,EAAEzC,EANC;IAON0C,MAAM,EAAE1C,EAPF;IAQN2C,GAAG,EAAE3C,EARC;IASN4C,OAAO,EAAE5C,EATH;IAUN6C,IAAI,EAAE7C,EAVA;IAWN8C,MAAM,EAAE9C,EAXF;IAYN+C,MAAM,EAAE,OAAO;MAAEC,OAAO,EAAEhD;IAAX,CAAP,CAZF;IAaNiD,QAAQ,EAAEjD,EAbJ;IAcNkD,EAAE,EAAElD,EAdE;IAeNmD,GAAG,EAAEnD,EAfC;IAgBNoD,KAAK,EAAEpD;EAhBD,CAxCW;EA0DnBqD,aAAa,EAAE;IACbC,MAAM,EAAE,QADK;IAEbC,KAAK,EAAE,OAFM;IAGbC,QAAQ,EAAE;EAHG,CA1DI;EAgEnBC,OAAO,EAAGC,EAAD,IAAQA,EAhEE;EAiEnBC,OAAO,EAAGD,EAAD,IAAQA;AAjEE,CAArB;AAoEAE,MAAM,CAACC,OAAP,GAAiB,EACf,GAAGzD;AADY,CAAjB"}
1
+ {"version":3,"names":["NOOP","ID","t","IMMEDIATE_CB_INVOCATION","cb","BaseAnimationMock","duration","_","delay","springify","damping","stiffness","withCallback","randomDelay","withInitialValues","build","initialValues","animations","ReanimatedV2","useSharedValue","v","value","useDerivedValue","a","useAnimatedScrollHandler","useAnimatedGestureHandler","useAnimatedStyle","useAnimatedRef","current","useAnimatedReaction","useAnimatedProps","withTiming","toValue","withSpring","withDecay","withDelay","animationValue","withSequence","withRepeat","animation","cancelAnimation","measure","x","y","width","height","pageX","pageY","Easing","linear","ease","quad","cubic","poly","sin","circle","exp","elastic","back","bounce","bezier","factory","bezierFn","in","out","inOut","Extrapolation","EXTEND","CLAMP","IDENTITY","runOnJS","fn","runOnUI","forEach","k","Object","assign","module","exports"],"sources":["mock.ts"],"sourcesContent":["/* eslint-disable node/no-callback-literal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nconst NOOP = () => {\n // noop\n};\nconst ID = (t) => t;\nconst IMMEDIATE_CB_INVOCATION = (cb: () => unknown) => cb();\n\nclass BaseAnimationMock {\n duration(_: number) {\n return this;\n }\n\n delay(_: number) {\n return this;\n }\n\n springify(_: number) {\n return this;\n }\n\n damping(_: number) {\n return this;\n }\n\n stiffness(_: number) {\n return this;\n }\n\n withCallback(_: (finsihed: boolean) => void) {\n return this;\n }\n\n randomDelay() {\n return this;\n }\n\n withInitialValues() {\n return this;\n }\n\n build() {\n return () => ({ initialValues: {}, animations: {} });\n }\n}\n\nconst ReanimatedV2 = {\n useSharedValue: (v) => ({ value: v }),\n useDerivedValue: (a) => ({ value: a() }),\n useAnimatedScrollHandler: () => NOOP,\n useAnimatedGestureHandler: () => NOOP,\n useAnimatedStyle: IMMEDIATE_CB_INVOCATION,\n useAnimatedRef: () => ({ current: null }),\n useAnimatedReaction: NOOP,\n useAnimatedProps: IMMEDIATE_CB_INVOCATION,\n\n withTiming: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withSpring: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withDecay: (_, cb) => {\n cb && cb(true);\n return 0;\n },\n withDelay: (_, animationValue) => {\n return animationValue;\n },\n withSequence: (..._animations) => {\n return 0;\n },\n withRepeat: (animation) => {\n return animation;\n },\n cancelAnimation: NOOP,\n measure: () => ({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n }),\n Easing: {\n linear: ID,\n ease: ID,\n quad: ID,\n cubic: ID,\n poly: ID,\n sin: ID,\n circle: ID,\n exp: ID,\n elastic: ID,\n back: ID,\n bounce: ID,\n bezier: () => ({ factory: ID }),\n bezierFn: ID,\n in: ID,\n out: ID,\n inOut: ID,\n },\n Extrapolation: {\n EXTEND: 'extend',\n CLAMP: 'clamp',\n IDENTITY: 'identity',\n },\n\n runOnJS: (fn) => fn,\n runOnUI: (fn) => fn,\n};\n\n[\n 'FadeIn',\n 'FadeInRight',\n 'FadeInLeft',\n 'FadeInUp',\n 'FadeInDown',\n 'FadeOut',\n 'FadeOutRight',\n 'FadeOutLeft',\n 'FadeOutUp',\n 'FadeOutDown',\n\n 'FlipInYLeft',\n 'FlipInXDown',\n 'FlipInYRight',\n 'FlipInEasyX',\n 'FlipInEasyY',\n 'FlipOutXUp',\n 'FlipOutYLeft',\n 'FlipOutXDown',\n 'FlipOutYRight',\n 'FlipOutEasyX',\n 'FlipOutEasyY',\n\n 'StretchInY',\n 'StretchOutX',\n 'StretchOutY',\n 'SlideInLeft',\n 'SlideOutRight',\n 'SlideOutLeft',\n 'SlideInUp',\n 'SlideInDown',\n 'SlideOutUp',\n\n 'ZoomInRotate',\n 'ZoomInLeft',\n 'ZoomInRight',\n 'ZoomInUp',\n 'ZoomInDown',\n 'ZoomInEasyUp',\n 'ZoomInEasyDown',\n 'ZoomOut',\n 'ZoomOutRotate',\n 'ZoomOutLeft',\n 'ZoomOutRight',\n 'ZoomOutUp',\n 'ZoomOutDown',\n 'ZoomOutEasyUp',\n 'ZoomOutEasyDown',\n\n 'BounceInDown',\n 'BounceInUp',\n 'BounceInLeft',\n 'BounceInRight',\n 'BounceOut',\n 'BounceOutDown',\n 'BounceOutUp',\n 'BounceOutLeft',\n 'BounceOutRight',\n\n 'LightSpeedInLeft',\n 'LightSpeedOutRight',\n 'LightSpeedOutLeft',\n\n 'PinwheelOut',\n\n 'RotateInDownRight',\n 'RotateInUpLeft',\n 'RotateInUpRight',\n 'RotateOutDownLeft',\n 'RotateOutDownRight',\n 'RotateOutUpLeft',\n 'RotateOutUpRight',\n\n 'RollInRight',\n 'RollOutLeft',\n 'RollOutRight',\n\n 'Layout',\n 'CurvedTransition',\n 'JumpingTransition',\n 'SequencedTransition',\n 'FadingTransition',\n 'EntryExitTransition',\n].forEach((k) =>\n Object.assign(ReanimatedV2, {\n [k]: new BaseAnimationMock(),\n })\n);\n\nmodule.exports = {\n ...ReanimatedV2,\n};\n"],"mappings":";;AAAA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,EAAE,GAAIC,CAAD,IAAOA,CAAlB;;AACA,MAAMC,uBAAuB,GAAIC,EAAD,IAAuBA,EAAE,EAAzD;;AAEA,MAAMC,iBAAN,CAAwB;EACtBC,QAAQ,CAACC,CAAD,EAAY;IAClB,OAAO,IAAP;EACD;;EAEDC,KAAK,CAACD,CAAD,EAAY;IACf,OAAO,IAAP;EACD;;EAEDE,SAAS,CAACF,CAAD,EAAY;IACnB,OAAO,IAAP;EACD;;EAEDG,OAAO,CAACH,CAAD,EAAY;IACjB,OAAO,IAAP;EACD;;EAEDI,SAAS,CAACJ,CAAD,EAAY;IACnB,OAAO,IAAP;EACD;;EAEDK,YAAY,CAACL,CAAD,EAAiC;IAC3C,OAAO,IAAP;EACD;;EAEDM,WAAW,GAAG;IACZ,OAAO,IAAP;EACD;;EAEDC,iBAAiB,GAAG;IAClB,OAAO,IAAP;EACD;;EAEDC,KAAK,GAAG;IACN,OAAO,OAAO;MAAEC,aAAa,EAAE,EAAjB;MAAqBC,UAAU,EAAE;IAAjC,CAAP,CAAP;EACD;;AAnCqB;;AAsCxB,MAAMC,YAAY,GAAG;EACnBC,cAAc,EAAGC,CAAD,KAAQ;IAAEC,KAAK,EAAED;EAAT,CAAR,CADG;EAEnBE,eAAe,EAAGC,CAAD,KAAQ;IAAEF,KAAK,EAAEE,CAAC;EAAV,CAAR,CAFE;EAGnBC,wBAAwB,EAAE,MAAMxB,IAHb;EAInByB,yBAAyB,EAAE,MAAMzB,IAJd;EAKnB0B,gBAAgB,EAAEvB,uBALC;EAMnBwB,cAAc,EAAE,OAAO;IAAEC,OAAO,EAAE;EAAX,CAAP,CANG;EAOnBC,mBAAmB,EAAE7B,IAPF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EF,EAsEE,oBAtEF,EAuEE,iBAvEF,EAwEE,kBAxEF,EA0EE,aA1EF,EA2EE,aA3EF,EA4EE,cA5EF,EA8EE,QA9EF,EA+EE,kBA/EF,EAgFE,mBAhFF,EAiFE,qBAjFF,EAkFE,kBAlFF,EAmFE,qBAnFF,EAoFEE,OApFF,CAoFWC,CAAD,IACRC,MAAM,CAACC,MAAP,CAAc1D,YAAd,EAA4B;EAC1B,CAACwD,CAAD,GAAK,IAAIrE,iBAAJ;AADqB,CAA5B,CArFF;AA0FAwE,MAAM,CAACC,OAAP,GAAiB,EACf,GAAG5D;AADY,CAAjB"}
@@ -67,7 +67,8 @@ function makeUIMutable(initial, syncDataHolder) {
67
67
  removeListener: id => {
68
68
  listeners.delete(id);
69
69
  },
70
- _animation: null
70
+ _animation: null,
71
+ _isReanimatedSharedValue: true
71
72
  };
72
73
  return self;
73
74
  }
@@ -152,7 +153,8 @@ function makeMutable(initial) {
152
153
  }
153
154
 
154
155
  listeners.delete(id);
155
- }
156
+ },
157
+ _isReanimatedSharedValue: true
156
158
  };
157
159
  (0, _shareables.registerShareableMapping)(mutable, handle);
158
160
  return mutable;
@@ -1 +1 @@
1
- {"version":3,"names":["makeUIMutable","initial","syncDataHolder","listeners","Map","value","self","newValue","valueSetter","_value","_updateDataSynchronously","makeShareableCloneOnUIRecursive","forEach","listener","addListener","id","set","removeListener","delete","_animation","makeMutable","oneWayReadsOnly","NativeReanimatedModule","native","makeSynchronizedDataHolder","makeShareableCloneRecursive","registerShareableMapping","handle","__init","undefined","mutable","runOnUI","getDataSynchronously","Error","modify","modifier","makeRemote"],"sources":["mutables.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { SharedValue, ShareableSyncDataHolderRef } from './commonTypes';\nimport {\n makeShareableCloneOnUIRecursive,\n makeShareableCloneRecursive,\n registerShareableMapping,\n} from './shareables';\nimport { runOnUI } from './threads';\nimport { valueSetter } from './valueSetter';\nexport { stopMapper } from './mappers';\n\nexport function makeUIMutable<T>(\n initial: T,\n syncDataHolder?: ShareableSyncDataHolderRef<T>\n) {\n 'worklet';\n\n const listeners = new Map();\n let value = initial;\n\n const self = {\n set value(newValue) {\n valueSetter(self, newValue);\n },\n get value() {\n return value;\n },\n /**\n * _value prop should only be accessed by the valueSetter implementation\n * which may make the decision about updating the mutable value depending\n * on the provided new value. All other places should only attempt to modify\n * the mutable by assigning to value prop directly.\n */\n set _value(newValue: T) {\n value = newValue;\n if (syncDataHolder) {\n _updateDataSynchronously(\n syncDataHolder,\n makeShareableCloneOnUIRecursive(newValue)\n );\n }\n listeners.forEach((listener) => {\n listener(newValue);\n });\n },\n get _value(): T {\n return value;\n },\n addListener: (id: number, listener: (newValue: T) => void) => {\n listeners.set(id, listener);\n },\n removeListener: (id: number) => {\n listeners.delete(id);\n },\n _animation: null,\n };\n return self;\n}\n\nexport function makeMutable<T>(\n initial: T,\n oneWayReadsOnly = false\n): SharedValue<T> {\n let value: T = initial;\n let syncDataHolder: ShareableSyncDataHolderRef<T> | undefined;\n if (!oneWayReadsOnly && NativeReanimatedModule.native) {\n // updates are always synchronous when running on web or in Jest environment\n syncDataHolder = NativeReanimatedModule.makeSynchronizedDataHolder(\n makeShareableCloneRecursive(value)\n );\n registerShareableMapping(syncDataHolder);\n }\n const handle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n return makeUIMutable(initial, syncDataHolder);\n },\n });\n // listeners can only work on JS thread on Web and jest environments\n const listeners = NativeReanimatedModule.native ? undefined : new Map();\n const mutable = {\n set value(newValue) {\n if (NativeReanimatedModule.native) {\n runOnUI(() => {\n 'worklet';\n mutable.value = newValue;\n })();\n } else {\n valueSetter(mutable, newValue);\n }\n },\n get value() {\n if (syncDataHolder) {\n return NativeReanimatedModule.getDataSynchronously(syncDataHolder);\n }\n return value;\n },\n set _value(newValue: T) {\n if (NativeReanimatedModule.native) {\n throw new Error(\n 'Setting `_value` directly is only possible on the UI runtime'\n );\n }\n value = newValue;\n listeners!.forEach((listener) => {\n listener(newValue);\n });\n },\n get _value(): T {\n if (NativeReanimatedModule.native) {\n throw new Error(\n 'Reading from `_value` directly is only possible on the UI runtime'\n );\n }\n return value;\n },\n modify: (modifier: (value: T) => T) => {\n runOnUI(() => {\n 'worklet';\n mutable.value = modifier(mutable.value);\n })();\n },\n addListener: (id: number, listener: (value: T) => void) => {\n if (NativeReanimatedModule.native) {\n throw new Error('adding listeners is only possible on the UI runtime');\n }\n listeners!.set(id, listener);\n },\n removeListener: (id: number) => {\n if (NativeReanimatedModule.native) {\n throw new Error(\n 'removing listeners is only possible on the UI runtime'\n );\n }\n listeners!.delete(id);\n },\n };\n registerShareableMapping(mutable, handle);\n return mutable;\n}\n\nexport function makeRemote<T extends object>(initial: T = {} as T): T {\n const handle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n return initial;\n },\n });\n registerShareableMapping(initial, handle);\n return initial;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AAKA;;AACA;;AACA;;;;AAEO,SAASA,aAAT,CACLC,OADK,EAELC,cAFK,EAGL;EACA;;EAEA,MAAMC,SAAS,GAAG,IAAIC,GAAJ,EAAlB;EACA,IAAIC,KAAK,GAAGJ,OAAZ;EAEA,MAAMK,IAAI,GAAG;IACX,IAAID,KAAJ,CAAUE,QAAV,EAAoB;MAClB,IAAAC,wBAAA,EAAYF,IAAZ,EAAkBC,QAAlB;IACD,CAHU;;IAIX,IAAIF,KAAJ,GAAY;MACV,OAAOA,KAAP;IACD,CANU;;IAOX;AACJ;AACA;AACA;AACA;AACA;IACI,IAAII,MAAJ,CAAWF,QAAX,EAAwB;MACtBF,KAAK,GAAGE,QAAR;;MACA,IAAIL,cAAJ,EAAoB;QAClBQ,wBAAwB,CACtBR,cADsB,EAEtB,IAAAS,2CAAA,EAAgCJ,QAAhC,CAFsB,CAAxB;MAID;;MACDJ,SAAS,CAACS,OAAV,CAAmBC,QAAD,IAAc;QAC9BA,QAAQ,CAACN,QAAD,CAAR;MACD,CAF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AACD;;AAEM,SAASM,UAAT,GAA+D;EAAA,IAAzBnC,OAAyB,uEAAZ,EAAY;EACpE,MAAM0B,MAAM,GAAG,IAAAF,uCAAA,EAA4B;IACzCG,MAAM,EAAE,MAAM;MACZ;;MACA,OAAO3B,OAAP;IACD;EAJwC,CAA5B,CAAf;EAMA,IAAAyB,oCAAA,EAAyBzB,OAAzB,EAAkC0B,MAAlC;EACA,OAAO1B,OAAP;AACD"}
1
+ {"version":3,"names":["makeUIMutable","initial","syncDataHolder","listeners","Map","value","self","newValue","valueSetter","_value","_updateDataSynchronously","makeShareableCloneOnUIRecursive","forEach","listener","addListener","id","set","removeListener","delete","_animation","_isReanimatedSharedValue","makeMutable","oneWayReadsOnly","NativeReanimatedModule","native","makeSynchronizedDataHolder","makeShareableCloneRecursive","registerShareableMapping","handle","__init","undefined","mutable","runOnUI","getDataSynchronously","Error","modify","modifier","makeRemote"],"sources":["mutables.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { SharedValue, ShareableSyncDataHolderRef } from './commonTypes';\nimport {\n makeShareableCloneOnUIRecursive,\n makeShareableCloneRecursive,\n registerShareableMapping,\n} from './shareables';\nimport { runOnUI } from './threads';\nimport { valueSetter } from './valueSetter';\nexport { stopMapper } from './mappers';\n\nexport function makeUIMutable<T>(\n initial: T,\n syncDataHolder?: ShareableSyncDataHolderRef<T>\n) {\n 'worklet';\n\n const listeners = new Map();\n let value = initial;\n\n const self = {\n set value(newValue) {\n valueSetter(self, newValue);\n },\n get value() {\n return value;\n },\n /**\n * _value prop should only be accessed by the valueSetter implementation\n * which may make the decision about updating the mutable value depending\n * on the provided new value. All other places should only attempt to modify\n * the mutable by assigning to value prop directly.\n */\n set _value(newValue: T) {\n value = newValue;\n if (syncDataHolder) {\n _updateDataSynchronously(\n syncDataHolder,\n makeShareableCloneOnUIRecursive(newValue)\n );\n }\n listeners.forEach((listener) => {\n listener(newValue);\n });\n },\n get _value(): T {\n return value;\n },\n addListener: (id: number, listener: (newValue: T) => void) => {\n listeners.set(id, listener);\n },\n removeListener: (id: number) => {\n listeners.delete(id);\n },\n _animation: null,\n _isReanimatedSharedValue: true,\n };\n return self;\n}\n\nexport function makeMutable<T>(\n initial: T,\n oneWayReadsOnly = false\n): SharedValue<T> {\n let value: T = initial;\n let syncDataHolder: ShareableSyncDataHolderRef<T> | undefined;\n if (!oneWayReadsOnly && NativeReanimatedModule.native) {\n // updates are always synchronous when running on web or in Jest environment\n syncDataHolder = NativeReanimatedModule.makeSynchronizedDataHolder(\n makeShareableCloneRecursive(value)\n );\n registerShareableMapping(syncDataHolder);\n }\n const handle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n return makeUIMutable(initial, syncDataHolder);\n },\n });\n // listeners can only work on JS thread on Web and jest environments\n const listeners = NativeReanimatedModule.native ? undefined : new Map();\n const mutable = {\n set value(newValue) {\n if (NativeReanimatedModule.native) {\n runOnUI(() => {\n 'worklet';\n mutable.value = newValue;\n })();\n } else {\n valueSetter(mutable, newValue);\n }\n },\n get value() {\n if (syncDataHolder) {\n return NativeReanimatedModule.getDataSynchronously(syncDataHolder);\n }\n return value;\n },\n set _value(newValue: T) {\n if (NativeReanimatedModule.native) {\n throw new Error(\n 'Setting `_value` directly is only possible on the UI runtime'\n );\n }\n value = newValue;\n listeners!.forEach((listener) => {\n listener(newValue);\n });\n },\n get _value(): T {\n if (NativeReanimatedModule.native) {\n throw new Error(\n 'Reading from `_value` directly is only possible on the UI runtime'\n );\n }\n return value;\n },\n modify: (modifier: (value: T) => T) => {\n runOnUI(() => {\n 'worklet';\n mutable.value = modifier(mutable.value);\n })();\n },\n addListener: (id: number, listener: (value: T) => void) => {\n if (NativeReanimatedModule.native) {\n throw new Error('adding listeners is only possible on the UI runtime');\n }\n listeners!.set(id, listener);\n },\n removeListener: (id: number) => {\n if (NativeReanimatedModule.native) {\n throw new Error(\n 'removing listeners is only possible on the UI runtime'\n );\n }\n listeners!.delete(id);\n },\n _isReanimatedSharedValue: true,\n };\n registerShareableMapping(mutable, handle);\n return mutable;\n}\n\nexport function makeRemote<T extends object>(initial: T = {} as T): T {\n const handle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n return initial;\n },\n });\n registerShareableMapping(initial, handle);\n return initial;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AAKA;;AACA;;AACA;;;;AAEO,SAASA,aAAT,CACLC,OADK,EAELC,cAFK,EAGL;EACA;;EAEA,MAAMC,SAAS,GAAG,IAAIC,GAAJ,EAAlB;EACA,IAAIC,KAAK,GAAGJ,OAAZ;EAEA,MAAMK,IAAI,GAAG;IACX,IAAID,KAAJ,CAAUE,QAAV,EAAoB;MAClB,IAAAC,wBAAA,EAAYF,IAAZ,EAAkBC,QAAlB;IACD,CAHU;;IAIX,IAAIF,KAAJ,GAAY;MACV,OAAOA,KAAP;IACD,CANU;;IAOX;AACJ;AACA;AACA;AACA;AACA;IACI,IAAII,MAAJ,CAAWF,QAAX,EAAwB;MACtBF,KAAK,GAAGE,QAAR;;MACA,IAAIL,cAAJ,EAAoB;QAClBQ,wBAAwB,CACtBR,cADsB,EAEtB,IAAAS,2CAAA,EAAgCJ,QAAhC,CAFsB,CAAxB;MAID;;MACDJ,SAAS,CAACS,OAAV,CAAmBC,QAAD,IAAc;QAC9BA,QAAQ,CAACN,QAAD,CAAR;MACD,CAFD;IAGD,CAxBU;;IAyBX,IAAIE,MAAJ,GAAgB;MACd,OAAOJ,KAAP;IACD,CA3BU;;IA4BXS,WAAW,EAAE,CAACC,EAAD,EAAaF,QAAb,KAAiD;MAC5DV,SAAS,CAACa,GAAV,CAAcD,EAAd,EAAkBF,QAAlB;IACD,CA9BU;IA+BXI,cAAc,EAAGF,EAAD,IAAgB;MAC9BZ,SAAS,CAACe,MAAV,CAAiBH,EAAjB;IACD,CAjCU;IAkCXI,UAAU,EAAE,IAlCD;IAmCXC,wBAAwB,EAAE;EAnCf,CAAb;EAqCA,OAAOd,IAAP;AACD;;AAEM,SAASe,WA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perty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.checkVersion = checkVersion;
7
+
8
+ /**
9
+ * We hardcode the version of Reanimated here in order to compare it
10
+ * with the version used to build the native part of the library in runtime.
11
+ * Remember to keep this in sync with the version declared in `package.json`
12
+ */
13
+ const jsVersion = '3.0.0';
14
+ /**
15
+ * Checks that native and js versions of reanimated match.
16
+ */
17
+
18
+ function checkVersion() {
19
+ const cppVersion = global._REANIMATED_VERSION_CPP;
20
+
21
+ if (cppVersion === undefined) {
22
+ console.error(`[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.`);
23
+ return;
24
+ }
25
+
26
+ const ok = (() => {
27
+ if (jsVersion.match(/^\d+\.\d+\.\d+$/) && cppVersion.match(/^\d+\.\d+\.\d+$/)) {
28
+ // x.y.z, compare only major and minor, skip patch
29
+ const [jsMajor, jsMinor] = jsVersion.split('.');
30
+ const [cppMajor, cppMinor] = cppVersion.split('.');
31
+ return jsMajor === cppMajor && jsMinor === cppMinor;
32
+ } else {
33
+ // alpha, beta or rc, compare everything
34
+ return jsVersion === cppVersion;
35
+ }
36
+ })();
37
+
38
+ if (!ok) {
39
+ console.error(`[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.`); // TODO: detect Expo managed workflow
40
+ }
41
+ }
42
+ //# sourceMappingURL=checkVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["jsVersion","checkVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","console","error","ok","match","jsMajor","jsMinor","split","cppMajor","cppMinor"],"sources":["checkVersion.ts"],"sourcesContent":["/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nconst jsVersion = '3.0.0';\n\n/**\n * Checks that native and js versions of reanimated match.\n */\nexport function checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n if (cppVersion === undefined) {\n console.error(\n `[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.`\n );\n return;\n }\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`\n );\n // TODO: detect Expo managed workflow\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,OAAlB;AAEA;AACA;AACA;;AACO,SAASC,YAAT,GAA8B;EACnC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAA1B;;EACA,IAAIF,UAAU,KAAKG,SAAnB,EAA8B;IAC5BC,OAAO,CAACC,KAAR,CACG,8OADH;IAGA;EACD;;EACD,MAAMC,EAAE,GAAG,CAAC,MAAM;IAChB,IACER,SAAS,CAACS,KAAV,CAAgB,iBAAhB,KACAP,UAAU,CAACO,KAAX,CAAiB,iBAAjB,CAFF,EAGE;MACA;MACA,MAAM,CAACC,OAAD,EAAUC,OAAV,IAAqBX,SAAS,CAACY,KAAV,CAAgB,GAAhB,CAA3B;MACA,MAAM,CAACC,QAAD,EAAWC,QAAX,IAAuBZ,UAAU,CAACU,KAAX,CAAiB,GAAjB,CAA7B;MACA,OAAOF,OAAO,KAAKG,QAAZ,IAAwBF,OAAO,KAAKG,QAA3C;IACD,CARD,MAQO;MACL;MACA,OAAOd,SAAS,KAAKE,UAArB;IACD;EACF,CAbU,GAAX;;EAcA,IAAI,CAACM,EAAL,EAAS;IACPF,OAAO,CAACC,KAAR,CACG,gFAA+EP,SAAU,QAAOE,UAAW,4HAA2HA,UAAW,kCADpP,EADO,CAIP;EACD;AACF"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.checkVersion = checkVersion;
7
+
8
+ /* eslint-disable @typescript-eslint/no-empty-function */
9
+
10
+ /**
11
+ * Checks that native and js versions of reanimated match.
12
+ * Stubbed for web, where this check is unnecessary.
13
+ */
14
+ function checkVersion() {}
15
+ //# sourceMappingURL=checkVersion.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["checkVersion"],"sources":["checkVersion.web.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n/**\n * Checks that native and js versions of reanimated match.\n * Stubbed for web, where this check is unnecessary.\n */\nexport function checkVersion(): void {}\n"],"mappings":";;;;;;;AAAA;;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,GAA8B,CAAE"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getUseOfValueInStyleWarning = getUseOfValueInStyleWarning;
7
+
8
+ function getUseOfValueInStyleWarning() {
9
+ return "It looks like you might be using shared value's .value inside reanimated inline style. " + 'If you want a component to update when shared value changes you should use the shared value' + ' directly instead of its current state represented by `.value`. See documentation here: ' + 'https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/animations#animations-in-inline-styles';
10
+ }
11
+ //# sourceMappingURL=pluginUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getUseOfValueInStyleWarning"],"sources":["pluginUtils.ts"],"sourcesContent":["export function getUseOfValueInStyleWarning() {\n return (\n \"It looks like you might be using shared value's .value inside reanimated inline style. \" +\n 'If you want a component to update when shared value changes you should use the shared value' +\n ' directly instead of its current state represented by `.value`. See documentation here: ' +\n 'https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/animations#animations-in-inline-styles'\n );\n}\n"],"mappings":";;;;;;;AAAO,SAASA,2BAAT,GAAuC;EAC5C,OACE,4FACA,6FADA,GAEA,0FAFA,GAGA,6GAJF;AAMD"}
@@ -6,13 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.makeShareable = makeShareable;
7
7
  exports.makeShareableCloneOnUIRecursive = makeShareableCloneOnUIRecursive;
8
8
  exports.makeShareableCloneRecursive = makeShareableCloneRecursive;
9
- exports.makeShareableShadowNodeWrapper = makeShareableShadowNodeWrapper;
10
9
  exports.registerShareableMapping = registerShareableMapping;
11
10
 
12
11
  var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
13
12
 
14
13
  var _PlatformChecker = require("./PlatformChecker");
15
14
 
15
+ var _errors = require("./errors");
16
+
16
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18
 
18
19
  // for web/chrome debugger/jest environments this file provides a stub implementation
@@ -27,6 +28,16 @@ const _shareableCache = new WeakMap(); // the below symbol is used to represent
27
28
 
28
29
  const _shareableFlag = Symbol('shareable flag');
29
30
 
31
+ const MAGIC_KEY = 'REANIMATED_MAGIC_KEY';
32
+
33
+ function isHostObject(value) {
34
+ // We could use JSI to determine whether an object is a host object, however
35
+ // the below workaround works well and is way faster than an additional JSI call.
36
+ // We use the fact that host objects have broken implementation of `hasOwnProperty`
37
+ // and hence return true for all `in` checks regardless of the key we ask for.
38
+ return MAGIC_KEY in value;
39
+ }
40
+
30
41
  function registerShareableMapping(shareable, shareableRef) {
31
42
  if (USE_STUB_IMPLEMENTATION) {
32
43
  return;
@@ -35,14 +46,9 @@ function registerShareableMapping(shareable, shareableRef) {
35
46
  _shareableCache.set(shareable, shareableRef || _shareableFlag);
36
47
  }
37
48
 
38
- function makeShareableShadowNodeWrapper(shadowNodeWrapper) {
39
- const adoptedSNW = _NativeReanimated.default.makeShareableClone(shadowNodeWrapper);
40
-
41
- registerShareableMapping(shadowNodeWrapper, adoptedSNW);
42
- return shadowNodeWrapper;
43
- }
44
-
45
49
  function makeShareableCloneRecursive(value) {
50
+ let shouldPersistRemote = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
51
+
46
52
  if (USE_STUB_IMPLEMENTATION) {
47
53
  return value;
48
54
  } // This one actually may be worth to be moved to c++, we also need similar logic to run on the UI thread
@@ -65,9 +71,30 @@ function makeShareableCloneRecursive(value) {
65
71
  } else if (type === 'function' && value.__workletHash === undefined) {
66
72
  // this is a remote function
67
73
  toAdapt = value;
74
+ } else if (isHostObject(value)) {
75
+ // for host objects we pass the reference to the object as shareable and
76
+ // then recreate new host object wrapping the same instance on the UI thread.
77
+ // there is no point of iterating over keys as we do for regular objects.
78
+ toAdapt = value;
68
79
  } else {
69
80
  toAdapt = {};
70
81
 
82
+ if (value.__workletHash !== undefined) {
83
+ // we are converting a worklet
84
+ if (__DEV__) {
85
+ (0, _errors.registerWorkletStackDetails)(value.__workletHash, value.__stackDetails);
86
+ delete value.__stackDetails;
87
+ } // to save on transferring static __initData field of worklet structure
88
+ // we request shareable value to persist its UI counterpart. This means
89
+ // that the __initData field that contains long strings represeting the
90
+ // worklet code, source map, and location, will always be
91
+ // serialized/deserialized once.
92
+
93
+
94
+ toAdapt.__initData = makeShareableCloneRecursive(value.__initData, true);
95
+ delete value.__initData;
96
+ }
97
+
71
98
  for (const [key, element] of Object.entries(value)) {
72
99
  toAdapt[key] = makeShareableCloneRecursive(element);
73
100
  }
@@ -79,11 +106,11 @@ function makeShareableCloneRecursive(value) {
79
106
  // shareable. Meaning that they may be doing a faulty assumption in their
80
107
  // code expecting that the updates are going to automatically populate to
81
108
  // the object sent to the UI thread. If the user really wants some objects
82
- // to be mutable they should use share values instead.
109
+ // to be mutable they should use shared values instead.
83
110
  Object.freeze(value);
84
111
  }
85
112
 
86
- const adopted = _NativeReanimated.default.makeShareableClone(toAdapt);
113
+ const adopted = _NativeReanimated.default.makeShareableClone(toAdapt, shouldPersistRemote);
87
114
 
88
115
  _shareableCache.set(value, adopted);
89
116
 
@@ -93,7 +120,7 @@ function makeShareableCloneRecursive(value) {
93
120
  }
94
121
  }
95
122
 
96
- return _NativeReanimated.default.makeShareableClone(value);
123
+ return _NativeReanimated.default.makeShareableClone(value, shouldPersistRemote);
97
124
  }
98
125
 
99
126
  function makeShareableCloneOnUIRecursive(value) {