react-native-reanimated 3.0.2 → 3.1.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 (473) hide show
  1. package/Common/cpp/Fabric/FabricUtils.h +1 -1
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -27
  3. package/Common/cpp/SharedItems/Shareables.h +22 -0
  4. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +2 -0
  5. package/Common/cpp/Tools/RuntimeDecorator.cpp +4 -1
  6. package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
  7. package/Common/cpp/Tools/SingleInstanceChecker.h +14 -2
  8. package/RNReanimated.podspec +5 -2
  9. package/android/CMakeLists.txt +4 -0
  10. package/android/build.gradle +18 -10
  11. package/android/src/main/cpp/NativeProxy.cpp +316 -337
  12. package/android/src/main/cpp/NativeProxy.h +53 -11
  13. package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +7 -12
  14. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +11 -8
  15. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +21 -14
  16. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +0 -3
  17. package/ios/Fabric/REAInitializerRCTFabricSurface.mm +1 -0
  18. package/ios/REANodesManager.h +1 -0
  19. package/ios/REANodesManager.mm +30 -4
  20. package/ios/keyboardObserver/REAKeyboardEventObserver.m +51 -130
  21. package/ios/native/NativeMethods.mm +1 -1
  22. package/ios/native/NativeProxy.mm +4 -1
  23. package/ios/native/REAIOSErrorHandler.mm +1 -1
  24. package/ios/native/REAIOSLogger.mm +1 -1
  25. package/ios/native/REAIOSScheduler.mm +1 -1
  26. package/ios/native/REAInitializer.mm +1 -1
  27. package/ios/native/REAMessageThread.mm +2 -2
  28. package/lib/commonjs/Animated.js +0 -8
  29. package/lib/commonjs/Animated.js.map +1 -1
  30. package/lib/commonjs/ConfigHelper.js +8 -19
  31. package/lib/commonjs/ConfigHelper.js.map +1 -1
  32. package/lib/commonjs/createAnimatedComponent.js +20 -158
  33. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  34. package/lib/commonjs/index.js +0 -9
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/index.web.js +0 -7
  37. package/lib/commonjs/index.web.js.map +1 -1
  38. package/lib/commonjs/reanimated2/Bezier.js +14 -34
  39. package/lib/commonjs/reanimated2/Bezier.js.map +1 -1
  40. package/lib/commonjs/reanimated2/Colors.js +60 -132
  41. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  42. package/lib/commonjs/reanimated2/Easing.js +81 -34
  43. package/lib/commonjs/reanimated2/Easing.js.map +1 -1
  44. package/lib/commonjs/reanimated2/NativeMethods.js +8 -20
  45. package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
  46. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +5 -31
  47. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  48. package/lib/commonjs/reanimated2/NativeReanimated/index.js +0 -7
  49. package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -1
  50. package/lib/commonjs/reanimated2/PlatformChecker.js +0 -6
  51. package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -1
  52. package/lib/commonjs/reanimated2/PropAdapters.js +10 -12
  53. package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -1
  54. package/lib/commonjs/reanimated2/UpdateProps.js +3 -12
  55. package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -1
  56. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +0 -10
  57. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
  58. package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -22
  59. package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
  60. package/lib/commonjs/reanimated2/animation/decay.js +7 -18
  61. package/lib/commonjs/reanimated2/animation/decay.js.map +1 -1
  62. package/lib/commonjs/reanimated2/animation/delay.js +0 -11
  63. package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
  64. package/lib/commonjs/reanimated2/animation/index.js +0 -8
  65. package/lib/commonjs/reanimated2/animation/index.js.map +1 -1
  66. package/lib/commonjs/reanimated2/animation/repeat.js +6 -22
  67. package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
  68. package/lib/commonjs/reanimated2/animation/sequence.js +3 -20
  69. package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
  70. package/lib/commonjs/reanimated2/animation/spring.js +11 -23
  71. package/lib/commonjs/reanimated2/animation/spring.js.map +1 -1
  72. package/lib/commonjs/reanimated2/animation/styleAnimation.js +3 -35
  73. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  74. package/lib/commonjs/reanimated2/animation/timing.js +0 -11
  75. package/lib/commonjs/reanimated2/animation/timing.js.map +1 -1
  76. package/lib/commonjs/reanimated2/animation/util.js +11 -41
  77. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  78. package/lib/commonjs/reanimated2/commonTypes.js +16 -23
  79. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  80. package/lib/commonjs/reanimated2/component/FlatList.js +0 -16
  81. package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
  82. package/lib/commonjs/reanimated2/component/Image.js +0 -4
  83. package/lib/commonjs/reanimated2/component/Image.js.map +1 -1
  84. package/lib/commonjs/reanimated2/component/ScrollView.js +0 -4
  85. package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -1
  86. package/lib/commonjs/reanimated2/component/Text.js +0 -4
  87. package/lib/commonjs/reanimated2/component/Text.js.map +1 -1
  88. package/lib/commonjs/reanimated2/component/View.js +0 -4
  89. package/lib/commonjs/reanimated2/component/View.js.map +1 -1
  90. package/lib/commonjs/reanimated2/core.js +6 -48
  91. package/lib/commonjs/reanimated2/core.js.map +1 -1
  92. package/lib/commonjs/reanimated2/errors.js +3 -14
  93. package/lib/commonjs/reanimated2/errors.js.map +1 -1
  94. package/lib/commonjs/reanimated2/fabricUtils.js +3 -5
  95. package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -1
  96. package/lib/commonjs/reanimated2/fabricUtils.web.js +1 -3
  97. package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -1
  98. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -12
  99. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  100. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -17
  101. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  102. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  103. package/lib/commonjs/reanimated2/hook/Hooks.js +0 -5
  104. package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -1
  105. package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -1
  106. package/lib/commonjs/reanimated2/hook/index.js +0 -12
  107. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  108. package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +4 -17
  109. package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +2 -9
  111. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +1 -11
  113. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  114. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +0 -12
  115. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  116. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +2 -9
  117. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  118. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +8 -23
  119. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  120. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +13 -71
  121. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  122. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +4 -13
  123. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  124. package/lib/commonjs/reanimated2/hook/useFrameCallback.js +0 -5
  125. package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
  126. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +0 -7
  127. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  128. package/lib/commonjs/reanimated2/hook/useSharedValue.js +2 -7
  129. package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
  130. package/lib/commonjs/reanimated2/hook/utils.js +8 -39
  131. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  132. package/lib/commonjs/reanimated2/index.js +0 -26
  133. package/lib/commonjs/reanimated2/index.js.map +1 -1
  134. package/lib/commonjs/reanimated2/initializers.js +21 -43
  135. package/lib/commonjs/reanimated2/initializers.js.map +1 -1
  136. package/lib/commonjs/reanimated2/interpolateColor.js +6 -43
  137. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  138. package/lib/commonjs/reanimated2/interpolation.js +14 -29
  139. package/lib/commonjs/reanimated2/interpolation.js.map +1 -1
  140. package/lib/commonjs/reanimated2/jestUtils.js +11 -44
  141. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  142. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +15 -39
  143. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  144. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +9 -28
  145. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  146. package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +7 -37
  147. package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
  148. package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +5 -18
  149. package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -1
  150. package/lib/commonjs/reanimated2/js-reanimated/global.js +2 -9
  151. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  152. package/lib/commonjs/reanimated2/js-reanimated/index.js +3 -14
  153. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  154. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -26
  155. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  156. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -49
  157. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  158. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -43
  159. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  160. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -5
  161. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  162. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +0 -4
  163. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  164. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +4 -23
  165. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  166. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -74
  167. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  168. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -53
  169. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  170. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -63
  171. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  172. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -26
  173. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  174. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -13
  175. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  176. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -23
  177. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  178. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -43
  179. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  180. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -43
  181. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  182. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -23
  183. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  184. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -83
  185. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  186. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -20
  187. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  188. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -22
  189. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  190. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -29
  191. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  192. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -9
  193. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  194. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -11
  195. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  196. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -8
  197. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  198. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -12
  199. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  200. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -12
  201. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  202. package/lib/commonjs/reanimated2/layoutReanimation/index.js +0 -9
  203. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  204. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -17
  205. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  206. package/lib/commonjs/reanimated2/mappers.js +26 -32
  207. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  208. package/lib/commonjs/reanimated2/mock.js +5 -15
  209. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  210. package/lib/commonjs/reanimated2/mutables.js +2 -28
  211. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  212. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +0 -2
  213. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  214. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  215. package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js +31 -0
  216. package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
  217. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +0 -2
  218. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
  219. package/lib/commonjs/reanimated2/platform-specific/jsVersion.js +14 -0
  220. package/lib/commonjs/reanimated2/platform-specific/jsVersion.js.map +1 -0
  221. package/lib/commonjs/reanimated2/pluginUtils.js +0 -1
  222. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -1
  223. package/lib/commonjs/reanimated2/shareables.js +92 -49
  224. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  225. package/lib/commonjs/reanimated2/threads.js +42 -46
  226. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  227. package/lib/commonjs/reanimated2/utils.js +0 -5
  228. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  229. package/lib/commonjs/reanimated2/valueSetter.js +6 -21
  230. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  231. package/lib/commonjs/setAndForwardRef.js +3 -3
  232. package/lib/commonjs/setAndForwardRef.js.map +1 -1
  233. package/lib/module/Animated.js.map +1 -1
  234. package/lib/module/ConfigHelper.js +9 -15
  235. package/lib/module/ConfigHelper.js.map +1 -1
  236. package/lib/module/createAnimatedComponent.js +20 -139
  237. package/lib/module/createAnimatedComponent.js.map +1 -1
  238. package/lib/module/index.js +0 -2
  239. package/lib/module/index.js.map +1 -1
  240. package/lib/module/index.web.js.map +1 -1
  241. package/lib/module/reanimated2/Bezier.js +14 -33
  242. package/lib/module/reanimated2/Bezier.js.map +1 -1
  243. package/lib/module/reanimated2/Colors.js +59 -109
  244. package/lib/module/reanimated2/Colors.js.map +1 -1
  245. package/lib/module/reanimated2/Easing.js +37 -33
  246. package/lib/module/reanimated2/Easing.js.map +1 -1
  247. package/lib/module/reanimated2/NativeMethods.js +8 -15
  248. package/lib/module/reanimated2/NativeMethods.js.map +1 -1
  249. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +5 -27
  250. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  251. package/lib/module/reanimated2/NativeReanimated/index.js +0 -2
  252. package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
  253. package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
  254. package/lib/module/reanimated2/PropAdapters.js +12 -10
  255. package/lib/module/reanimated2/PropAdapters.js.map +1 -1
  256. package/lib/module/reanimated2/UpdateProps.js +3 -5
  257. package/lib/module/reanimated2/UpdateProps.js.map +1 -1
  258. package/lib/module/reanimated2/ViewDescriptorsSet.js +0 -6
  259. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  260. package/lib/module/reanimated2/WorkletEventHandler.js +5 -18
  261. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  262. package/lib/module/reanimated2/animation/decay.js +7 -15
  263. package/lib/module/reanimated2/animation/decay.js.map +1 -1
  264. package/lib/module/reanimated2/animation/delay.js +0 -9
  265. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  266. package/lib/module/reanimated2/animation/index.js.map +1 -1
  267. package/lib/module/reanimated2/animation/repeat.js +6 -20
  268. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  269. package/lib/module/reanimated2/animation/sequence.js +3 -18
  270. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  271. package/lib/module/reanimated2/animation/spring.js +11 -21
  272. package/lib/module/reanimated2/animation/spring.js.map +1 -1
  273. package/lib/module/reanimated2/animation/styleAnimation.js +7 -31
  274. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  275. package/lib/module/reanimated2/animation/timing.js +0 -8
  276. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  277. package/lib/module/reanimated2/animation/util.js +10 -33
  278. package/lib/module/reanimated2/animation/util.js.map +1 -1
  279. package/lib/module/reanimated2/commonTypes.js +12 -19
  280. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  281. package/lib/module/reanimated2/component/FlatList.js +0 -4
  282. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  283. package/lib/module/reanimated2/component/Image.js.map +1 -1
  284. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  285. package/lib/module/reanimated2/component/Text.js.map +1 -1
  286. package/lib/module/reanimated2/component/View.js.map +1 -1
  287. package/lib/module/reanimated2/core.js +6 -22
  288. package/lib/module/reanimated2/core.js.map +1 -1
  289. package/lib/module/reanimated2/errors.js +3 -13
  290. package/lib/module/reanimated2/errors.js.map +1 -1
  291. package/lib/module/reanimated2/fabricUtils.js +3 -3
  292. package/lib/module/reanimated2/fabricUtils.js.map +1 -1
  293. package/lib/module/reanimated2/fabricUtils.web.js +1 -1
  294. package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
  295. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -8
  296. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  297. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -15
  298. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  299. package/lib/module/reanimated2/globals.d.js.map +1 -1
  300. package/lib/module/reanimated2/hook/Hooks.js +3 -2
  301. package/lib/module/reanimated2/hook/Hooks.js.map +1 -1
  302. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
  303. package/lib/module/reanimated2/hook/index.js.map +1 -1
  304. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +3 -14
  305. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  306. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +2 -5
  307. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  308. package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -7
  309. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  310. package/lib/module/reanimated2/hook/useAnimatedRef.js +0 -6
  311. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  312. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +2 -7
  313. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  314. package/lib/module/reanimated2/hook/useAnimatedSensor.js +9 -20
  315. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  316. package/lib/module/reanimated2/hook/useAnimatedStyle.js +13 -59
  317. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  318. package/lib/module/reanimated2/hook/useDerivedValue.js +4 -8
  319. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  320. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  321. package/lib/module/reanimated2/hook/useScrollViewOffset.js +0 -1
  322. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  323. package/lib/module/reanimated2/hook/useSharedValue.js +2 -3
  324. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  325. package/lib/module/reanimated2/hook/utils.js +8 -21
  326. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  327. package/lib/module/reanimated2/index.js.map +1 -1
  328. package/lib/module/reanimated2/initializers.js +23 -37
  329. package/lib/module/reanimated2/initializers.js.map +1 -1
  330. package/lib/module/reanimated2/interpolateColor.js +5 -34
  331. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  332. package/lib/module/reanimated2/interpolation.js +13 -28
  333. package/lib/module/reanimated2/interpolation.js.map +1 -1
  334. package/lib/module/reanimated2/jestUtils.js +11 -35
  335. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  336. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +15 -35
  337. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  338. package/lib/module/reanimated2/js-reanimated/Mapper.js +9 -23
  339. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  340. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +7 -35
  341. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
  342. package/lib/module/reanimated2/js-reanimated/MutableValue.js +5 -16
  343. package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -1
  344. package/lib/module/reanimated2/js-reanimated/global.js +2 -6
  345. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  346. package/lib/module/reanimated2/js-reanimated/index.js +3 -9
  347. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  348. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -23
  349. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  350. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -45
  351. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  352. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -39
  353. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  354. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +3 -3
  355. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  356. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  357. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +4 -19
  358. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  359. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -52
  360. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  361. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -32
  362. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  363. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -38
  364. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  365. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -16
  366. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  367. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -8
  368. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  369. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -14
  370. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  371. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -26
  372. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  373. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -26
  374. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  375. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -14
  376. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  377. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -50
  378. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  379. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  380. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -17
  381. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  382. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -23
  383. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  384. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -5
  385. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  386. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -6
  387. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  388. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -5
  389. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  390. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -8
  391. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  392. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  393. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  394. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -13
  395. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  396. package/lib/module/reanimated2/mappers.js +26 -25
  397. package/lib/module/reanimated2/mappers.js.map +1 -1
  398. package/lib/module/reanimated2/mock.js +5 -15
  399. package/lib/module/reanimated2/mock.js.map +1 -1
  400. package/lib/module/reanimated2/mutables.js +2 -19
  401. package/lib/module/reanimated2/mutables.js.map +1 -1
  402. package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  403. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  404. package/lib/module/reanimated2/platform-specific/checkCppVersion.js +24 -0
  405. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
  406. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +0 -1
  407. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
  408. package/lib/module/reanimated2/platform-specific/jsVersion.js +7 -0
  409. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -0
  410. package/lib/module/reanimated2/pluginUtils.js.map +1 -1
  411. package/lib/module/reanimated2/shareables.js +96 -44
  412. package/lib/module/reanimated2/shareables.js.map +1 -1
  413. package/lib/module/reanimated2/threads.js +39 -33
  414. package/lib/module/reanimated2/threads.js.map +1 -1
  415. package/lib/module/reanimated2/utils.js +0 -3
  416. package/lib/module/reanimated2/utils.js.map +1 -1
  417. package/lib/module/reanimated2/valueSetter.js +6 -19
  418. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  419. package/lib/module/setAndForwardRef.js +3 -2
  420. package/lib/module/setAndForwardRef.js.map +1 -1
  421. package/package.json +46 -40
  422. package/plugin/.eslintrc.js +7 -0
  423. package/plugin/README.md +241 -0
  424. package/plugin/build/plugin.js +714 -0
  425. package/plugin/build/plugin.js.map +7 -0
  426. package/plugin/index.js +1 -807
  427. package/plugin/package.json +23 -0
  428. package/plugin/src/buildWorkletString.ts +213 -0
  429. package/plugin/src/commonObjects.ts +60 -0
  430. package/plugin/src/injectVersion.ts +37 -0
  431. package/plugin/src/makeWorklet.ts +375 -0
  432. package/plugin/src/plugin.ts +49 -0
  433. package/plugin/src/processForCalleesWorklets.ts +106 -0
  434. package/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts +156 -0
  435. package/plugin/src/processIfWorkletFunction.ts +55 -0
  436. package/plugin/src/processIfWorkletNode.ts +44 -0
  437. package/plugin/src/processInlineStylesWarning.ts +129 -0
  438. package/plugin/src/processWorkletObjectMethod.ts +31 -0
  439. package/plugin/src/types.ts +15 -0
  440. package/plugin/src/utils.ts +6 -0
  441. package/plugin/tsconfig.json +15 -0
  442. package/plugin/yarn.lock +2193 -0
  443. package/react-native-reanimated.d.ts +1 -0
  444. package/scripts/reanimated_utils.rb +2 -2
  445. package/src/createAnimatedComponent.tsx +2 -3
  446. package/src/reanimated2/Easing.ts +19 -0
  447. package/src/reanimated2/NativeMethods.ts +9 -4
  448. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +2 -2
  449. package/src/reanimated2/UpdateProps.ts +2 -2
  450. package/src/reanimated2/animation/decay.ts +7 -1
  451. package/src/reanimated2/animation/styleAnimation.ts +5 -1
  452. package/src/reanimated2/core.ts +4 -4
  453. package/src/reanimated2/errors.ts +1 -0
  454. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +12 -4
  455. package/src/reanimated2/globals.d.ts +71 -112
  456. package/src/reanimated2/hook/commonTypes.ts +1 -1
  457. package/src/reanimated2/hook/useAnimatedReaction.ts +2 -2
  458. package/src/reanimated2/hook/useAnimatedSensor.ts +2 -2
  459. package/src/reanimated2/initializers.ts +11 -8
  460. package/src/reanimated2/jestUtils.ts +0 -1
  461. package/src/reanimated2/js-reanimated/JSReanimated.ts +5 -1
  462. package/src/reanimated2/js-reanimated/index.ts +1 -1
  463. package/src/reanimated2/mappers.ts +26 -4
  464. package/src/reanimated2/mock.ts +1 -0
  465. package/src/reanimated2/platform-specific/checkCppVersion.ts +29 -0
  466. package/src/reanimated2/platform-specific/jsVersion.ts +6 -0
  467. package/src/reanimated2/shareables.ts +107 -8
  468. package/src/reanimated2/threads.ts +36 -17
  469. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +0 -42
  470. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +0 -1
  471. package/lib/module/reanimated2/platform-specific/checkVersion.js +0 -35
  472. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +0 -1
  473. package/src/reanimated2/platform-specific/checkVersion.ts +0 -39
@@ -1 +1 @@
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(_: (finished: 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"],"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A+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"}
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","steps","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(_: (finished: 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 steps: 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,GAAGA,CAAA,KAAM;EACjB;AAAA,CACD;AACD,MAAMC,EAAE,GAAIC,CAAC,IAAKA,CAAC;AACnB,MAAMC,uBAAuB,GAAIC,EAAiB,IAAKA,EAAE,EAAE;AAE3D,MAAMC,iBAAiB,CAAC;EACtBC,QAAQA,CAACC,CAAS,EAAE;IAClB,OAAO,IAAI;EACb;EAEAC,KAAKA,CAACD,CAAS,EAAE;IACf,OAAO,IAAI;EACb;EAEAE,SAASA,CAACF,CAAS,EAAE;IACnB,OAAO,IAAI;EACb;EAEAG,OAAOA,CAACH,CAAS,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WAAW,EACX,aAAa,EAEb,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EAEd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,EAEZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,EACf,iBAAiB,EAEjB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAEhB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EAEnB,aAAa,EAEb,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAElB,aAAa,EACb,aAAa,EACb,cAAc,EAEd,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,CACtB,CAACE,OAAO,CAAEC,CAAC,IACVC,MAAM,CAACC,MAAM,CAAC3D,YAAY,EAAE;EAC1B,CAACyD,CAAC,GAAG,IAAItE,iBAAiB;AAC5B,CAAC,CAAC,CACH;AAEDyE,MAAM,CAACC,OAAO,GAAG;EACf,GAAG7D;AACL,CAAC"}
@@ -12,19 +12,12 @@ Object.defineProperty(exports, "stopMapper", {
12
12
  return _mappers.stopMapper;
13
13
  }
14
14
  });
15
-
16
15
  var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
17
-
18
16
  var _shareables = require("./shareables");
19
-
20
17
  var _threads = require("./threads");
21
-
22
18
  var _valueSetter = require("./valueSetter");
23
-
24
19
  var _mappers = require("./mappers");
25
-
26
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
21
  function makeUIMutable(initial, syncDataHolder) {
29
22
  'worklet';
30
23
 
@@ -34,11 +27,9 @@ function makeUIMutable(initial, syncDataHolder) {
34
27
  set value(newValue) {
35
28
  (0, _valueSetter.valueSetter)(self, newValue);
36
29
  },
37
-
38
30
  get value() {
39
31
  return value;
40
32
  },
41
-
42
33
  /**
43
34
  * _value prop should only be accessed by the valueSetter implementation
44
35
  * which may make the decision about updating the mutable value depending
@@ -47,20 +38,16 @@ function makeUIMutable(initial, syncDataHolder) {
47
38
  */
48
39
  set _value(newValue) {
49
40
  value = newValue;
50
-
51
41
  if (syncDataHolder) {
52
42
  _updateDataSynchronously(syncDataHolder, (0, _shareables.makeShareableCloneOnUIRecursive)(newValue));
53
43
  }
54
-
55
44
  listeners.forEach(listener => {
56
45
  listener(newValue);
57
46
  });
58
47
  },
59
-
60
48
  get _value() {
61
49
  return value;
62
50
  },
63
-
64
51
  addListener: (id, listener) => {
65
52
  listeners.set(id, listener);
66
53
  },
@@ -72,26 +59,23 @@ function makeUIMutable(initial, syncDataHolder) {
72
59
  };
73
60
  return self;
74
61
  }
75
-
76
62
  function makeMutable(initial) {
77
63
  let oneWayReadsOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
78
64
  let value = initial;
79
65
  let syncDataHolder;
80
-
81
66
  if (!oneWayReadsOnly && _NativeReanimated.default.native) {
82
67
  // updates are always synchronous when running on web or in Jest environment
83
68
  syncDataHolder = _NativeReanimated.default.makeSynchronizedDataHolder((0, _shareables.makeShareableCloneRecursive)(value));
84
69
  (0, _shareables.registerShareableMapping)(syncDataHolder);
85
70
  }
86
-
87
71
  const handle = (0, _shareables.makeShareableCloneRecursive)({
88
72
  __init: () => {
89
73
  'worklet';
90
74
 
91
75
  return makeUIMutable(initial, syncDataHolder);
92
76
  }
93
- }); // listeners can only work on JS thread on Web and jest environments
94
-
77
+ });
78
+ // listeners can only work on JS thread on Web and jest environments
95
79
  const listeners = _NativeReanimated.default.native ? undefined : new Map();
96
80
  const mutable = {
97
81
  set value(newValue) {
@@ -105,34 +89,27 @@ function makeMutable(initial) {
105
89
  (0, _valueSetter.valueSetter)(mutable, newValue);
106
90
  }
107
91
  },
108
-
109
92
  get value() {
110
93
  if (syncDataHolder) {
111
94
  return _NativeReanimated.default.getDataSynchronously(syncDataHolder);
112
95
  }
113
-
114
96
  return value;
115
97
  },
116
-
117
98
  set _value(newValue) {
118
99
  if (_NativeReanimated.default.native) {
119
100
  throw new Error('Setting `_value` directly is only possible on the UI runtime');
120
101
  }
121
-
122
102
  value = newValue;
123
103
  listeners.forEach(listener => {
124
104
  listener(newValue);
125
105
  });
126
106
  },
127
-
128
107
  get _value() {
129
108
  if (_NativeReanimated.default.native) {
130
109
  throw new Error('Reading from `_value` directly is only possible on the UI runtime');
131
110
  }
132
-
133
111
  return value;
134
112
  },
135
-
136
113
  modify: modifier => {
137
114
  (0, _threads.runOnUI)(() => {
138
115
  'worklet';
@@ -144,14 +121,12 @@ function makeMutable(initial) {
144
121
  if (_NativeReanimated.default.native) {
145
122
  throw new Error('adding listeners is only possible on the UI runtime');
146
123
  }
147
-
148
124
  listeners.set(id, listener);
149
125
  },
150
126
  removeListener: id => {
151
127
  if (_NativeReanimated.default.native) {
152
128
  throw new Error('removing listeners is only possible on the UI runtime');
153
129
  }
154
-
155
130
  listeners.delete(id);
156
131
  },
157
132
  _isReanimatedSharedValue: true
@@ -159,7 +134,6 @@ function makeMutable(initial) {
159
134
  (0, _shareables.registerShareableMapping)(mutable, handle);
160
135
  return mutable;
161
136
  }
162
-
163
137
  function makeRemote() {
164
138
  let initial = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
165
139
  const handle = (0, _shareables.makeShareableCloneRecursive)({
@@ -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","_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,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AT,CAAxB;MACD,CAHD;IAID,CAzCa;IA0CdS,WAAW,EAAE,CAACC,EAAD,EAAaF,QAAb,KAA8C;MACzD,IAAIU,yBAAA,CAAuBC,MAA3B,EAAmC;QACjC,MAAM,IAAIU,KAAJ,CAAU,qDAAV,CAAN;MACD;;MACD/B,SAAS,CAAEa,GAAX,CAAeD,EAAf,EAAmBF,QAAnB;IACD,CA/Ca;IAgDdI,cAAc,EAAGF,EAAD,IAAgB;MAC9B,IAAIQ,yBAAA,CAAuBC,MAA3B,EAAmC;QACjC,MAAM,IAAIU,KAAJ,CACJ,uDADI,CAAN;MAGD;;MACD/B,SAAS,CAAEe,MAAX,CAAkBH,EAAlB;IACD,CAvDa;IAwDdK,wBAAwB,EAAE;EAxDZ,CAAhB;EA0DA,IAAAO,oCAAA,EAAyBI,OAAzB,EAAkCH,MAAlC;EACA,OAAOG,OAAP;AACD;;AAEM,SAASM,UAAT,GAA+D;EAAA,IAAzBpC,OAAyB,uEAAZ,EAAY;EACpE,MAAM2B,MAAM,GAAG,IAAAF,uCAAA,EAA4B;IACzCG,MAAM,EAAE,MAAM;MACZ;;MACA,OAAO5B,OAAP;IACD;EAJwC,CAA5B,CAAf;EAMA,IAAA0B,oCAAA,EAAyB1B,OAAzB,EAAkC2B,MAAlC;EACA,OAAO3B,OAAP;AACD"}
1
+ {"version":3,"names":["_NativeReanimated","_interopRequireDefault","require","_shareables","_threads","_valueSetter","_mappers","obj","__esModule","default","makeUIMutable","initial","syncDataHolder","listeners","Map","value","self","newValue","valueSetter","_value","_updateDataSynchronously","makeShareableCloneOnUIRecursive","forEach","listener","addListener","id","set","removeListener","delete","_animation","_isReanimatedSharedValue","makeMutable","oneWayReadsOnly","arguments","length","undefined","NativeReanimatedModule","native","makeSynchronizedDataHolder","makeShareableCloneRecursive","registerShareableMapping","handle","__init","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,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAuC,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,SAASG,aAAaA,CAC3BC,OAAU,EACVC,cAA8C,EAC9C;EACA,SAAS;;EAET,MAAMC,SAAS,GAAG,IAAIC,GAAG,EAAE;EAC3B,IAAIC,KAAK,GAAGJ,OAAO;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AS;;QACTD,OAAO,CAAC5B,KAAK,GAAGiC,QAAQ,CAACL,OAAO,CAAC5B,KAAK,CAAC;MACzC,CAAC,CAAC,EAAE;IACN,CAAC;IACDS,WAAW,EAAEA,CAACC,EAAU,EAAEF,QAA4B,KAAK;MACzD,IAAIa,yBAAsB,CAACC,MAAM,EAAE;QACjC,MAAM,IAAIS,KAAK,CAAC,qDAAqD,CAAC;MACxE;MACAjC,SAAS,CAAEa,GAAG,CAACD,EAAE,EAAEF,QAAQ,CAAC;IAC9B,CAAC;IACDI,cAAc,EAAGF,EAAU,IAAK;MAC9B,IAAIW,yBAAsB,CAACC,MAAM,EAAE;QACjC,MAAM,IAAIS,KAAK,CACb,uDAAuD,CACxD;MACH;MACAjC,SAAS,CAAEe,MAAM,CAACH,EAAE,CAAC;IACvB,CAAC;IACDK,wBAAwB,EAAE;EAC5B,CAAC;EACD,IAAAU,oCAAwB,EAACG,OAAO,EAAEF,MAAM,CAAC;EACzC,OAAOE,OAAO;AAChB;AAEO,SAASM,UAAUA,CAAA,EAA4C;EAAA,IAAzBtC,OAAU,GAAAsB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC1D,MAAMQ,MAAM,GAAG,IAAAF,uCAA2B,EAAC;IACzCG,MAAM,EAAEA,CAAA,KAAM;MACZ,SAAS;;MACT,OAAO/B,OAAO;IAChB;EACF,CAAC,CAAC;EACF,IAAA6B,oCAAwB,EAAC7B,OAAO,EAAE8B,MAAM,CAAC;EACzC,OAAO9B,OAAO;AAChB"}
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "RNRenderer", {
9
9
  return _ReactNative.default;
10
10
  }
11
11
  });
12
-
13
12
  var _ReactNative = _interopRequireDefault(require("react-native/Libraries/Renderer/shims/ReactNative"));
14
-
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
14
  //# sourceMappingURL=RNRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["RNRenderer.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nexport { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';\n"],"mappings":";;;;;;;;;;;;AAEA"}
1
+ {"version":3,"names":["_ReactNative","_interopRequireDefault","require","obj","__esModule","default"],"sources":["RNRenderer.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nexport { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0F,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["module","exports"],"sources":["RNRenderer.web.ts"],"sourcesContent":["// RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.\nmodule.exports = null;\n"],"mappings":";;AAAA;AACAA,MAAM,CAACC,OAAP,GAAiB,IAAjB"}
1
+ {"version":3,"names":["module","exports"],"sources":["RNRenderer.web.ts"],"sourcesContent":["// RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.\nmodule.exports = null;\n"],"mappings":";;AAAA;AACAA,MAAM,CAACC,OAAO,GAAG,IAAI"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.checkCppVersion = checkCppVersion;
7
+ exports.matchVersion = matchVersion;
8
+ var _jsVersion = require("./jsVersion");
9
+ function checkCppVersion() {
10
+ const cppVersion = global._REANIMATED_VERSION_CPP;
11
+ if (cppVersion === undefined) {
12
+ 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.`);
13
+ return;
14
+ }
15
+ const ok = matchVersion(_jsVersion.jsVersion, cppVersion);
16
+ if (!ok) {
17
+ console.error(`[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${_jsVersion.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.`);
18
+ }
19
+ }
20
+ function matchVersion(version1, version2) {
21
+ if (version1.match(/^\d+\.\d+\.\d+$/) && version2.match(/^\d+\.\d+\.\d+$/)) {
22
+ // x.y.z, compare only major and minor, skip patch
23
+ const [major1, minor1] = version1.split('.');
24
+ const [major2, minor2] = version2.split('.');
25
+ return major1 === major2 && minor1 === minor2;
26
+ } else {
27
+ // alpha, beta or rc, compare everything
28
+ return version1 === version2;
29
+ }
30
+ }
31
+ //# sourceMappingURL=checkCppVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_jsVersion","require","checkCppVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","console","error","ok","matchVersion","jsVersion","version1","version2","match","major1","minor1","split","major2","minor2"],"sources":["checkCppVersion.ts"],"sourcesContent":["import { jsVersion } from './jsVersion';\n\nexport function checkCppVersion() {\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 = matchVersion(jsVersion, cppVersion);\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 }\n}\n\nexport function matchVersion(version1: string, version2: string) {\n if (version1.match(/^\\d+\\.\\d+\\.\\d+$/) && version2.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n // x.y.z, compare only major and minor, skip patch\n const [major1, minor1] = version1.split('.');\n const [major2, minor2] = version2.split('.');\n return major1 === major2 && minor1 === minor2;\n } else {\n // alpha, beta or rc, compare everything\n return version1 === version2;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAAuB;EACjD,IAAIF,UAAU,KAAKG,SAAS,EAAE;IAC5BC,OAAO,CAACC,KAAK,CACV,8OAA6O,CAC/O;IACD;EACF;EACA,MAAMC,EAAE,GAAGC,YAAY,CAACC,oBAAS,EAAER,UAAU,CAAC;EAC9C,IAAI,CAACM,EAAE,EAAE;IACPF,OAAO,CAACC,KAAK,CACV,gFAA+EG,oBAAU,QAAOR,UAAW,4HAA2HA,UAAW,kCAAiC,CACpR;EACH;AACF;AAEO,SAASO,YAAYA,CAACE,QAAgB,EAAEC,QAAgB,EAAE;EAC/D,IAAID,QAAQ,CAACE,KAAK,CAAC,iBAAiB,CAAC,IAAID,QAAQ,CAACC,KAAK,CAAC,iBAAiB,CAAC,EAAE;IAC1E;IACA,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGJ,QAAQ,CAACK,KAAK,CAAC,GAAG,CAAC;IAC5C,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;IAC5C,OAAOF,MAAM,KAAKG,MAAM,IAAIF,MAAM,KAAKG,MAAM;EAC/C,CAAC,MAAM;IACL;IACA,OAAOP,QAAQ,KAAKC,QAAQ;EAC9B;AACF"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.checkVersion = checkVersion;
7
-
8
7
  /* eslint-disable @typescript-eslint/no-empty-function */
9
-
10
8
  /**
11
9
  * Checks that native and js versions of reanimated match.
12
10
  * Stubbed for web, where this check is unnecessary.
@@ -1 +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"}
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,YAAYA,CAAA,EAAS,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.jsVersion = void 0;
7
+ /**
8
+ * We hardcode the version of Reanimated here in order to compare it
9
+ * with the version used to build the native part of the library in runtime.
10
+ * Remember to keep this in sync with the version declared in `package.json`
11
+ */
12
+ const jsVersion = '3.1.0';
13
+ exports.jsVersion = jsVersion;
14
+ //# sourceMappingURL=jsVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["jsVersion","exports"],"sources":["jsVersion.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 */\nexport const jsVersion = '3.1.0';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,OAAO;AAACC,OAAA,CAAAD,SAAA,GAAAA,SAAA"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getUseOfValueInStyleWarning = getUseOfValueInStyleWarning;
7
-
8
7
  function getUseOfValueInStyleWarning() {
9
8
  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
9
  }
@@ -1 +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"}
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,2BAA2BA,CAAA,EAAG;EAC5C,OACE,yFAAyF,GACzF,6FAA6F,GAC7F,0FAA0F,GAC1F,6GAA6G;AAEjH"}
@@ -7,29 +7,21 @@ exports.makeShareable = makeShareable;
7
7
  exports.makeShareableCloneOnUIRecursive = makeShareableCloneOnUIRecursive;
8
8
  exports.makeShareableCloneRecursive = makeShareableCloneRecursive;
9
9
  exports.registerShareableMapping = registerShareableMapping;
10
-
11
10
  var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
12
-
13
11
  var _PlatformChecker = require("./PlatformChecker");
14
-
15
12
  var _errors = require("./errors");
16
-
13
+ var _jsVersion = require("./platform-specific/jsVersion");
17
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
15
  // for web/chrome debugger/jest environments this file provides a stub implementation
20
16
  // where no shareable references are used. Instead, the objects themselves are used
21
17
  // instead of shareable references, because of the fact that we don't have to deal with
22
18
  // runnning the code on separate VMs.
23
19
  const USE_STUB_IMPLEMENTATION = (0, _PlatformChecker.shouldBeUseWeb)();
24
-
25
- const _shareableCache = new WeakMap(); // the below symbol is used to represent a mapping from the value to itself
20
+ const _shareableCache = new WeakMap();
21
+ // the below symbol is used to represent a mapping from the value to itself
26
22
  // this is used to allow for a converted shareable to be passed to makeShareableClone
27
-
28
-
29
23
  const _shareableFlag = Symbol('shareable flag');
30
-
31
24
  const MAGIC_KEY = 'REANIMATED_MAGIC_KEY';
32
-
33
25
  function isHostObject(value) {
34
26
  // We could use JSI to determine whether an object is a host object, however
35
27
  // the below workaround works well and is way faster than an additional JSI call.
@@ -37,38 +29,89 @@ function isHostObject(value) {
37
29
  // and hence return true for all `in` checks regardless of the key we ask for.
38
30
  return MAGIC_KEY in value;
39
31
  }
40
-
41
32
  function registerShareableMapping(shareable, shareableRef) {
42
33
  if (USE_STUB_IMPLEMENTATION) {
43
34
  return;
44
35
  }
45
-
46
36
  _shareableCache.set(shareable, shareableRef || _shareableFlag);
47
37
  }
38
+ function isPlainJSObject(object) {
39
+ return Object.getPrototypeOf(object) === Object.prototype;
40
+ }
48
41
 
42
+ // The below object is used as a replacement for objects that cannot be transferred
43
+ // as shareable values. In makeShareableCloneRecursive we detect if an object is of
44
+ // a plain Object.prototype and only allow such objects to be transferred. This lets
45
+ // us avoid all sorts of react internals from leaking into the UI runtime. To make it
46
+ // possible to catch errors when someone actually tries to access such object on the UI
47
+ // runtime, we use the below Proxy object which is instantiated on the UI runtime and
48
+ // throws whenever someone tries to access its fields.
49
+ const INACCESSIBLE_OBJECT = {
50
+ __init: () => {
51
+ 'worklet';
52
+
53
+ return new Proxy({}, {
54
+ get: (_, prop) => {
55
+ if (prop === '_isReanimatedSharedValue') {
56
+ // not very happy about this check here, but we need to allow for
57
+ // "inaccessible" objects to be tested with isSharedValue check
58
+ // as it is being used in the mappers when extracing inputs recursively.
59
+ // Apparently we can't check if a key exists there as HostObjects always
60
+ // return true for such tests, so the only possibility for us is to
61
+ // actually access that key and see if it is set to true. We therefore
62
+ // need to allow for this key to be accessed here.
63
+ return false;
64
+ }
65
+ throw new Error(`Trying to access property \`${prop}\` of an object which cannot be sent to the UI runtime.`);
66
+ },
67
+ set: () => {
68
+ throw new Error('Trying to write to an object which cannot be sent to the UI runtime.');
69
+ }
70
+ });
71
+ }
72
+ };
73
+ const DETECT_CYCLIC_OBJECT_DEPTH_THRESHOLD = 30;
74
+ // Below variable stores object that we process in makeShareableCloneRecursive at the specified depth.
75
+ // We use it to check if later on the function reenters with the same object
76
+ let processedObjectAtThresholdDepth;
77
+
78
+ // We only want to show mismatch error once so we use this flag to track it
79
+ let didShowPluginVersionMismatchError = false;
49
80
  function makeShareableCloneRecursive(value) {
50
81
  let shouldPersistRemote = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
51
-
82
+ let depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
52
83
  if (USE_STUB_IMPLEMENTATION) {
53
84
  return value;
54
- } // This one actually may be worth to be moved to c++, we also need similar logic to run on the UI thread
55
-
56
-
85
+ }
86
+ if (depth >= DETECT_CYCLIC_OBJECT_DEPTH_THRESHOLD) {
87
+ // if we reach certain recursion depth we suspect that we are dealing with a cyclic object.
88
+ // this type of objects are not supported and cannot be trasferred as shareable, so we
89
+ // implement a simple detection mechanism that remembers the value at a given depth and
90
+ // tests whether we try reenter this method later on with the same value. If that happens
91
+ // we throw an appropriate error.
92
+ if (depth === DETECT_CYCLIC_OBJECT_DEPTH_THRESHOLD) {
93
+ processedObjectAtThresholdDepth = value;
94
+ } else if (value === processedObjectAtThresholdDepth) {
95
+ throw new Error('Trying to convert a cyclic object to a shareable. This is not supported.');
96
+ }
97
+ } else {
98
+ processedObjectAtThresholdDepth = undefined;
99
+ }
100
+ // This one actually may be worth to be moved to c++, we also need similar logic to run on the UI thread
57
101
  const type = typeof value;
58
-
59
- if ((type === 'object' || type === 'function') && value !== null) {
102
+ const isTypeObject = type === 'object';
103
+ const isTypeFunction = type === 'function';
104
+ if ((isTypeObject || isTypeFunction) && value !== null) {
60
105
  const cached = _shareableCache.get(value);
61
-
62
106
  if (cached === _shareableFlag) {
63
107
  return value;
64
108
  } else if (cached !== undefined) {
65
109
  return cached;
66
110
  } else {
67
111
  let toAdapt;
68
-
69
112
  if (Array.isArray(value)) {
70
- toAdapt = value.map(element => makeShareableCloneRecursive(element));
71
- } else if (type === 'function' && value.__workletHash === undefined) {
113
+ toAdapt = value.map(element => makeShareableCloneRecursive(element, shouldPersistRemote, depth + 1));
114
+ } else if (isTypeFunction && value.__workletHash === undefined) {
72
115
  // this is a remote function
73
116
  toAdapt = value;
74
117
  } else if (isHostObject(value)) {
@@ -76,30 +119,46 @@ function makeShareableCloneRecursive(value) {
76
119
  // then recreate new host object wrapping the same instance on the UI thread.
77
120
  // there is no point of iterating over keys as we do for regular objects.
78
121
  toAdapt = value;
79
- } else {
122
+ } else if (isPlainJSObject(value) || isTypeFunction) {
80
123
  toAdapt = {};
81
-
82
124
  if (value.__workletHash !== undefined) {
83
125
  // we are converting a worklet
84
126
  if (__DEV__) {
127
+ if (
128
+ // We don't want this error to be logged more than once.
129
+ !didShowPluginVersionMismatchError && value.__version !== _jsVersion.jsVersion) {
130
+ didShowPluginVersionMismatchError = true;
131
+ console.error(`[Reanimated] Mismatch between JavaScript code version and Reanimated Babel plugin version (${_jsVersion.jsVersion} vs. ${value.__version}). Please clear your Metro bundler cache with \`yarn start --reset-cache\`,
132
+ \`npm start -- --reset-cache\` or \`expo start -c\` and run the app again.`);
133
+ }
85
134
  (0, _errors.registerWorkletStackDetails)(value.__workletHash, value.__stackDetails);
86
135
  delete value.__stackDetails;
87
- } // to save on transferring static __initData field of worklet structure
136
+ }
137
+ // to save on transferring static __initData field of worklet structure
88
138
  // we request shareable value to persist its UI counterpart. This means
89
139
  // that the __initData field that contains long strings represeting the
90
140
  // worklet code, source map, and location, will always be
91
- // serialized/deserialized once.
92
-
93
-
141
+ // serialized/deserialized once. We don't increase depth when calling
142
+ // this method as these objects have one level anyways.
94
143
  toAdapt.__initData = makeShareableCloneRecursive(value.__initData, true);
95
144
  delete value.__initData;
96
145
  }
97
-
98
146
  for (const [key, element] of Object.entries(value)) {
99
- toAdapt[key] = makeShareableCloneRecursive(element);
147
+ toAdapt[key] = makeShareableCloneRecursive(element, shouldPersistRemote, depth + 1);
100
148
  }
149
+ } else {
150
+ // This is reached for object types that are not of plain Object.prototype.
151
+ // We don't support such objects from being transferred as shareables to
152
+ // the UI runtime and hence we replace them with "inaccessible object"
153
+ // which is implemented as a Proxy object that throws on any attempt
154
+ // of accessing its fields. We argue that such objects can sometimes leak
155
+ // as attributes of objects being captured by worklets but should never
156
+ // be used on the UI runtime regardless. If they are being accessed, the user
157
+ // will get an appropriate error message.
158
+ const inaccessibleObject = makeShareableCloneRecursive(INACCESSIBLE_OBJECT);
159
+ _shareableCache.set(value, inaccessibleObject);
160
+ return inaccessibleObject;
101
161
  }
102
-
103
162
  if (__DEV__) {
104
163
  // we freeze objects that are transformed to shareable. This should help
105
164
  // detect issues when someone modifies data after it's been converted to
@@ -109,20 +168,14 @@ function makeShareableCloneRecursive(value) {
109
168
  // to be mutable they should use shared values instead.
110
169
  Object.freeze(value);
111
170
  }
112
-
113
171
  const adopted = _NativeReanimated.default.makeShareableClone(toAdapt, shouldPersistRemote);
114
-
115
172
  _shareableCache.set(value, adopted);
116
-
117
173
  _shareableCache.set(adopted, _shareableFlag);
118
-
119
174
  return adopted;
120
175
  }
121
176
  }
122
-
123
177
  return _NativeReanimated.default.makeShareableClone(value, shouldPersistRemote);
124
178
  }
125
-
126
179
  function makeShareableCloneOnUIRecursive(value) {
127
180
  'worklet';
128
181
 
@@ -131,42 +184,32 @@ function makeShareableCloneOnUIRecursive(value) {
131
184
  // see more details in the comment where USE_STUB_IMPLEMENTATION is defined.
132
185
  return value;
133
186
  }
134
-
135
187
  function cloneRecursive(value) {
136
188
  const type = typeof value;
137
-
138
189
  if ((type === 'object' || type === 'function') && value !== null) {
139
190
  let toAdapt;
140
-
141
191
  if (Array.isArray(value)) {
142
192
  toAdapt = value.map(element => cloneRecursive(element));
143
- } else {
193
+ } else if (value !== undefined) {
144
194
  toAdapt = {};
145
-
146
195
  for (const [key, element] of Object.entries(value)) {
147
196
  toAdapt[key] = cloneRecursive(element);
148
197
  }
149
198
  }
150
-
151
199
  if (__DEV__) {
152
200
  // See the reasoning behind freezing in the other comment above.
153
201
  Object.freeze(value);
154
202
  }
155
-
156
203
  return _makeShareableClone(toAdapt);
157
204
  }
158
-
159
205
  return _makeShareableClone(value);
160
206
  }
161
-
162
207
  return cloneRecursive(value);
163
208
  }
164
-
165
209
  function makeShareable(value) {
166
210
  if (USE_STUB_IMPLEMENTATION) {
167
211
  return value;
168
212
  }
169
-
170
213
  const handle = makeShareableCloneRecursive({
171
214
  __init: () => {
172
215
  'worklet';