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":["findNodeHandle","isChromeDebugger","isWeb","shouldBeUseWeb","getTag","view","isNative","measure","animatedRef","element","viewportOffset","getBoundingClientRect","width","offsetWidth","height","offsetHeight","x","offsetLeft","y","offsetTop","pageX","left","pageY","top","_animatedRef","console","warn","_WORKLET","viewTag","measured","_measure","isNaN","dispatchCommand","commandName","args","shadowNodeWrapper","_dispatchCommand","scrollTo","animated","global","_IS_FABRIC","_scrollTo","_x","_y","setGestureState","handlerTag","newState","_setGestureState"],"sources":["NativeMethods.ts"],"sourcesContent":["/* global _WORKLET _measure _scrollTo _dispatchCommand _setGestureState */\nimport { Component } from 'react';\nimport { findNodeHandle } from 'react-native';\nimport { MeasuredDimensions } from './commonTypes';\nimport { RefObjectFunction } from './hook/commonTypes';\nimport { isChromeDebugger, isWeb, shouldBeUseWeb } from './PlatformChecker';\n\nexport function getTag(\n view: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number {\n return findNodeHandle(view);\n}\n\nconst isNative = !shouldBeUseWeb();\n\nexport let measure: (\n animatedRef: RefObjectFunction<Component>\n) => MeasuredDimensions | null;\n\nif (isWeb()) {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n const element = animatedRef() as unknown as HTMLElement; // TODO: fix typing of animated refs on web\n const viewportOffset = element.getBoundingClientRect();\n return {\n width: element.offsetWidth,\n height: element.offsetHeight,\n x: element.offsetLeft,\n y: element.offsetTop,\n pageX: viewportOffset.left,\n pageY: viewportOffset.top,\n };\n };\n} else if (isChromeDebugger()) {\n measure = (_animatedRef: RefObjectFunction<Component>) => {\n console.warn('[Reanimated] measure() cannot be used with Chrome Debugger.');\n return null;\n };\n} else {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n 'worklet';\n if (!_WORKLET) {\n console.warn(\n '[Reanimated] measure() was called from the main JS context. Measure is ' +\n 'only available in the UI runtime. This may also happen if measure() ' +\n 'was called by a worklet in the useAnimatedStyle hook, because useAnimatedStyle ' +\n 'calls the given worklet on the JS runtime during render. If you want to ' +\n 'prevent this warning then wrap the call with `if (_WORKLET)`. Then it will ' +\n 'only be called on the UI runtime after the render has been completed.'\n );\n return null;\n }\n\n const viewTag = animatedRef();\n if (viewTag === -1) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} is not a valid argument for measure(). This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n }\n\n const measured = _measure(viewTag);\n if (measured === null) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} has some undefined, not-yet-computed or meaningless value of \\`LayoutMetrics\\` type. This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n } else if (measured.x === -1234567) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} returned an invalid measurement response.`\n );\n return null;\n } else if (isNaN(measured.x)) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} gets view-flattened on Android. To disable view-flattening, set \\`collapsable={false}\\` on this component.`\n );\n return null;\n } else {\n return measured;\n }\n };\n}\n\nexport function dispatchCommand(\n animatedRef: RefObjectFunction<Component>,\n commandName: string,\n args: Array<unknown>\n): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n return;\n }\n const shadowNodeWrapper = animatedRef();\n _dispatchCommand(shadowNodeWrapper, commandName, args);\n}\n\nexport let scrollTo: (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n) => void;\n\nif (isWeb()) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n const element = animatedRef() as unknown as HTMLElement;\n // @ts-ignore same call as in react-native-web\n element.scrollTo({ x, y, animated });\n };\n} else if (isNative && global._IS_FABRIC) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n dispatchCommand(animatedRef, 'scrollTo', [x, y, animated]);\n };\n} else if (isNative) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n const viewTag = animatedRef();\n _scrollTo(viewTag, x, y, animated);\n };\n} else {\n scrollTo = (\n _animatedRef: RefObjectFunction<Component>,\n _x: number,\n _y: number\n ) => {\n // no-op\n };\n}\n\nexport function setGestureState(handlerTag: number, newState: number): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n console.warn(\n '[Reanimated] You can not use setGestureState in non-worklet function.'\n );\n return;\n }\n _setGestureState(handlerTag, newState);\n}\n"],"mappings":"AAAA;AAEA,SAASA,cAAT,QAA+B,cAA/B;AAGA,SAASC,gBAAT,EAA2BC,KAA3B,EAAkCC,cAAlC,QAAwD,mBAAxD;AAEA,OAAO,SAASC,MAAT,CACLC,IADK,EAEU;EACf,OAAOL,cAAc,CAACK,IAAD,CAArB;AACD;AAED,MAAMC,QAAQ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;IACD;;IACD,MAAMC,OAAO,GAAGpB,WAAW,EAA3B;;IACAiC,SAAS,CAACb,OAAD,EAAUZ,CAAV,EAAaE,CAAb,EAAgBoB,QAAhB,CAAT;EACD,CAZD;AAaD,CAdM,MAcA;EACLD,QAAQ,GAAG,CACTb,YADS,EAETkB,EAFS,EAGTC,EAHS,KAIN,CACH;EACD,CAND;AAOD;;AAED,OAAO,SAASC,eAAT,CAAyBC,UAAzB,EAA6CC,QAA7C,EAAqE;EAC1E;;EACA,IAAI,CAACnB,QAAD,IAAa,CAACrB,QAAlB,EAA4B;IAC1BmB,OAAO,CAACC,IAAR,CACE,uEADF;IAGA;EACD;;EACDqB,gBAAgB,CAACF,UAAD,EAAaC,QAAb,CAAhB;AACD"}
1
+ {"version":3,"names":["findNodeHandle","isChromeDebugger","isWeb","shouldBeUseWeb","getTag","view","isNative","measure","animatedRef","element","viewportOffset","getBoundingClientRect","width","offsetWidth","height","offsetHeight","x","offsetLeft","y","offsetTop","pageX","left","pageY","top","_animatedRef","console","warn","_WORKLET","viewTag","measured","_measure","isNaN","dispatchCommand","commandName","args","shadowNodeWrapper","_dispatchCommand","scrollTo","animated","global","_IS_FABRIC","_scrollTo","_x","_y","setGestureState","handlerTag","newState","_setGestureState"],"sources":["NativeMethods.ts"],"sourcesContent":["/* global _WORKLET _measure _scrollTo _dispatchCommand _setGestureState */\nimport { Component } from 'react';\nimport { findNodeHandle } from 'react-native';\nimport { MeasuredDimensions, ShadowNodeWrapper } from './commonTypes';\nimport { RefObjectFunction } from './hook/commonTypes';\nimport { isChromeDebugger, isWeb, shouldBeUseWeb } from './PlatformChecker';\n\nexport function getTag(\n view: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number {\n return findNodeHandle(view);\n}\n\nconst isNative = !shouldBeUseWeb();\n\nexport let measure: (\n animatedRef: RefObjectFunction<Component>\n) => MeasuredDimensions | null;\n\nif (isWeb()) {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n const element = animatedRef() as unknown as HTMLElement; // TODO: fix typing of animated refs on web\n const viewportOffset = element.getBoundingClientRect();\n return {\n width: element.offsetWidth,\n height: element.offsetHeight,\n x: element.offsetLeft,\n y: element.offsetTop,\n pageX: viewportOffset.left,\n pageY: viewportOffset.top,\n };\n };\n} else if (isChromeDebugger()) {\n measure = (_animatedRef: RefObjectFunction<Component>) => {\n console.warn('[Reanimated] measure() cannot be used with Chrome Debugger.');\n return null;\n };\n} else {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n 'worklet';\n if (!_WORKLET) {\n console.warn(\n '[Reanimated] measure() was called from the main JS context. Measure is ' +\n 'only available in the UI runtime. This may also happen if measure() ' +\n 'was called by a worklet in the useAnimatedStyle hook, because useAnimatedStyle ' +\n 'calls the given worklet on the JS runtime during render. If you want to ' +\n 'prevent this warning then wrap the call with `if (_WORKLET)`. Then it will ' +\n 'only be called on the UI runtime after the render has been completed.'\n );\n return null;\n }\n\n const viewTag = animatedRef();\n if (viewTag === -1) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} is not a valid argument for measure(). This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n }\n\n const measured = _measure(viewTag);\n if (measured === null) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} has some undefined, not-yet-computed or meaningless value of \\`LayoutMetrics\\` type. This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n } else if (measured.x === -1234567) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} returned an invalid measurement response.`\n );\n return null;\n } else if (isNaN(measured.x)) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} gets view-flattened on Android. To disable view-flattening, set \\`collapsable={false}\\` on this component.`\n );\n return null;\n } else {\n return measured;\n }\n };\n}\n\nexport function dispatchCommand(\n animatedRef: RefObjectFunction<Component>,\n commandName: string,\n args: Array<unknown>\n): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n return;\n }\n\n // dispatchCommand works only on Fabric where animatedRef returns\n // an object (ShadowNodeWrapper) and not a number\n const shadowNodeWrapper = animatedRef() as ShadowNodeWrapper;\n _dispatchCommand!(shadowNodeWrapper, commandName, args);\n}\n\nexport let scrollTo: (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n) => void;\n\nif (isWeb()) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n const element = animatedRef() as unknown as HTMLElement;\n // @ts-ignore same call as in react-native-web\n element.scrollTo({ x, y, animated });\n };\n} else if (isNative && global._IS_FABRIC) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n dispatchCommand(animatedRef, 'scrollTo', [x, y, animated]);\n };\n} else if (isNative) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n\n // Calling animatedRef on Paper returns a number (nativeTag)\n const viewTag = animatedRef() as number;\n _scrollTo(viewTag, x, y, animated);\n };\n} else {\n scrollTo = (\n _animatedRef: RefObjectFunction<Component>,\n _x: number,\n _y: number\n ) => {\n // no-op\n };\n}\n\nexport function setGestureState(handlerTag: number, newState: number): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n console.warn(\n '[Reanimated] You can not use setGestureState in non-worklet function.'\n );\n return;\n }\n _setGestureState(handlerTag, newState);\n}\n"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,cAAc;AAG7C,SAASC,gBAAgB,EAAEC,KAAK,EAAEC,cAAc,QAAQ,mBAAmB;AAE3E,OAAO,SAASC,MAAMA,CACpBC,IAA2E,EAC5D;EACf,OAAOL,cAAc,CAACK,IAAI,CAAC;AAC7B;AAEA,MAAMC,QAAQ,GAAG,CAACH,cAAc,EAAE;AAElC,OAAO,IAAII,OAEmB;AAE9B,IAAIL,KAAK,EAAE,EAAE;E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ACX,QAAQ,EAAE;MACb;IACF;;IAEA;IACA,MAAMC,OAAO,GAAGpB,WAAW,EAAY;IACvCiC,SAAS,CAACb,OAAO,EAAEZ,CAAC,EAAEE,CAAC,EAAEoB,QAAQ,CAAC;EACpC,CAAC;AACH,CAAC,MAAM;EACLD,QAAQ,GAAGA,CACTb,YAA0C,EAC1CkB,EAAU,EACVC,EAAU,KACP;IACH;EAAA,CACD;AACH;AAEA,OAAO,SAASC,eAAeA,CAACC,UAAkB,EAAEC,QAAgB,EAAQ;EAC1E,SAAS;;EACT,IAAI,CAACnB,QAAQ,IAAI,CAACrB,QAAQ,EAAE;IAC1BmB,OAAO,CAACC,IAAI,CACV,uEAAuE,CACxE;IACD;EACF;EACAqB,gBAAgB,CAACF,UAAU,EAAEC,QAAQ,CAAC;AACxC"}
@@ -1,25 +1,21 @@
1
- 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; }
2
-
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
4
  import { NativeModules } from 'react-native';
4
- import { checkVersion } from '../platform-specific/checkVersion';
5
+ import { checkCppVersion } from '../platform-specific/checkCppVersion';
5
6
  export class NativeReanimated {
6
7
  constructor() {
7
8
  let native = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8
-
9
9
  _defineProperty(this, "native", void 0);
10
-
11
10
  _defineProperty(this, "InnerNativeModule", void 0);
12
-
13
11
  if (global.__reanimatedModuleProxy === undefined && native) {
14
12
  const {
15
13
  ReanimatedModule
16
14
  } = NativeModules;
17
15
  ReanimatedModule === null || ReanimatedModule === void 0 ? void 0 : ReanimatedModule.installTurboModule();
18
16
  }
19
-
20
17
  this.InnerNativeModule = global.__reanimatedModuleProxy;
21
18
  this.native = native;
22
-
23
19
  if (native) {
24
20
  if (this.InnerNativeModule === undefined) {
25
21
  console.error(`[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\n\
@@ -28,74 +24,56 @@ export class NativeReanimated {
28
24
  - running in a brownfield app without manually initializing the native library`);
29
25
  return;
30
26
  }
31
-
32
- checkVersion();
27
+ checkCppVersion();
33
28
  }
34
29
  }
35
-
36
30
  installCoreFunctions(callGuard, valueUnpacker) {
37
31
  return this.InnerNativeModule.installCoreFunctions(callGuard, valueUnpacker);
38
32
  }
39
-
40
33
  makeShareableClone(value, shouldPersistRemote) {
41
34
  return this.InnerNativeModule.makeShareableClone(value, shouldPersistRemote);
42
35
  }
43
-
44
36
  makeSynchronizedDataHolder(valueRef) {
45
37
  return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);
46
38
  }
47
-
48
39
  getDataSynchronously(ref) {
49
40
  return this.InnerNativeModule.getDataSynchronously(ref);
50
41
  }
51
-
52
42
  updateDataSynchronously(ref, value) {
53
43
  this.InnerNativeModule.updateDataSynchronously(ref, value);
54
44
  }
55
-
56
45
  scheduleOnUI(shareable) {
57
46
  return this.InnerNativeModule.scheduleOnUI(shareable);
58
47
  }
59
-
60
48
  registerSensor(sensorType, interval, iosReferenceFrame, handler) {
61
49
  return this.InnerNativeModule.registerSensor(sensorType, interval, iosReferenceFrame, handler);
62
50
  }
63
-
64
51
  unregisterSensor(sensorId) {
65
52
  return this.InnerNativeModule.unregisterSensor(sensorId);
66
53
  }
67
-
68
54
  registerEventHandler(eventHash, eventHandler) {
69
55
  return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);
70
56
  }
71
-
72
57
  unregisterEventHandler(id) {
73
58
  return this.InnerNativeModule.unregisterEventHandler(id);
74
59
  }
75
-
76
60
  getViewProp(viewTag, propName, callback) {
77
61
  return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
78
62
  }
79
-
80
63
  configureLayoutAnimation(viewTag, type, sharedTransitionTag, config) {
81
64
  this.InnerNativeModule.configureLayoutAnimation(viewTag, type, sharedTransitionTag, config);
82
65
  }
83
-
84
66
  enableLayoutAnimations(flag) {
85
67
  this.InnerNativeModule.enableLayoutAnimations(flag);
86
68
  }
87
-
88
69
  configureProps(uiProps, nativeProps) {
89
70
  this.InnerNativeModule.configureProps(uiProps, nativeProps);
90
71
  }
91
-
92
72
  subscribeForKeyboardEvents(handler, isStatusBarTranslucent) {
93
73
  return this.InnerNativeModule.subscribeForKeyboardEvents(handler, isStatusBarTranslucent);
94
74
  }
95
-
96
75
  unsubscribeFromKeyboardEvents(listenerId) {
97
76
  this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);
98
77
  }
99
-
100
78
  }
101
79
  //# sourceMappingURL=NativeReanimated.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","checkVersion","NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","installTurboModule","InnerNativeModule","console","error","installCoreFunctions","callGuard","valueUnpacker","makeShareableClone","value","shouldPersistRemote","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","iosReferenceFrame","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","sharedTransitionTag","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","isStatusBarTranslucent","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n ShareableRef,\n ShareableSyncDataHolderRef,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from '../layoutReanimation';\nimport { checkVersion } from '../platform-specific/checkVersion';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n if (this.InnerNativeModule === undefined) {\n console.error(\n `[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\\n\\\n - not rebuilding the app after installing or upgrading Reanimated\\n\\\n - trying to run Reanimated on an unsupported platform\\n\\\n - running in a brownfield app without manually initializing the native library`\n );\n return;\n }\n checkVersion();\n }\n }\n\n installCoreFunctions(\n callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n valueUnpacker: <T>(value: T) => T\n ): void {\n return this.InnerNativeModule.installCoreFunctions(\n callGuard,\n valueUnpacker\n );\n }\n\n makeShareableClone<T>(\n value: T,\n shouldPersistRemote: boolean\n ): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(\n value,\n shouldPersistRemote\n );\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n iosReferenceFrame: number,\n handler: ShareableRef<T> | ((data: Value3D | ValueRotation) => void)\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n iosReferenceFrame,\n handler\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: LayoutAnimationType,\n sharedTransitionTag: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n sharedTransitionTag,\n config\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(\n handler: ShareableRef<number>,\n isStatusBarTranslucent: boolean\n ): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(\n handler,\n isStatusBarTranslucent\n );\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,cAA9B;AAWA,SAASC,YAAT,QAA6B,mCAA7B;AAEA,OAAO,MAAMC,gBAAN,CAAuB;EAI5BC,WAAW,GAAgB;IAAA,IAAfC,MAAe,uEAAN,IAAM;;IAAA;;IAAA;;IACzB,IAAIC,MAAM,CAACC,uBAAP,KAAmCC,SAAnC,IAAgDH,MAApD,EAA4D;MAC1D,MAAM;QAAEI;MAAF,IAAuBR,aAA7B;MACAQ,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;IACjC,OAAO,KAAKtB,iBAAL,CAAuBqB,gBAAvB,CAAwCC,QAAxC,CAAP;EACD;;EAEDC,oBAAoB,CAClBC,SADkB,EAElBC,YAFkB,EAGV;IACR,OAAO,KAAKzB,iBAAL,CAAuBuB,oBAAvB,CAA4CC,SAA5C,EAAuDC,YAAvD,CAAP;EACD;;EAEDC,sBAAsB,CAACC,EAAD,EAAmB;IACvC,OAAO,KAAK3B,iBAAL,CAAuB0B,sBAAvB,CAA8CC,EAA9C,CAAP;EACD;;EAEDC,WAAW,CACTC,OADS,EAETC,QAFS,EAGTC,QAHS,EAIG;IACZ,OAAO,KAAK/B,iBAAL,CAAuB4B,WAAvB,CAAmCC,OAAnC,EAA4CC,QAA5C,EAAsDC,QAAtD,CAAP;EACD;;EAEDC,wBAAwB,CACtBH,OADsB,EAEtBI,IAFsB,EAGtBC,mBAHsB,EAItBC,MAJsB,EAKtB;IACA,KAAKnC,iBAAL,CAAuBgC,wBAAvB,CACEH,OADF,EAEEI,IAFF,EAGEC,mBAHF,EAIEC,MAJF;EAMD;;EAEDC,sBAAsB,CAACC,IAAD,EAAsB;IAC1C,KAAKrC,iBAAL,CAAuBoC,sBAAvB,CAA8CC,IAA9C;EACD;;EAEDC,cAAc,CAACC,OAAD,EAAoBC,WAApB,EAAiD;IAC7D,KAAKxC,iBAAL,CAAuBsC,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;;EAEDC,0BAA0B,CACxBrB,OADwB,EAExBsB,sBAFwB,EAGhB;IACR,OAAO,KAAK1C,iBAAL,CAAuByC,0BAAvB,CACLrB,OADK,EAELsB,sBAFK,CAAP;EAID;;EAEDC,6BAA6B,CAACC,UAAD,EAA2B;IACtD,KAAK5C,iBAAL,CAAuB2C,6BAAvB,CAAqDC,UAArD;EACD;;AA5I2B"}
1
+ {"version":3,"names":["NativeModules","checkCppVersion","NativeReanimated","constructor","native","arguments","length","undefined","_defineProperty","global","__reanimatedModuleProxy","ReanimatedModule","installTurboModule","InnerNativeModule","console","error","installCoreFunctions","callGuard","valueUnpacker","makeShareableClone","value","shouldPersistRemote","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","iosReferenceFrame","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","sharedTransitionTag","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","isStatusBarTranslucent","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n ShareableRef,\n ShareableSyncDataHolderRef,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from '../layoutReanimation';\nimport { checkCppVersion } from '../platform-specific/checkCppVersion';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n if (this.InnerNativeModule === undefined) {\n console.error(\n `[Reanimated] The native part of Reanimated doesn't seem to be initialized. This could be caused by\\n\\\n - not rebuilding the app after installing or upgrading Reanimated\\n\\\n - trying to run Reanimated on an unsupported platform\\n\\\n - running in a brownfield app without manually initializing the native library`\n );\n return;\n }\n checkCppVersion();\n }\n }\n\n installCoreFunctions(\n callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n valueUnpacker: <T>(value: T) => T\n ): void {\n return this.InnerNativeModule.installCoreFunctions(\n callGuard,\n valueUnpacker\n );\n }\n\n makeShareableClone<T>(\n value: T,\n shouldPersistRemote: boolean\n ): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(\n value,\n shouldPersistRemote\n );\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n iosReferenceFrame: number,\n handler: ShareableRef<T> | ((data: Value3D | ValueRotation) => void)\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n iosReferenceFrame,\n handler\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: LayoutAnimationType,\n sharedTransitionTag: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n sharedTransitionTag,\n config\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(\n handler: ShareableRef<number>,\n isStatusBarTranslucent: boolean\n ): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(\n handler,\n isStatusBarTranslucent\n );\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;AAAA,SAASA,aAAa,QAAQ,cAAc;AAW5C,SAASC,eAAe,QAAQ,sCAAsC;AAEtE,OAAO,MAAMC,gBAAgB,CAAC;EAI5BC,WAAWA,CAAA,EAAgB;IAAA,IAAfC,MAAM,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAAG,eAAA;IAAAA,eAAA;IACvB,IAAIC,MAAM,CAACC,uBAAuB,KAAKH,SAAS,IAAIH,MAAM,EAAE;MAC1D,MAAM;QAAEO;MAAiB,CAAC,GAAGX,aAAa;MAC1CW,gBAAgB,aAAhBA,gBAAgB,uBAAhBA,gBAAgB,CAAEC,kBAAkB,EAAE;IACxC;IACA,IAAI,CAACC,iBAAiB,GAAGJ,MAAM,CAACC,uBAAuB;IACvD,IAAI,CAACN,MAAM,GAAGA,MAAM;IACpB,IAAIA,MAAM,EAAE;MACV,IAAI,IAAI,CAACS,iBAAiB,KAAKN,SAAS,EAAE;QACxCO,OAAO,CAACC,KAAK,CACV;AACX;AACA;AACA,iFAAiF,CACxE;QACD;MACF;MACAd,eAAe,EAAE;IACnB;EACF;EAEAe,oBAAoBA,CAClBC,SAGS,EACTC,aAAiC,EAC3B;IACN,OAAO,IAAI,CAACL,iBAAiB,CAACG,oBAAoB,CAChDC,SAAS,EACTC,aAAa,CACd;EACH;EAEAC,kBAAkBA,CAChBC,KAAQ,EACRC,mBAA4B,EACX;IACjB,OAAO,IAAI,CAACR,iBAAiB,CAACM,kBAAkB,CAC9CC,KAAK,EACLC,mBAAmB,CACpB;EACH;EAEAC,0BAA0BA,CACxBC,QAAyB,EACM;IAC/B,OAAO,IAAI,CAACV,iBAAiB,CAACS,0BAA0B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I,EACJC,mBAAmB,EACnBC,MAAM,CACP;EACH;EAEAC,sBAAsBA,CAACC,IAAa,EAAQ;IAC1C,IAAI,CAACrC,iBAAiB,CAACoC,sBAAsB,CAACC,IAAI,CAAC;EACrD;EAEAC,cAAcA,CAACC,OAAiB,EAAEC,WAAqB,EAAQ;IAC7D,IAAI,CAACxC,iBAAiB,CAACsC,cAAc,CAACC,OAAO,EAAEC,WAAW,CAAC;EAC7D;EAEAC,0BAA0BA,CACxBrB,OAA6B,EAC7BsB,sBAA+B,EACvB;IACR,OAAO,IAAI,CAAC1C,iBAAiB,CAACyC,0BAA0B,CACtDrB,OAAO,EACPsB,sBAAsB,CACvB;EACH;EAEAC,6BAA6BA,CAACC,UAAkB,EAAQ;IACtD,IAAI,CAAC5C,iBAAiB,CAAC2C,6BAA6B,CAACC,UAAU,CAAC;EAClE;AACF"}
@@ -2,12 +2,10 @@ import reanimatedJS from '../js-reanimated';
2
2
  import { shouldBeUseWeb } from '../PlatformChecker';
3
3
  import { NativeReanimated } from './NativeReanimated';
4
4
  let exportedModule;
5
-
6
5
  if (shouldBeUseWeb()) {
7
6
  exportedModule = reanimatedJS;
8
7
  } else {
9
8
  exportedModule = new NativeReanimated();
10
9
  }
11
-
12
10
  export default exportedModule;
13
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["reanimatedJS","shouldBeUseWeb","NativeReanimated","exportedModule"],"sources":["index.ts"],"sourcesContent":["import reanimatedJS from '../js-reanimated';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport { NativeReanimated } from './NativeReanimated';\n\nlet exportedModule;\nif (shouldBeUseWeb()) {\n exportedModule = reanimatedJS;\n} else {\n exportedModule = new NativeReanimated();\n}\n\nexport default exportedModule as NativeReanimated;\n"],"mappings":"AAAA,OAAOA,YAAP,MAAyB,kBAAzB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA,IAAIC,cAAJ;;AACA,IAAIF,cAAc,EAAlB,EAAsB;EACpBE,cAAc,GAAGH,YAAjB;AACD,CAFD,MAEO;EACLG,cAAc,GAAG,IAAID,gBAAJ,EAAjB;AACD;;AAED,eAAeC,cAAf"}
1
+ {"version":3,"names":["reanimatedJS","shouldBeUseWeb","NativeReanimated","exportedModule"],"sources":["index.ts"],"sourcesContent":["import reanimatedJS from '../js-reanimated';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport { NativeReanimated } from './NativeReanimated';\n\nlet exportedModule;\nif (shouldBeUseWeb()) {\n exportedModule = reanimatedJS;\n} else {\n exportedModule = new NativeReanimated();\n}\n\nexport default exportedModule as NativeReanimated;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,kBAAkB;AAC3C,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,IAAIC,cAAc;AAClB,IAAIF,cAAc,EAAE,EAAE;EACpBE,cAAc,GAAGH,YAAY;AAC/B,CAAC,MAAM;EACLG,cAAc,GAAG,IAAID,gBAAgB,EAAE;AACzC;AAEA,eAAeC,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","isJest","process","env","JEST_WORKER_ID","isChromeDebugger","global","nativeCallSyncHook","__REMOTEDEV__","isWeb","OS","shouldBeUseWeb","nativeShouldBeMock"],"sources":["PlatformChecker.ts"],"sourcesContent":["import { Platform } from 'react-native';\n\nexport function isJest(): boolean {\n return !!process.env.JEST_WORKER_ID;\n}\n\nexport function isChromeDebugger(): boolean {\n return !(global as any).nativeCallSyncHook || (global as any).__REMOTEDEV__;\n}\n\nexport function isWeb(): boolean {\n return Platform.OS === 'web';\n}\n\nexport function shouldBeUseWeb() {\n return isJest() || isChromeDebugger() || isWeb();\n}\n\nexport function nativeShouldBeMock() {\n return isJest() || isChromeDebugger();\n}\n"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAEA,OAAO,SAASC,MAAT,GAA2B;EAChC,OAAO,CAAC,CAACC,OAAO,CAACC,GAAR,CAAYC,cAArB;AACD;AAED,OAAO,SAASC,gBAAT,GAAqC;EAC1C,OAAO,CAAEC,MAAD,CAAgBC,kBAAjB,IAAwCD,MAAD,CAAgBE,aAA9D;AACD;AAED,OAAO,SAASC,KAAT,GAA0B;EAC/B,OAAOT,QAAQ,CAACU,EAAT,KAAgB,KAAvB;AACD;AAED,OAAO,SAASC,cAAT,GAA0B;EAC/B,OAAOV,MAAM,MAAMI,gBAAgB,EAA5B,IAAkCI,KAAK,EAA9C;AACD;AAED,OAAO,SAASG,kBAAT,GAA8B;EACnC,OAAOX,MAAM,MAAMI,gBAAgB,EAAnC;AACD"}
1
+ {"version":3,"names":["Platform","isJest","process","env","JEST_WORKER_ID","isChromeDebugger","global","nativeCallSyncHook","__REMOTEDEV__","isWeb","OS","shouldBeUseWeb","nativeShouldBeMock"],"sources":["PlatformChecker.ts"],"sourcesContent":["import { Platform } from 'react-native';\n\nexport function isJest(): boolean {\n return !!process.env.JEST_WORKER_ID;\n}\n\nexport function isChromeDebugger(): boolean {\n return !(global as any).nativeCallSyncHook || (global as any).__REMOTEDEV__;\n}\n\nexport function isWeb(): boolean {\n return Platform.OS === 'web';\n}\n\nexport function shouldBeUseWeb() {\n return isJest() || isChromeDebugger() || isWeb();\n}\n\nexport function nativeShouldBeMock() {\n return isJest() || isChromeDebugger();\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,SAASC,MAAMA,CAAA,EAAY;EAChC,OAAO,CAAC,CAACC,OAAO,CAACC,GAAG,CAACC,cAAc;AACrC;AAEA,OAAO,SAASC,gBAAgBA,CAAA,EAAY;EAC1C,OAAO,CAAEC,MAAM,CAASC,kBAAkB,IAAKD,MAAM,CAASE,aAAa;AAC7E;AAEA,OAAO,SAASC,KAAKA,CAAA,EAAY;EAC/B,OAAOT,QAAQ,CAACU,EAAE,KAAK,KAAK;AAC9B;AAEA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,OAAOV,MAAM,EAAE,IAAII,gBAAgB,EAAE,IAAII,KAAK,EAAE;AAClD;AAEA,OAAO,SAASG,kBAAkBA,CAAA,EAAG;EACnC,OAAOX,MAAM,EAAE,IAAII,gBAAgB,EAAE;AACvC"}
@@ -1,26 +1,27 @@
1
1
  import { addWhitelistedNativeProps } from '../ConfigHelper';
2
2
  export function createAnimatedPropAdapter(adapter, nativeProps) {
3
- const nativePropsToAdd = {}; // eslint-disable-next-line no-unused-expressions
4
-
3
+ const nativePropsToAdd = {};
4
+ // eslint-disable-next-line no-unused-expressions
5
5
  nativeProps === null || nativeProps === void 0 ? void 0 : nativeProps.forEach(prop => {
6
6
  nativePropsToAdd[prop] = true;
7
7
  });
8
8
  addWhitelistedNativeProps(nativePropsToAdd);
9
9
  return adapter;
10
- } // ADAPTERS
10
+ }
11
+
12
+ // ADAPTERS
11
13
 
12
14
  export const SVGAdapter = createAnimatedPropAdapter(props => {
13
15
  'worklet';
14
16
 
15
- const keys = Object.keys(props); // transform
16
-
17
+ const keys = Object.keys(props);
18
+ // transform
17
19
  if (keys.includes('transform')) {
18
20
  if (Array.isArray(props.transform)) {
19
21
  // case of array with 6 values => https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/elements/Shape.tsx#L200
20
22
  if (props.transform.length !== 6) {
21
23
  throw new Error(`invalid transform length of ${props.transform.length}, should be 6`);
22
24
  }
23
-
24
25
  const transform = props.transform;
25
26
  const x = props.x ?? 0;
26
27
  const y = props.y ?? 0;
@@ -40,14 +41,15 @@ export const SVGAdapter = createAnimatedPropAdapter(props => {
40
41
  translateY: parseFloat(arr[1])
41
42
  }];
42
43
  }
43
- } // todo: other props
44
-
44
+ }
45
+ // todo: other props
45
46
  });
47
+
46
48
  export const TextInputAdapter = createAnimatedPropAdapter(props => {
47
49
  'worklet';
48
50
 
49
- const keys = Object.keys(props); // convert text to value like RN does here: https://github.com/facebook/react-native/blob/f2c6279ca497b34d5a2bfbb6f2d33dc7a7bea02a/Libraries/Components/TextInput/TextInput.js#L878
50
-
51
+ const keys = Object.keys(props);
52
+ // convert text to value like RN does here: https://github.com/facebook/react-native/blob/f2c6279ca497b34d5a2bfbb6f2d33dc7a7bea02a/Libraries/Components/TextInput/TextInput.js#L878
51
53
  if (keys.includes('value')) {
52
54
  props.text = props.value;
53
55
  delete props.value;
@@ -1 +1 @@
1
- {"version":3,"names":["addWhitelistedNativeProps","createAnimatedPropAdapter","adapter","nativeProps","nativePropsToAdd","forEach","prop","SVGAdapter","props","keys","Object","includes","Array","isArray","transform","length","Error","x","y","translateX","translateY","arr","replace","split","parseFloat","TextInputAdapter","text","value"],"sources":["PropAdapters.ts"],"sourcesContent":["import { addWhitelistedNativeProps } from '../ConfigHelper';\nimport { AdapterWorkletFunction } from './commonTypes';\n\nexport function createAnimatedPropAdapter(\n adapter: AdapterWorkletFunction,\n nativeProps?: string[]\n): AdapterWorkletFunction {\n const nativePropsToAdd: { [key: string]: boolean } = {};\n // eslint-disable-next-line no-unused-expressions\n nativeProps?.forEach((prop) => {\n nativePropsToAdd[prop] = true;\n });\n addWhitelistedNativeProps(nativePropsToAdd);\n return adapter;\n}\n\n// ADAPTERS\n\nexport const SVGAdapter: AdapterWorkletFunction = createAnimatedPropAdapter(\n (props) => {\n 'worklet';\n const keys = Object.keys(props);\n // transform\n if (keys.includes('transform')) {\n if (Array.isArray(props.transform)) {\n // case of array with 6 values => https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/elements/Shape.tsx#L200\n if (props.transform.length !== 6) {\n throw new Error(\n `invalid transform length of ${props.transform.length}, should be 6`\n );\n }\n const transform: number[] = props.transform as number[];\n const x: number = (props.x as number) ?? 0;\n const y: number = (props.y as number) ?? 0;\n props.transform = [\n { translateX: transform[0] * x + transform[2] * y + transform[4] },\n { translateY: transform[1] * x + transform[3] * y + transform[5] },\n ];\n } else if (typeof props.transform === 'string') {\n // case of string 'translate(translateX translateY)'\n // todo: handle other cases of transform string like here https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/lib/extract/extractTransform.ts#L184\n const transform: string = props.transform as string;\n const arr = transform\n .replace('translate(', '')\n .replace(')', '')\n .split(' ');\n props.transform = [\n { translateX: parseFloat(arr[0]) },\n { translateY: parseFloat(arr[1]) },\n ];\n }\n }\n // todo: other props\n }\n);\n\nexport const TextInputAdapter = createAnimatedPropAdapter(\n (props) => {\n 'worklet';\n const keys = Object.keys(props);\n // convert text to value like RN does here: https://github.com/facebook/react-native/blob/f2c6279ca497b34d5a2bfbb6f2d33dc7a7bea02a/Libraries/Components/TextInput/TextInput.js#L878\n if (keys.includes('value')) {\n props.text = props.value;\n delete props.value;\n }\n },\n ['text']\n);\n"],"mappings":"AAAA,SAASA,yBAAT,QAA0C,iBAA1C;AAGA,OAAO,SAASC,yBAAT,CACLC,OADK,EAELC,WAFK,EAGmB;EACxB,MAAMC,gBAA4C,GAAG,EAArD,CADwB,CAExB;;EACAD,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAEE,OAAb,CAAsBC,IAAD,IAAU;IAC7BF,gBAAgB,CAACE,IAAD,CAAhB,GAAyB,IAAzB;EACD,CAFD;EAGAN,yBAAyB,CAACI,gBAAD,CAAzB;EACA,OAAOF,OAAP;AACD,C,CAED;;AAEA,OAAO,MAAMK,UAAkC,GAAGN,yBAAyB,CACxEO,KAAD,IAAW;EACT;;EACA,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAP,CAAYD,KAAZ,CAAb,CAFS,CAGT;;EACA,IAAIC,IAAI,CAACE,QAAL,CAAc,WAAd,CAAJ,EAAgC;IAC9B,IAAIC,KAAK,CAACC,OAAN,CAAcL,KAAK,CAACM,SAApB,CAAJ,EAAoC;MAClC;MACA,IAAIN,KAAK,CAACM,SAAN,CAAgBC,MAAhB,KAA2B,CAA/B,EAAkC;QAChC,MAAM,IAAIC,KAAJ,CACH,+BA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E,QAAL,CAAc,OAAd,CAAJ,EAA4B;IAC1BH,KAAK,CAACkB,IAAN,GAAalB,KAAK,CAACmB,KAAnB;IACA,OAAOnB,KAAK,CAACmB,KAAb;EACD;AACF,CATsD,EAUvD,CAAC,MAAD,CAVuD,CAAlD"}
1
+ {"version":3,"names":["addWhitelistedNativeProps","createAnimatedPropAdapter","adapter","nativeProps","nativePropsToAdd","forEach","prop","SVGAdapter","props","keys","Object","includes","Array","isArray","transform","length","Error","x","y","translateX","translateY","arr","replace","split","parseFloat","TextInputAdapter","text","value"],"sources":["PropAdapters.ts"],"sourcesContent":["import { addWhitelistedNativeProps } from '../ConfigHelper';\nimport { AdapterWorkletFunction } from './commonTypes';\n\nexport function createAnimatedPropAdapter(\n adapter: AdapterWorkletFunction,\n nativeProps?: string[]\n): AdapterWorkletFunction {\n const nativePropsToAdd: { [key: string]: boolean } = {};\n // eslint-disable-next-line no-unused-expressions\n nativeProps?.forEach((prop) => {\n nativePropsToAdd[prop] = true;\n });\n addWhitelistedNativeProps(nativePropsToAdd);\n return adapter;\n}\n\n// ADAPTERS\n\nexport const SVGAdapter: AdapterWorkletFunction = createAnimatedPropAdapter(\n (props) => {\n 'worklet';\n const keys = Object.keys(props);\n // transform\n if (keys.includes('transform')) {\n if (Array.isArray(props.transform)) {\n // case of array with 6 values => https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/elements/Shape.tsx#L200\n if (props.transform.length !== 6) {\n throw new Error(\n `invalid transform length of ${props.transform.length}, should be 6`\n );\n }\n const transform: number[] = props.transform as number[];\n const x: number = (props.x as number) ?? 0;\n const y: number = (props.y as number) ?? 0;\n props.transform = [\n { translateX: transform[0] * x + transform[2] * y + transform[4] },\n { translateY: transform[1] * x + transform[3] * y + transform[5] },\n ];\n } else if (typeof props.transform === 'string') {\n // case of string 'translate(translateX translateY)'\n // todo: handle other cases of transform string like here https://github.com/react-native-svg/react-native-svg/blob/b2e2c355204ff4b10973d3afce1495f7e4167ff7/src/lib/extract/extractTransform.ts#L184\n const transform: string = props.transform as string;\n const arr = transform\n .replace('translate(', '')\n .replace(')', '')\n .split(' ');\n props.transform = [\n { translateX: parseFloat(arr[0]) },\n { translateY: parseFloat(arr[1]) },\n ];\n }\n }\n // todo: other props\n }\n);\n\nexport const TextInputAdapter = createAnimatedPropAdapter(\n (props) => {\n 'worklet';\n const keys = Object.keys(props);\n // convert text to value like RN does here: https://github.com/facebook/react-native/blob/f2c6279ca497b34d5a2bfbb6f2d33dc7a7bea02a/Libraries/Components/TextInput/TextInput.js#L878\n if (keys.includes('value')) {\n props.text = props.value;\n delete props.value;\n }\n },\n ['text']\n);\n"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,iBAAiB;AAG3D,OAAO,SAASC,yBAAyBA,CACvCC,OAA+B,EAC/BC,WAAsB,EACE;EACxB,MAAMC,gBAA4C,GAAG,CAAC,CAAC;EACvD;EACAD,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,OAAO,CAAEC,IAAI,IAAK;IAC7BF,gBAAgB,CAACE,IAAI,CAAC,GAAG,IAAI;EAC/B,CAAC,CAAC;EACFN,yBAAyB,CAACI,gBAAgB,CAAC;EAC3C,OAAOF,OAAO;AAChB;;AAEA;;AAEA,OAAO,MAAMK,UAAkC,GAAGN,yBAAyB,CACxEO,KAAK,IAAK;EACT,SAAS;;EACT,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,KAAK,CAAC;EAC/B;EACA,IAAIC,IAAI,CAACE,QAAQ,CAAC,WAAW,CAAC,EAAE;IAC9B,IAAIC,KAAK,CAACC,OAAO,CAACL,KAAK,CAACM,SAAS,CAAC,EAAE;MAClC;MACA,IAAIN,KAAK,CAACM,SAAS,CAACC,MAAM,KAAK,CAAC,EAAE;QAChC,MAAM,IAAIC,KAAK,CACZ,+BAA8BR,KAAK,CAACM,SAAS,CAACC,MAAO,eAAc,CACrE;MACH;MACA,MAAMD,SAAmB,GAAGN,KAA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B,KAAK;EACpB;AACF,CAAC,EACD,CAAC,MAAM,CAAC,CACT"}
@@ -1,4 +1,5 @@
1
1
  /* global _updatePropsPaper _updatePropsFabric */
2
+
2
3
  import { processColor } from './Colors';
3
4
  import { makeShareable, isConfigured } from './core';
4
5
  import { _updatePropsJS } from './js-reanimated';
@@ -7,7 +8,6 @@ import { shouldBeUseWeb } from './PlatformChecker';
7
8
  export const colorProps = ['backgroundColor', 'borderBottomColor', 'borderColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'borderStartColor', 'borderEndColor', 'color', 'shadowColor', 'textDecorationColor', 'tintColor', 'textShadowColor', 'overlayColor'];
8
9
  export const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);
9
10
  let updatePropsByPlatform;
10
-
11
11
  if (shouldBeUseWeb()) {
12
12
  updatePropsByPlatform = (_, updates, maybeViewRef) => {
13
13
  'worklet';
@@ -28,7 +28,6 @@ if (shouldBeUseWeb()) {
28
28
  updates[key] = processColor(updates[key]);
29
29
  }
30
30
  }
31
-
32
31
  viewDescriptors.value.forEach(viewDescriptor => {
33
32
  _updatePropsFabric(viewDescriptor.shadowNodeWrapper, updates);
34
33
  });
@@ -42,20 +41,19 @@ if (shouldBeUseWeb()) {
42
41
  updates[key] = processColor(updates[key]);
43
42
  }
44
43
  }
45
-
46
44
  viewDescriptors.value.forEach(viewDescriptor => {
47
45
  _updatePropsPaper(viewDescriptor.tag, viewDescriptor.name || 'RCTView', updates);
48
46
  });
49
47
  };
50
48
  }
51
49
  }
52
-
53
50
  export const updateProps = updatePropsByPlatform;
54
51
  export const updatePropsJestWrapper = (viewDescriptors, updates, maybeViewRef, animatedStyle, adapters) => {
55
52
  adapters.forEach(adapter => {
56
53
  adapter(updates);
57
54
  });
58
- animatedStyle.current.value = { ...animatedStyle.current.value,
55
+ animatedStyle.current.value = {
56
+ ...animatedStyle.current.value,
59
57
  ...updates
60
58
  };
61
59
  updateProps(viewDescriptors, updates, maybeViewRef);
@@ -1 +1 @@
1
- {"version":3,"names":["processColor","makeShareable","isConfigured","_updatePropsJS","shouldBeUseWeb","colorProps","ColorProperties","updatePropsByPlatform","_","updates","maybeViewRef","items","forEach","item","global","_IS_FABRIC","viewDescriptors","key","indexOf","value","viewDescriptor","_updatePropsFabric","shadowNodeWrapper","_updatePropsPaper","tag","name","updateProps","updatePropsJestWrapper","animatedStyle","adapters","adapter","current"],"sources":["UpdateProps.ts"],"sourcesContent":["/* global _updatePropsPaper _updatePropsFabric */\nimport { MutableRefObject } from 'react';\nimport { processColor } from './Colors';\nimport { AnimatedStyle, SharedValue, StyleProps } from './commonTypes';\nimport { makeShareable, isConfigured } from './core';\nimport { Descriptor } from './hook/commonTypes';\nimport { _updatePropsJS } from './js-reanimated';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport { ViewRefSet } from './ViewDescriptorsSet';\n\n// copied from react-native/Libraries/Components/View/ReactNativeStyleAttributes\nexport const colorProps = [\n 'backgroundColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderTopColor',\n 'borderStartColor',\n 'borderEndColor',\n 'color',\n 'shadowColor',\n 'textDecorationColor',\n 'tintColor',\n 'textShadowColor',\n 'overlayColor',\n];\n\nexport const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);\n\nlet updatePropsByPlatform;\nif (shouldBeUseWeb()) {\n updatePropsByPlatform = (\n _: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n if (maybeViewRef) {\n maybeViewRef.items.forEach((item, _) => {\n _updatePropsJS(updates, item);\n });\n }\n };\n} else {\n if (global._IS_FABRIC) {\n updatePropsByPlatform = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n _: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n\n for (const key in updates) {\n if (ColorProperties.indexOf(key) !== -1) {\n updates[key] = processColor(updates[key]);\n }\n }\n\n viewDescriptors.value.forEach((viewDescriptor) => {\n _updatePropsFabric(viewDescriptor.shadowNodeWrapper, updates);\n });\n };\n } else {\n updatePropsByPlatform = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n _: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n\n for (const key in updates) {\n if (ColorProperties.indexOf(key) !== -1) {\n updates[key] = processColor(updates[key]);\n }\n }\n viewDescriptors.value.forEach((viewDescriptor) => {\n _updatePropsPaper(\n viewDescriptor.tag,\n viewDescriptor.name || 'RCTView',\n updates\n );\n });\n };\n }\n}\n\nexport const updateProps: (\n viewDescriptor: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined\n) => void = updatePropsByPlatform;\n\nexport const updatePropsJestWrapper = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined,\n animatedStyle: MutableRefObject<AnimatedStyle>,\n adapters: ((updates: AnimatedStyle) => void)[]\n): void => {\n adapters.forEach((adapter) => {\n adapter(updates);\n });\n animatedStyle.current.value = {\n ...animatedStyle.current.value,\n ...updates,\n };\n\n updateProps(viewDescriptors, updates, maybeViewRef);\n};\n\nexport default updateProps;\n"],"mappings":"AAAA;AAEA,SAASA,YAAT,QAA6B,UAA7B;AAEA,SAASC,aAAT,EAAwBC,YAAxB,QAA4C,QAA5C;AAEA,SAASC,cAAT,QAA+B,iBAA/B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AAGA;AACA,OAAO,MAAMC,UAAU,GAAG,CACxB,iBADwB,EAExB,mBAFwB,EAGxB,aAHwB,EAIxB,iBAJwB,EAKxB,kBALwB,EAMxB,gBANwB,EAOxB,kBAPwB,EAQxB,gBARwB,EASxB,OATwB,EAUxB,aAVwB,EAWxB,qBAXwB,EAYxB,WAZwB,EAaxB,iBAbwB,EAcxB,cAdwB,CAAnB;AAiBP,OAAO,MAA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AACG,KAAhB,CAAsBP,OAAtB,CAA+BQ,cAAD,IAAoB;QAChDG,iBAAiB,CACfH,cAAc,CAACI,GADA,EAEfJ,cAAc,CAACK,IAAf,IAAuB,SAFR,EAGfhB,OAHe,CAAjB;MAKD,CAND;IAOD,CAnBD;EAoBD;AACF;;AAED,OAAO,MAAMiB,WAIJ,GAAGnB,qBAJL;AAMP,OAAO,MAAMoB,sBAAsB,GAAG,CACpCX,eADoC,EAEpCP,OAFoC,EAGpCC,YAHoC,EAIpCkB,aAJoC,EAKpCC,QALoC,KAM3B;EACTA,QAAQ,CAACjB,OAAT,CAAkBkB,OAAD,IAAa;IAC5BA,OAAO,CAACrB,OAAD,CAAP;EACD,CAFD;EAGAmB,aAAa,CAACG,OAAd,CAAsBZ,KAAtB,GAA8B,EAC5B,GAAGS,aAAa,CAACG,OAAd,CAAsBZ,KADG;IAE5B,GAAGV;EAFyB,CAA9B;EAKAiB,WAAW,CAACV,eAAD,EAAkBP,OAAlB,EAA2BC,YAA3B,CAAX;AACD,CAhBM;AAkBP,eAAegB,WAAf"}
1
+ {"version":3,"names":["processColor","makeShareable","isConfigured","_updatePropsJS","shouldBeUseWeb","colorProps","ColorProperties","updatePropsByPlatform","_","updates","maybeViewRef","items","forEach","item","global","_IS_FABRIC","viewDescriptors","key","indexOf","value","viewDescriptor","_updatePropsFabric","shadowNodeWrapper","_updatePropsPaper","tag","name","updateProps","updatePropsJestWrapper","animatedStyle","adapters","adapter","current"],"sources":["UpdateProps.ts"],"sourcesContent":["/* global _updatePropsPaper _updatePropsFabric */\nimport { MutableRefObject } from 'react';\nimport { processColor } from './Colors';\nimport { AnimatedStyle, SharedValue, StyleProps } from './commonTypes';\nimport { makeShareable, isConfigured } from './core';\nimport { Descriptor } from './hook/commonTypes';\nimport { _updatePropsJS } from './js-reanimated';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport { ViewRefSet } from './ViewDescriptorsSet';\n\n// copied from react-native/Libraries/Components/View/ReactNativeStyleAttributes\nexport const colorProps = [\n 'backgroundColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderTopColor',\n 'borderStartColor',\n 'borderEndColor',\n 'color',\n 'shadowColor',\n 'textDecorationColor',\n 'tintColor',\n 'textShadowColor',\n 'overlayColor',\n];\n\nexport const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);\n\nlet updatePropsByPlatform;\nif (shouldBeUseWeb()) {\n updatePropsByPlatform = (\n _: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n if (maybeViewRef) {\n maybeViewRef.items.forEach((item, _) => {\n _updatePropsJS(updates, item);\n });\n }\n };\n} else {\n if (global._IS_FABRIC) {\n updatePropsByPlatform = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n _: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n\n for (const key in updates) {\n if (ColorProperties.indexOf(key) !== -1) {\n updates[key] = processColor(updates[key]);\n }\n }\n\n viewDescriptors.value.forEach((viewDescriptor) => {\n _updatePropsFabric!(viewDescriptor.shadowNodeWrapper, updates);\n });\n };\n } else {\n updatePropsByPlatform = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n _: ViewRefSet<any> | undefined\n ): void => {\n 'worklet';\n\n for (const key in updates) {\n if (ColorProperties.indexOf(key) !== -1) {\n updates[key] = processColor(updates[key]);\n }\n }\n viewDescriptors.value.forEach((viewDescriptor) => {\n _updatePropsPaper!(\n viewDescriptor.tag,\n viewDescriptor.name || 'RCTView',\n updates\n );\n });\n };\n }\n}\n\nexport const updateProps: (\n viewDescriptor: SharedValue<Descriptor[]>,\n updates: StyleProps | AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined\n) => void = updatePropsByPlatform;\n\nexport const updatePropsJestWrapper = (\n viewDescriptors: SharedValue<Descriptor[]>,\n updates: AnimatedStyle,\n maybeViewRef: ViewRefSet<any> | undefined,\n animatedStyle: MutableRefObject<AnimatedStyle>,\n adapters: ((updates: AnimatedStyle) => void)[]\n): void => {\n adapters.forEach((adapter) => {\n adapter(updates);\n });\n animatedStyle.current.value = {\n ...animatedStyle.current.value,\n ...updates,\n };\n\n updateProps(viewDescriptors, updates, maybeViewRef);\n};\n\nexport default updateProps;\n"],"mappings":"AAAA;;AAEA,SAASA,YAAY,QAAQ,UAAU;AAEvC,SAASC,aAAa,EAAEC,YAAY,QAAQ,QAAQ;AAEpD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,cAAc,QAAQ,mBAAmB;AAGlD;AACA,OAAO,MAAMC,UAAU,GAAG,CACxB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,cAAc,CACf;AAED,OAAO,MAAMC,eAAe,GAAG,CAACJ,YAAY,EAAE,GAAG,EAAE,GAAGD,aAAa,CAACI,UAAU,CAAC;AAE/E,IAAIE,qBAAqB;AACzB,IAAIH,cAAc,EAAE,EAAE;EACpBG,qBAAqB,GAAGA,CACtBC,CAA4B,EAC5BC,OAAmC,EACnCC,YAAyC,KAChC;IACT,SAAS;;IACT,IAAIA,YAAY,EAAE;MAChBA,YAAY,CAACC,KAAK,CAACC,OAAO,CAAC,CAACC,IAAI,EAAEL,CAAC,KAAK;QACtCL,cAAc,CAACM,OAAO,EAAEI,IAAI,CAAC;MAC/B,CAAC,CAAC;IACJ;EACF,CAAC;AACH,CAAC,MAAM;EACL,IAAIC,MAAM,CAACC,UAAU,EAAE;IACrBR,qBAAqB,GAAGA,CACtBS,eAA0C,EAC1CP,OAAmC,EACnCD,CAA8B,KACrB;MACT,SAAS;;MAET,KAAK,MAAMS,GAAG,IAAIR,OAAO,EAAE;QACzB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AAO,EAAEC,YAAY,CAAC;AACrD,CAAC;AAED,eAAegB,WAAW"}
@@ -9,13 +9,11 @@ export function makeViewDescriptorsSet() {
9
9
  'worklet';
10
10
 
11
11
  const index = descriptors.findIndex(descriptor => descriptor.tag === item.tag);
12
-
13
12
  if (index !== -1) {
14
13
  descriptors[index] = item;
15
14
  } else {
16
15
  descriptors.push(item);
17
16
  }
18
-
19
17
  return descriptors;
20
18
  });
21
19
  },
@@ -24,11 +22,9 @@ export function makeViewDescriptorsSet() {
24
22
  'worklet';
25
23
 
26
24
  const index = descriptors.findIndex(descriptor => descriptor.tag === viewTag);
27
-
28
25
  if (index !== -1) {
29
26
  descriptors.splice(index, 1);
30
27
  }
31
-
32
28
  return descriptors;
33
29
  });
34
30
  }
@@ -37,7 +33,6 @@ export function makeViewDescriptorsSet() {
37
33
  }
38
34
  export function makeViewsRefSet() {
39
35
  const ref = useRef(null);
40
-
41
36
  if (ref.current === null) {
42
37
  const data = {
43
38
  items: new Set(),
@@ -51,7 +46,6 @@ export function makeViewsRefSet() {
51
46
  };
52
47
  ref.current = data;
53
48
  }
54
-
55
49
  return ref.current;
56
50
  }
57
51
  //# sourceMappingURL=ViewDescriptorsSet.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","makeMutable","makeViewDescriptorsSet","sharableViewDescriptors","data","add","item","modify","descriptors","index","findIndex","descriptor","tag","push","remove","viewTag","splice","makeViewsRefSet","ref","current","items","Set","has","delete"],"sources":["ViewDescriptorsSet.ts"],"sourcesContent":["import { useRef } from 'react';\nimport { makeMutable } from './core';\nimport { SharedValue } from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\n\nexport interface ViewRefSet<T> {\n items: Set<T>;\n add: (item: T) => void;\n remove: (item: T) => void;\n}\n\nexport interface ViewDescriptorsSet {\n sharableViewDescriptors: SharedValue<Descriptor[]>;\n add: (item: Descriptor) => void;\n remove: (viewTag: number) => void;\n}\n\nexport function makeViewDescriptorsSet(): ViewDescriptorsSet {\n const sharableViewDescriptors = makeMutable<Descriptor[]>([]);\n const data: ViewDescriptorsSet = {\n sharableViewDescriptors,\n add: (item: Descriptor) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === item.tag\n );\n if (index !== -1) {\n descriptors[index] = item;\n } else {\n descriptors.push(item);\n }\n return descriptors;\n });\n },\n\n remove: (viewTag: number) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === viewTag\n );\n if (index !== -1) {\n descriptors.splice(index, 1);\n }\n return descriptors;\n });\n },\n };\n return data;\n}\n\nexport function makeViewsRefSet<T>(): ViewRefSet<T> {\n const ref = useRef<ViewRefSet<T> | null>(null);\n if (ref.current === null) {\n const data: ViewRefSet<T> = {\n items: new Set(),\n\n add: (item: T) => {\n if (data.items.has(item)) return;\n data.items.add(item);\n },\n\n remove: (item: T) => {\n data.items.delete(item);\n },\n };\n ref.current = data;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,MAAT,QAAuB,OAAvB;AACA,SAASC,WAAT,QAA4B,QAA5B;AAgBA,OAAO,SAASC,sBAAT,GAAsD;EAC3D,MAAMC,uBAAuB,GAAGF,WAAW,CAAe,EAAf,CAA3C;EACA,MAAMG,IAAwB,GAAG;IAC/BD,uBAD+B;IAE/BE,GAAG,EAAGC,IAAD,IAAsB;MACzBH,uBAAuB,CAACI,MAAxB,CAAgCC,WAAD,IAA+B;QAC5D;;QACA,MAAMC,KAAK,GAAGD,WAAW,CAACE,SAAZ,CACXC,UAAD,IAAgBA,UAAU,CAACC,GAAX,KAAmBN,IAAI,CAACM,GAD5B,CAAd;;QAGA,IAAIH,KAAK,KAAK,CAAC,CAAf,EAAkB;UAChBD,WAAW,CAACC,KAAD,CAAX,GAAqBH,IAArB;QACD,CAFD,MAEO;UACLE,WAAW,CAACK,IAAZ,CAAiBP,IAAjB;QACD;;QACD,OAAOE,WAAP;MACD,CAXD;IAYD,CAf8B;IAiB/BM,MAAM,EAAGC,OAAD,IAAqB;MAC3BZ,uBAAuB,CAACI,MAAxB,CAAgCC,WAAD,IAA+B;QAC5D;;QACA,MAAMC,KAAK,GAAGD,WAAW,CAACE,SAAZ,CACXC,UAAD,IAAgBA,UAAU,CAACC,GAAX,KAAmBG,OADvB,CAAd;;QAGA,IAAIN,KAAK,KAAK,CAAC,CAAf,EAAkB;UAChBD,WAAW,CAACQ,MAAZ,CAAmBP,KAAnB,EAA0B,CAA1B;QACD;;QACD,OAAOD,WAAP;MACD,CATD;IAUD;EA5B8B,CAAjC;EA8BA,OAAOJ,IAAP;AACD;AAED,OAAO,SAASa,eAAT,GAA6C;EAClD,MAAMC,GAAG,GAAGlB,MAAM,CAAuB,IAAvB,CAAlB;;EACA,IAAIkB,GAAG,CAACC,OAAJ,KAAgB,IAApB,EAA0B;IACxB,MAAMf,IAAmB,GAAG;MAC1BgB,KAAK,EAAE,IAAIC,GAAJ,EADmB;MAG1BhB,GAAG,EAAGC,IAAD,IAAa;QAChB,IAAIF,IAAI,CAACgB,KAAL,CAAWE,GAAX,CAAehB,IAAf,CAAJ,EAA0B;QAC1BF,IAAI,CAACgB,KAAL,CAAWf,GAAX,CAAeC,IAAf;MACD,CANyB;MAQ1BQ,MAAM,EAAGR,IAAD,IAAa;QACnBF,IAAI,CAACgB,KAAL,CAAWG,MAAX,CAAkBjB,IAAlB;MACD;IAVyB,CAA5B;IAYAY,GAAG,CAACC,OAAJ,GAAcf,IAAd;EACD;;EAED,OAAOc,GAAG,CAACC,OAAX;AACD"}
1
+ {"version":3,"names":["useRef","makeMutable","makeViewDescriptorsSet","sharableViewDescriptors","data","add","item","modify","descriptors","index","findIndex","descriptor","tag","push","remove","viewTag","splice","makeViewsRefSet","ref","current","items","Set","has","delete"],"sources":["ViewDescriptorsSet.ts"],"sourcesContent":["import { useRef } from 'react';\nimport { makeMutable } from './core';\nimport { SharedValue } from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\n\nexport interface ViewRefSet<T> {\n items: Set<T>;\n add: (item: T) => void;\n remove: (item: T) => void;\n}\n\nexport interface ViewDescriptorsSet {\n sharableViewDescriptors: SharedValue<Descriptor[]>;\n add: (item: Descriptor) => void;\n remove: (viewTag: number) => void;\n}\n\nexport function makeViewDescriptorsSet(): ViewDescriptorsSet {\n const sharableViewDescriptors = makeMutable<Descriptor[]>([]);\n const data: ViewDescriptorsSet = {\n sharableViewDescriptors,\n add: (item: Descriptor) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === item.tag\n );\n if (index !== -1) {\n descriptors[index] = item;\n } else {\n descriptors.push(item);\n }\n return descriptors;\n });\n },\n\n remove: (viewTag: number) => {\n sharableViewDescriptors.modify((descriptors: Descriptor[]) => {\n 'worklet';\n const index = descriptors.findIndex(\n (descriptor) => descriptor.tag === viewTag\n );\n if (index !== -1) {\n descriptors.splice(index, 1);\n }\n return descriptors;\n });\n },\n };\n return data;\n}\n\nexport function makeViewsRefSet<T>(): ViewRefSet<T> {\n const ref = useRef<ViewRefSet<T> | null>(null);\n if (ref.current === null) {\n const data: ViewRefSet<T> = {\n items: new Set(),\n\n add: (item: T) => {\n if (data.items.has(item)) return;\n data.items.add(item);\n },\n\n remove: (item: T) => {\n data.items.delete(item);\n },\n };\n ref.current = data;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,WAAW,QAAQ,QAAQ;AAgBpC,OAAO,SAASC,sBAAsBA,CAAA,EAAuB;EAC3D,MAAMC,uBAAuB,GAAGF,WAAW,CAAe,EAAE,CAAC;EAC7D,MAAMG,IAAwB,GAAG;IAC/BD,uBAAuB;IACvBE,GAAG,EAAGC,IAAgB,IAAK;MACzBH,uBAAuB,CAACI,MAAM,CAAEC,WAAyB,IAAK;QAC5D,SAAS;;QACT,MAAMC,KA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c,GAAG,CAACC,OAAO;AACpB"}
@@ -1,39 +1,31 @@
1
- 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; }
2
-
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
4
  import NativeReanimatedModule from './NativeReanimated';
4
5
  import { registerEventHandler, unregisterEventHandler } from './core';
5
-
6
6
  function jsListener(eventName, handler) {
7
7
  return evt => {
8
- handler({ ...evt.nativeEvent,
8
+ handler({
9
+ ...evt.nativeEvent,
9
10
  eventName
10
11
  });
11
12
  };
12
13
  }
13
-
14
14
  export default class WorkletEventHandler {
15
15
  constructor(worklet) {
16
16
  let eventNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
17
-
18
17
  _defineProperty(this, "worklet", void 0);
19
-
20
18
  _defineProperty(this, "eventNames", void 0);
21
-
22
19
  _defineProperty(this, "reattachNeeded", void 0);
23
-
24
20
  _defineProperty(this, "listeners", void 0);
25
-
26
21
  _defineProperty(this, "viewTag", void 0);
27
-
28
22
  _defineProperty(this, "registrations", void 0);
29
-
30
23
  this.worklet = worklet;
31
24
  this.eventNames = eventNames;
32
25
  this.reattachNeeded = false;
33
26
  this.listeners = {};
34
27
  this.viewTag = undefined;
35
28
  this.registrations = [];
36
-
37
29
  if (!NativeReanimatedModule.native) {
38
30
  this.listeners = eventNames.reduce((acc, eventName) => {
39
31
  acc[eventName] = jsListener(eventName, worklet);
@@ -41,25 +33,20 @@ export default class WorkletEventHandler {
41
33
  }, {});
42
34
  }
43
35
  }
44
-
45
36
  updateWorklet(newWorklet) {
46
37
  this.worklet = newWorklet;
47
38
  this.reattachNeeded = true;
48
39
  }
49
-
50
40
  registerForEvents(viewTag, fallbackEventName) {
51
41
  this.viewTag = viewTag;
52
42
  this.registrations = this.eventNames.map(eventName => registerEventHandler(viewTag + eventName, this.worklet));
53
-
54
43
  if (this.registrations.length === 0 && fallbackEventName) {
55
44
  this.registrations.push(registerEventHandler(viewTag + fallbackEventName, this.worklet));
56
45
  }
57
46
  }
58
-
59
47
  unregisterFromEvents() {
60
48
  this.registrations.forEach(id => unregisterEventHandler(id));
61
49
  this.registrations = [];
62
50
  }
63
-
64
51
  }
65
52
  //# sourceMappingURL=WorkletEventHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeReanimatedModule","registerEventHandler","unregisterEventHandler","jsListener","eventName","handler","evt","nativeEvent","WorkletEventHandler","constructor","worklet","eventNames","reattachNeeded","listeners","viewTag","undefined","registrations","native","reduce","acc","updateWorklet","newWorklet","registerForEvents","fallbackEventName","map","length","push","unregisterFromEvents","forEach","id"],"sources":["WorkletEventHandler.ts"],"sourcesContent":["import { NativeEvent } from './commonTypes';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { registerEventHandler, unregisterEventHandler } from './core';\n\nfunction jsListener<T extends NativeEvent<T>>(\n eventName: string,\n handler: (event: T) => void\n) {\n return (evt: T) => {\n handler({ ...evt.nativeEvent, eventName });\n };\n}\n\nexport default class WorkletEventHandler<T extends NativeEvent<T>> {\n worklet: (event: T) => void;\n eventNames: string[];\n reattachNeeded: boolean;\n listeners: Record<string, (event: T) => void>;\n viewTag: number | undefined;\n registrations: string[];\n constructor(worklet: (event: T) => void, eventNames: string[] = []) {\n this.worklet = worklet;\n this.eventNames = eventNames;\n this.reattachNeeded = false;\n this.listeners = {};\n this.viewTag = undefined;\n this.registrations = [];\n\n if (!NativeReanimatedModule.native) {\n this.listeners = eventNames.reduce(\n (acc: Record<string, (event: T) => void>, eventName: string) => {\n acc[eventName] = jsListener(eventName, worklet);\n return acc;\n },\n {}\n );\n }\n }\n\n updateWorklet(newWorklet: (event: T) => void): void {\n this.worklet = newWorklet;\n this.reattachNeeded = true;\n }\n\n registerForEvents(viewTag: number, fallbackEventName?: string): void {\n this.viewTag = viewTag;\n this.registrations = this.eventNames.map((eventName) =>\n registerEventHandler(viewTag + eventName, this.worklet)\n );\n if (this.registrations.length === 0 && fallbackEventName) {\n this.registrations.push(\n registerEventHandler(viewTag + fallbackEventName, this.worklet)\n );\n }\n }\n\n unregisterFromEvents(): void {\n this.registrations.forEach((id) => unregisterEventHandler(id));\n this.registrations = [];\n }\n}\n"],"mappings":";;AACA,OAAOA,sBAAP,MAAmC,oBAAnC;AACA,SAASC,oBAAT,EAA+BC,sBAA/B,QAA6D,QAA7D;;AAEA,SAASC,UAAT,CACEC,SADF,EAEEC,OAFF,EAGE;EACA,OAAQC,GAAD,IAAY;IACjBD,OAAO,CAAC,EAAE,GAAGC,GAAG,CAACC,WAAT;MAAsBH;IAAtB,CAAD,CAAP;EACD,CAFD;AAGD;;AAED,eAAe,MAAMI,mBAAN,CAAoD;EAOjEC,WAAW,CAACC,OAAD,EAAyD;IAAA,IAA3BC,UAA2B,uEAAJ,EAAI;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAClE,KAAKD,OAAL,GAAeA,OAAf;IACA,KAAKC,UAAL,GAAkBA,UAAlB;IACA,KAAKC,cAAL,GAAsB,KAAtB;IACA,KAAKC,SAAL,GAAiB,EAAjB;IACA,KAAKC,OAAL,GAAeC,SAAf;IACA,KAAKC,aAAL,GAAqB,EAArB;;IAEA,IAAI,CAAChB,sBAAsB,CAACiB,MAA5B,EAAoC;MAClC,KAAKJ,SAAL,GAAiBF,UAAU,CAACO,MAAX,CACf,CAACC,GAAD,EAA0Cf,SAA1C,KAAgE;QAC9De,GAAG,CAACf,SAAD,CAAH,GAAiBD,UAAU,CAACC,SAAD,EAAYM,OAAZ,CAA3B;QACA,OAAOS,GAAP;MACD,CAJc,EAKf,EALe,CAAjB;IAOD;EACF;;EAEDC,aAAa,CAACC,UAAD,EAAuC;IAClD,KAAKX,OAAL,GAAeW,UAAf;IACA,KAAKT,cAAL,GAAsB,IAAtB;EACD;;EAEDU,iBAAiB,CAACR,OAAD,EAAkBS,iBAAlB,EAAoD;IACnE,KAAKT,OAAL,GAAeA,OAAf;IACA,KAAKE,aAAL,GAAqB,KAAKL,UAAL,CAAgBa,GAAhB,CAAqBpB,SAAD,IACvCH,oBAAoB,CAACa,OAAO,GAAGV,SAAX,EAAsB,KAAKM,OAA3B,CADD,CAArB;;IAGA,IAAI,KAAKM,aAAL,CAAmBS,MAAnB,KAA8B,CAA9B,IAAmCF,iBAAvC,EAA0D;MACxD,KAAKP,aAAL,CAAmBU,IAAnB,CACEzB,oBAAoB,CAACa,OAAO,GAAGS,iBAAX,EAA8B,KAAKb,OAAnC,CADtB;IAGD;EACF;;EAEDiB,oBAAoB,GAAS;IAC3B,KAAKX,aAAL,CAAmBY,OAAnB,CAA4BC,EAAD,IAAQ3B,sBAAsB,CAAC2B,EAAD,CAAzD;IACA,KAAKb,aAAL,GAAqB,EAArB;EACD;;AA9CgE"}
1
+ {"version":3,"names":["NativeReanimatedModule","registerEventHandler","unregisterEventHandler","jsListener","eventName","handler","evt","nativeEvent","WorkletEventHandler","constructor","worklet","eventNames","arguments","length","undefined","_defineProperty","reattachNeeded","listeners","viewTag","registrations","native","reduce","acc","updateWorklet","newWorklet","registerForEvents","fallbackEventName","map","push","unregisterFromEvents","forEach","id"],"sources":["WorkletEventHandler.ts"],"sourcesContent":["import { NativeEvent } from './commonTypes';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { registerEventHandler, unregisterEventHandler } from './core';\n\nfunction jsListener<T extends NativeEvent<T>>(\n eventName: string,\n handler: (event: T) => void\n) {\n return (evt: T) => {\n handler({ ...evt.nativeEvent, eventName });\n };\n}\n\nexport default class WorkletEventHandler<T extends NativeEvent<T>> {\n worklet: (event: T) => void;\n eventNames: string[];\n reattachNeeded: boolean;\n listeners: Record<string, (event: T) => void>;\n viewTag: number | undefined;\n registrations: string[];\n constructor(worklet: (event: T) => void, eventNames: string[] = []) {\n this.worklet = worklet;\n this.eventNames = eventNames;\n this.reattachNeeded = false;\n this.listeners = {};\n this.viewTag = undefined;\n this.registrations = [];\n\n if (!NativeReanimatedModule.native) {\n this.listeners = eventNames.reduce(\n (acc: Record<string, (event: T) => void>, eventName: string) => {\n acc[eventName] = jsListener(eventName, worklet);\n return acc;\n },\n {}\n );\n }\n }\n\n updateWorklet(newWorklet: (event: T) => void): void {\n this.worklet = newWorklet;\n this.reattachNeeded = true;\n }\n\n registerForEvents(viewTag: number, fallbackEventName?: string): void {\n this.viewTag = viewTag;\n this.registrations = this.eventNames.map((eventName) =>\n registerEventHandler(viewTag + eventName, this.worklet)\n );\n if (this.registrations.length === 0 && fallbackEventName) {\n this.registrations.push(\n registerEventHandler(viewTag + fallbackEventName, this.worklet)\n );\n }\n }\n\n unregisterFromEvents(): void {\n this.registrations.forEach((id) => unregisterEventHandler(id));\n this.registrations = [];\n }\n}\n"],"mappings":";;;AACA,OAAOA,sBAAsB,MAAM,oBAAoB;AACvD,SAASC,oBAAoB,EAAEC,sBAAsB,QAAQ,QAAQ;AAErE,SAASC,UAAUA,CACjBC,SAAiB,EACjBC,OAA2B,EAC3B;EACA,OAAQC,GAAM,IAAK;IACjBD,OAAO,CAAC;MAAE,GAAGC,GAAG,CAACC,WAAW;MAAEH;IAAU,CAAC,CAAC;EAC5C,CAAC;AACH;AAEA,eAAe,MAAMI,mBAAmB,CAA2B;EAOjEC,WAAWA,CAACC,OAA2B,EAA6B;IAAA,IAA3BC,UAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IAAAG,eAAA;IAAAA,eAAA;IAAA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