react-native-reanimated 3.8.1 → 3.9.0-layout-animation-experimental

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 (420) hide show
  1. package/Common/cpp/Fabric/ShadowTreeCloner.cpp +5 -2
  2. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +42 -32
  3. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +5 -7
  4. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +565 -0
  5. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +74 -0
  6. package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.h +140 -0
  7. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +216 -58
  8. package/Common/cpp/NativeModules/NativeReanimatedModule.h +32 -11
  9. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +2 -17
  10. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -8
  11. package/Common/cpp/ReanimatedRuntime/RNRuntimeDecorator.cpp +3 -0
  12. package/Common/cpp/ReanimatedRuntime/WorkletRuntime.cpp +3 -4
  13. package/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp +8 -3
  14. package/Common/cpp/SharedItems/Shareables.cpp +31 -5
  15. package/Common/cpp/SharedItems/Shareables.h +18 -2
  16. package/Common/cpp/Tools/JSScheduler.cpp +29 -5
  17. package/Common/cpp/Tools/JSScheduler.h +21 -4
  18. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -2
  19. package/Common/cpp/Tools/UIRuntimeDecorator.cpp +6 -0
  20. package/Common/cpp/Tools/UIRuntimeDecorator.h +1 -0
  21. package/android/CMakeLists.txt +3 -0
  22. package/android/build.gradle +17 -5
  23. package/android/src/main/cpp/NativeProxy.cpp +77 -12
  24. package/android/src/main/cpp/NativeProxy.h +35 -1
  25. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +58 -19
  26. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +7 -2
  27. package/android/src/{reactNativeVersionPatch/ReanimatedUIManager/latest → main/java}/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +5 -5
  28. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +10 -6
  29. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +18 -1
  30. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +105 -17
  31. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +2 -1
  32. package/android/src/paper/java/com/swmansion/reanimated/NativeReanimatedModuleSpec.java +37 -0
  33. package/android/src/{main/java/com/swmansion/reanimated → reactNativeVersionPatch/ReanimatedUIManager/73/com/swmansion}/ReanimatedModule.java +4 -3
  34. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/{70 → 73}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -22
  35. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedModule.java +176 -0
  36. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -26
  37. package/android/src/{fabric/java → reactNativeVersionPatch/RuntimeExecutor/73}/com/swmansion/reanimated/NativeProxy.java +16 -4
  38. package/android/src/reactNativeVersionPatch/RuntimeExecutor/latest/com/swmansion/reanimated/NativeProxy.java +143 -0
  39. package/apple/LayoutReanimation/REAAnimationsManager.h +3 -0
  40. package/apple/LayoutReanimation/REAAnimationsManager.m +11 -0
  41. package/apple/LayoutReanimation/REASharedTransitionManager.m +99 -23
  42. package/apple/LayoutReanimation/REASnapshot.h +1 -0
  43. package/apple/LayoutReanimation/REASnapshot.m +78 -37
  44. package/apple/REAModule.h +22 -2
  45. package/apple/REAModule.mm +97 -46
  46. package/apple/REANodesManager.h +3 -3
  47. package/apple/REANodesManager.mm +46 -22
  48. package/apple/native/NativeProxy.h +28 -2
  49. package/apple/native/NativeProxy.mm +65 -195
  50. package/apple/native/PlatformDepMethodsHolderImpl.h +59 -0
  51. package/apple/native/PlatformDepMethodsHolderImpl.mm +429 -0
  52. package/apple/sensor/ReanimatedSensor.m +5 -5
  53. package/lib/module/Animated.js.map +1 -1
  54. package/lib/module/ConfigHelper.js +1 -1
  55. package/lib/module/ConfigHelper.js.map +1 -1
  56. package/lib/module/animationBuilder.js.map +1 -1
  57. package/lib/module/createAnimatedComponent/InlinePropManager.js +4 -4
  58. package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
  59. package/lib/module/createAnimatedComponent/JSPropsUpdater.js +9 -6
  60. package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
  61. package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js +11 -0
  62. package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js.map +1 -0
  63. package/lib/module/createAnimatedComponent/PropsFilter.js +25 -9
  64. package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
  65. package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
  66. package/lib/module/createAnimatedComponent/createAnimatedComponent.js +83 -52
  67. package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
  68. package/lib/module/createAnimatedComponent/getViewInfo.js +37 -0
  69. package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -0
  70. package/lib/module/createAnimatedComponent/index.js.map +1 -1
  71. package/lib/module/createAnimatedComponent/setAndForwardRef.js +4 -5
  72. package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
  73. package/lib/module/createAnimatedComponent/utils.js.map +1 -1
  74. package/lib/module/index.js.map +1 -1
  75. package/lib/module/index.web.js +1 -2
  76. package/lib/module/index.web.js.map +1 -1
  77. package/lib/module/mock.js +3 -8
  78. package/lib/module/mock.js.map +1 -1
  79. package/lib/module/propsAllowlists.js.map +1 -1
  80. package/lib/module/reanimated2/Bezier.js.map +1 -1
  81. package/lib/module/reanimated2/Colors.js +4 -11
  82. package/lib/module/reanimated2/Colors.js.map +1 -1
  83. package/lib/module/reanimated2/Easing.js +3 -7
  84. package/lib/module/reanimated2/Easing.js.map +1 -1
  85. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -13
  86. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  87. package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
  88. package/lib/module/reanimated2/NativeReanimated/index.web.js.map +1 -1
  89. package/lib/module/reanimated2/PlatformChecker.js +2 -1
  90. package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
  91. package/lib/module/reanimated2/PropAdapters.js +1 -1
  92. package/lib/module/reanimated2/PropAdapters.js.map +1 -1
  93. package/lib/module/reanimated2/PropsRegistry.js +1 -2
  94. package/lib/module/reanimated2/PropsRegistry.js.map +1 -1
  95. package/lib/module/reanimated2/Sensor.js +2 -2
  96. package/lib/module/reanimated2/Sensor.js.map +1 -1
  97. package/lib/module/reanimated2/SensorContainer.js +2 -2
  98. package/lib/module/reanimated2/SensorContainer.js.map +1 -1
  99. package/lib/module/reanimated2/UpdateLayoutAnimations.js +30 -8
  100. package/lib/module/reanimated2/UpdateLayoutAnimations.js.map +1 -1
  101. package/lib/module/reanimated2/UpdateProps.js.map +1 -1
  102. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  103. package/lib/module/reanimated2/WorkletEventHandler.js +74 -31
  104. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  105. package/lib/module/reanimated2/animation/clamp.js.map +1 -1
  106. package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
  107. package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
  108. package/lib/module/reanimated2/animation/decay/index.js.map +1 -1
  109. package/lib/module/reanimated2/animation/decay/rigidDecay.js.map +1 -1
  110. package/lib/module/reanimated2/animation/decay/rubberBandDecay.js.map +1 -1
  111. package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
  112. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  113. package/lib/module/reanimated2/animation/index.js.map +1 -1
  114. package/lib/module/reanimated2/animation/repeat.js +1 -6
  115. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  116. package/lib/module/reanimated2/animation/sequence.js +1 -5
  117. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  118. package/lib/module/reanimated2/animation/spring.js.map +1 -1
  119. package/lib/module/reanimated2/animation/springUtils.js +8 -10
  120. package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
  121. package/lib/module/reanimated2/animation/styleAnimation.js +5 -4
  122. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  123. package/lib/module/reanimated2/animation/timing.js +4 -1
  124. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  125. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +1 -2
  126. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
  127. package/lib/module/reanimated2/animation/util.js +22 -2
  128. package/lib/module/reanimated2/animation/util.js.map +1 -1
  129. package/lib/module/reanimated2/commonTypes.js +3 -1
  130. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  131. package/lib/module/reanimated2/component/FlatList.js +1 -0
  132. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  133. package/lib/module/reanimated2/component/Image.js +1 -0
  134. package/lib/module/reanimated2/component/Image.js.map +1 -1
  135. package/lib/module/reanimated2/component/LayoutAnimationConfig.js +1 -0
  136. package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
  137. package/lib/module/reanimated2/component/PerformanceMonitor.js +169 -0
  138. package/lib/module/reanimated2/component/PerformanceMonitor.js.map +1 -0
  139. package/lib/module/reanimated2/component/ScrollView.js +1 -0
  140. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  141. package/lib/module/reanimated2/component/Text.js +1 -0
  142. package/lib/module/reanimated2/component/Text.js.map +1 -1
  143. package/lib/module/reanimated2/component/View.js +1 -0
  144. package/lib/module/reanimated2/component/View.js.map +1 -1
  145. package/lib/module/reanimated2/core.js +6 -15
  146. package/lib/module/reanimated2/core.js.map +1 -1
  147. package/lib/module/reanimated2/errors.js +8 -8
  148. package/lib/module/reanimated2/errors.js.map +1 -1
  149. package/lib/module/reanimated2/fabricUtils.js +33 -8
  150. package/lib/module/reanimated2/fabricUtils.js.map +1 -1
  151. package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
  152. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +2 -2
  153. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  154. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  155. package/lib/module/reanimated2/frameCallback/index.js.map +1 -1
  156. package/lib/module/reanimated2/globals.d.js.map +1 -1
  157. package/lib/module/reanimated2/helperTypes.js.map +1 -1
  158. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
  159. package/lib/module/reanimated2/hook/index.js.map +1 -1
  160. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -0
  161. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  162. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +3 -4
  163. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  164. package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
  165. package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -0
  166. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  167. package/lib/module/reanimated2/hook/useAnimatedRef.js +12 -7
  168. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  169. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +3 -1
  170. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  171. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  172. package/lib/module/reanimated2/hook/useAnimatedStyle.js +3 -6
  173. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  174. package/lib/module/reanimated2/hook/useDerivedValue.js +3 -1
  175. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  176. package/lib/module/reanimated2/hook/useEvent.js +4 -5
  177. package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
  178. package/lib/module/reanimated2/hook/useFrameCallback.js +1 -2
  179. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  180. package/lib/module/reanimated2/hook/useHandler.js +3 -1
  181. package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
  182. package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
  183. package/lib/module/reanimated2/hook/useScrollViewOffset.js +60 -16
  184. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  185. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  186. package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
  187. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  188. package/lib/module/reanimated2/index.js +2 -0
  189. package/lib/module/reanimated2/index.js.map +1 -1
  190. package/lib/module/reanimated2/initializers.js +1 -5
  191. package/lib/module/reanimated2/initializers.js.map +1 -1
  192. package/lib/module/reanimated2/interpolateColor.js +2 -6
  193. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  194. package/lib/module/reanimated2/interpolation.js +1 -1
  195. package/lib/module/reanimated2/interpolation.js.map +1 -1
  196. package/lib/module/reanimated2/isSharedValue.js.map +1 -1
  197. package/lib/module/reanimated2/jestUtils.js +3 -6
  198. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  199. package/lib/module/reanimated2/jestUtils.web.js.map +1 -1
  200. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +5 -9
  201. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  202. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -1
  203. package/lib/module/reanimated2/js-reanimated/index.js +2 -2
  204. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  205. package/lib/module/reanimated2/js-reanimated/react-native-web.d.js.map +1 -1
  206. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +4 -2
  207. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  208. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +12 -11
  209. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  210. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +12 -10
  211. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  212. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  213. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  214. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +11 -4
  215. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  216. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +22 -22
  217. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  218. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +22 -22
  219. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  220. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +26 -26
  221. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  222. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +10 -10
  223. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  224. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -6
  225. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  226. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +10 -10
  227. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  228. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +18 -18
  229. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  230. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +18 -18
  231. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  232. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +10 -10
  233. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  234. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +34 -34
  235. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  236. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  237. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +17 -4
  238. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  239. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +4 -4
  240. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  241. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +4 -4
  242. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  243. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +4 -4
  244. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  245. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +4 -4
  246. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  247. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +4 -4
  248. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  249. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  250. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  251. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js +16 -12
  252. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js.map +1 -1
  253. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +13 -7
  254. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
  255. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.web.js.map +1 -1
  256. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  257. package/lib/module/reanimated2/layoutReanimation/web/animation/Bounce.web.js.map +1 -1
  258. package/lib/module/reanimated2/layoutReanimation/web/animation/Fade.web.js.map +1 -1
  259. package/lib/module/reanimated2/layoutReanimation/web/animation/Flip.web.js.map +1 -1
  260. package/lib/module/reanimated2/layoutReanimation/web/animation/Lightspeed.web.js.map +1 -1
  261. package/lib/module/reanimated2/layoutReanimation/web/animation/Pinwheel.web.js.map +1 -1
  262. package/lib/module/reanimated2/layoutReanimation/web/animation/Roll.web.js.map +1 -1
  263. package/lib/module/reanimated2/layoutReanimation/web/animation/Rotate.web.js.map +1 -1
  264. package/lib/module/reanimated2/layoutReanimation/web/animation/Slide.web.js.map +1 -1
  265. package/lib/module/reanimated2/layoutReanimation/web/animation/Stretch.web.js.map +1 -1
  266. package/lib/module/reanimated2/layoutReanimation/web/animation/Zoom.web.js.map +1 -1
  267. package/lib/module/reanimated2/layoutReanimation/web/animationParser.js +0 -2
  268. package/lib/module/reanimated2/layoutReanimation/web/animationParser.js.map +1 -1
  269. package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js +1 -2
  270. package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js.map +1 -1
  271. package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js +3 -1
  272. package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js.map +1 -1
  273. package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js +6 -7
  274. package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js.map +1 -1
  275. package/lib/module/reanimated2/layoutReanimation/web/config.js.map +1 -1
  276. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +2 -2
  277. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
  278. package/lib/module/reanimated2/layoutReanimation/web/domUtils.js +4 -4
  279. package/lib/module/reanimated2/layoutReanimation/web/domUtils.js.map +1 -1
  280. package/lib/module/reanimated2/layoutReanimation/web/index.js.map +1 -1
  281. package/lib/module/reanimated2/layoutReanimation/web/transition/Fading.web.js.map +1 -1
  282. package/lib/module/reanimated2/layoutReanimation/web/transition/Linear.web.js.map +1 -1
  283. package/lib/module/reanimated2/layoutReanimation/web/transition/Sequenced.web.js.map +1 -1
  284. package/lib/module/reanimated2/mappers.js +2 -4
  285. package/lib/module/reanimated2/mappers.js.map +1 -1
  286. package/lib/module/reanimated2/mockedRequestAnimationFrame.js.map +1 -1
  287. package/lib/module/reanimated2/mutables.js +2 -4
  288. package/lib/module/reanimated2/mutables.js.map +1 -1
  289. package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  290. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  291. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
  292. package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
  293. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
  294. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +2 -4
  295. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
  296. package/lib/module/reanimated2/platformFunctions/dispatchCommand.web.js.map +1 -1
  297. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +2 -2
  298. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
  299. package/lib/module/reanimated2/platformFunctions/index.js.map +1 -1
  300. package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
  301. package/lib/module/reanimated2/platformFunctions/measure.web.js.map +1 -1
  302. package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
  303. package/lib/module/reanimated2/platformFunctions/scrollTo.web.js +1 -1
  304. package/lib/module/reanimated2/platformFunctions/scrollTo.web.js.map +1 -1
  305. package/lib/module/reanimated2/platformFunctions/setGestureState.js.map +1 -1
  306. package/lib/module/reanimated2/platformFunctions/setGestureState.web.js.map +1 -1
  307. package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
  308. package/lib/module/reanimated2/platformFunctions/setNativeProps.web.js.map +1 -1
  309. package/lib/module/reanimated2/pluginUtils.js.map +1 -1
  310. package/lib/module/reanimated2/publicGlobals.js.map +1 -1
  311. package/lib/module/reanimated2/runtimes.js +11 -19
  312. package/lib/module/reanimated2/runtimes.js.map +1 -1
  313. package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js +20 -0
  314. package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js.map +1 -0
  315. package/lib/module/reanimated2/screenTransition/animationManager.js +41 -0
  316. package/lib/module/reanimated2/screenTransition/animationManager.js.map +1 -0
  317. package/lib/module/reanimated2/screenTransition/commonTypes.js +4 -0
  318. package/lib/module/reanimated2/screenTransition/commonTypes.js.map +1 -0
  319. package/lib/module/reanimated2/screenTransition/index.js +5 -0
  320. package/lib/module/reanimated2/screenTransition/index.js.map +1 -0
  321. package/lib/module/reanimated2/screenTransition/presets.js +157 -0
  322. package/lib/module/reanimated2/screenTransition/presets.js.map +1 -0
  323. package/lib/module/reanimated2/screenTransition/styleUpdater.js +62 -0
  324. package/lib/module/reanimated2/screenTransition/styleUpdater.js.map +1 -0
  325. package/lib/module/reanimated2/screenTransition/swipeSimulator.js +190 -0
  326. package/lib/module/reanimated2/screenTransition/swipeSimulator.js.map +1 -0
  327. package/lib/module/reanimated2/shareableMappingCache.js.map +1 -1
  328. package/lib/module/reanimated2/shareables.js +27 -10
  329. package/lib/module/reanimated2/shareables.js.map +1 -1
  330. package/lib/module/reanimated2/threads.js +9 -34
  331. package/lib/module/reanimated2/threads.js.map +1 -1
  332. package/lib/module/reanimated2/valueSetter.js +1 -2
  333. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  334. package/lib/module/reanimated2/valueUnpacker.js +4 -3
  335. package/lib/module/reanimated2/valueUnpacker.js.map +1 -1
  336. package/lib/module/specs/NativeReanimatedModule.js +5 -0
  337. package/lib/module/specs/NativeReanimatedModule.js.map +1 -0
  338. package/lib/typescript/ConfigHelper.d.ts +1 -0
  339. package/lib/typescript/createAnimatedComponent/InlinePropManager.d.ts +1 -1
  340. package/lib/typescript/createAnimatedComponent/JSPropsUpdater.web.d.ts +6 -0
  341. package/lib/typescript/createAnimatedComponent/PropsFilter.d.ts +3 -0
  342. package/lib/typescript/createAnimatedComponent/getViewInfo.d.ts +9 -0
  343. package/lib/typescript/reanimated2/NativeReanimated/NativeReanimated.d.ts +8 -13
  344. package/lib/typescript/reanimated2/UpdateLayoutAnimations.d.ts +12 -1
  345. package/lib/typescript/reanimated2/WorkletEventHandler.d.ts +16 -9
  346. package/lib/typescript/reanimated2/animation/util.d.ts +2 -0
  347. package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +1 -1
  348. package/lib/typescript/reanimated2/component/PerformanceMonitor.d.ts +2 -0
  349. package/lib/typescript/reanimated2/core.d.ts +3 -4
  350. package/lib/typescript/reanimated2/hook/commonTypes.d.ts +6 -0
  351. package/lib/typescript/reanimated2/hook/useEvent.d.ts +2 -3
  352. package/lib/typescript/reanimated2/hook/useScrollViewOffset.d.ts +3 -1
  353. package/lib/typescript/reanimated2/index.d.ts +3 -0
  354. package/lib/typescript/reanimated2/js-reanimated/JSReanimated.d.ts +2 -2
  355. package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +2 -1
  356. package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.d.ts +2 -2
  357. package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.d.ts +2 -2
  358. package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
  359. package/lib/typescript/reanimated2/screenTransition/RNScreensTurboModule.d.ts +2 -0
  360. package/lib/typescript/reanimated2/screenTransition/animationManager.d.ts +3 -0
  361. package/lib/typescript/reanimated2/screenTransition/commonTypes.d.ts +38 -0
  362. package/lib/typescript/reanimated2/screenTransition/index.d.ts +3 -0
  363. package/lib/typescript/reanimated2/screenTransition/presets.d.ts +11 -0
  364. package/lib/typescript/reanimated2/screenTransition/styleUpdater.d.ts +3 -0
  365. package/lib/typescript/reanimated2/screenTransition/swipeSimulator.d.ts +2 -0
  366. package/lib/typescript/specs/NativeReanimatedModule.d.ts +6 -0
  367. package/package.json +29 -17
  368. package/plugin/build/plugin.js +7 -2
  369. package/src/ConfigHelper.ts +1 -1
  370. package/src/createAnimatedComponent/InlinePropManager.ts +2 -2
  371. package/src/createAnimatedComponent/JSPropsUpdater.ts +7 -6
  372. package/src/createAnimatedComponent/JSPropsUpdater.web.ts +26 -0
  373. package/src/createAnimatedComponent/PropsFilter.tsx +31 -6
  374. package/src/createAnimatedComponent/createAnimatedComponent.tsx +108 -60
  375. package/src/createAnimatedComponent/getViewInfo.ts +39 -0
  376. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +33 -35
  377. package/src/reanimated2/PlatformChecker.ts +3 -2
  378. package/src/reanimated2/PropsRegistry.ts +1 -3
  379. package/src/reanimated2/UpdateLayoutAnimations.ts +53 -13
  380. package/src/reanimated2/WorkletEventHandler.ts +98 -39
  381. package/src/reanimated2/animation/styleAnimation.ts +8 -6
  382. package/src/reanimated2/animation/timing.ts +9 -1
  383. package/src/reanimated2/animation/util.ts +28 -3
  384. package/src/reanimated2/commonTypes.ts +4 -1
  385. package/src/reanimated2/component/PerformanceMonitor.tsx +216 -0
  386. package/src/reanimated2/core.ts +9 -31
  387. package/src/reanimated2/errors.ts +1 -0
  388. package/src/reanimated2/fabricUtils.ts +43 -18
  389. package/src/reanimated2/globals.d.ts +11 -1
  390. package/src/reanimated2/hook/commonTypes.ts +10 -0
  391. package/src/reanimated2/hook/useAnimatedRef.ts +20 -11
  392. package/src/reanimated2/hook/useEvent.ts +4 -4
  393. package/src/reanimated2/hook/useScrollViewOffset.ts +94 -23
  394. package/src/reanimated2/index.ts +11 -0
  395. package/src/reanimated2/js-reanimated/JSReanimated.ts +7 -7
  396. package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +4 -0
  397. package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +9 -1
  398. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +9 -1
  399. package/src/reanimated2/layoutReanimation/animationsManager.ts +10 -2
  400. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +13 -0
  401. package/src/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts +17 -8
  402. package/src/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.ts +26 -7
  403. package/src/reanimated2/layoutReanimation/web/animationsManager.ts +1 -1
  404. package/src/reanimated2/layoutReanimation/web/componentStyle.ts +3 -1
  405. package/src/reanimated2/layoutReanimation/web/componentUtils.ts +1 -1
  406. package/src/reanimated2/layoutReanimation/web/createAnimation.ts +2 -2
  407. package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
  408. package/src/reanimated2/platformFunctions/getRelativeCoords.ts +2 -2
  409. package/src/reanimated2/screenTransition/RNScreensTurboModule.ts +29 -0
  410. package/src/reanimated2/screenTransition/animationManager.ts +45 -0
  411. package/src/reanimated2/screenTransition/commonTypes.ts +63 -0
  412. package/src/reanimated2/screenTransition/index.ts +12 -0
  413. package/src/reanimated2/screenTransition/presets.ts +137 -0
  414. package/src/reanimated2/screenTransition/styleUpdater.ts +73 -0
  415. package/src/reanimated2/screenTransition/swipeSimulator.ts +238 -0
  416. package/src/reanimated2/shareables.ts +29 -6
  417. package/src/reanimated2/valueUnpacker.ts +10 -3
  418. package/src/specs/NativeReanimatedModule.ts +9 -0
  419. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +0 -16
  420. package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +0 -12
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-var */\n'use strict';\nimport type {\n StyleProps,\n MeasuredDimensions,\n MapperRegistry,\n ShareableRef,\n ShadowNodeWrapper,\n FlatShareableRef,\n} from './commonTypes';\nimport type { AnimatedStyle } from './helperTypes';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { NativeReanimatedModule } from './NativeReanimated/NativeReanimated';\nimport type { SensorContainer } from './SensorContainer';\nimport type { LayoutAnimationsManager } from './layoutReanimation/animationsManager';\nimport type { ProgressTransitionRegister } from './layoutReanimation/sharedTransitions';\nimport type { UpdatePropsManager } from './UpdateProps';\nimport type { callGuardDEV } from './initializers';\nimport type { WorkletRuntime } from './runtimes';\n\ndeclare global {\n var _REANIMATED_IS_REDUCED_MOTION: boolean | undefined;\n var _IS_FABRIC: boolean | undefined;\n var _REANIMATED_VERSION_CPP: string | undefined;\n var _REANIMATED_VERSION_JS: string | undefined;\n var __reanimatedModuleProxy: NativeReanimatedModule | undefined;\n var __callGuardDEV: typeof callGuardDEV | undefined;\n var evalWithSourceMap:\n | ((js: string, sourceURL: string, sourceMap: string) => any)\n | undefined;\n var evalWithSourceUrl: ((js: string, sourceURL: string) => any) | undefined;\n var _log: (value: unknown) => void;\n var _toString: (value: unknown) => string;\n var _notifyAboutProgress: (\n tag: number,\n value: Record<string, unknown>,\n isSharedTransition: boolean\n ) => void;\n var _notifyAboutEnd: (tag: number, removeView: boolean) => void;\n var _setGestureState: (handlerTag: number, newState: number) => void;\n var _makeShareableClone: <T>(value: T) => FlatShareableRef<T>;\n var _scheduleOnJS: (fun: (...args: A) => R, args?: A) => void;\n var _scheduleOnRuntime: (\n runtime: WorkletRuntime,\n worklet: ShareableRef<() => void>\n ) => void;\n var _updatePropsPaper:\n | ((\n operations: {\n tag: number;\n name: string | null;\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n updates: StyleProps | AnimatedStyle<any>;\n }[]\n ) => void)\n | undefined;\n var _updatePropsFabric:\n | ((\n operations: {\n shadowNodeWrapper: ShadowNodeWrapper;\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n updates: StyleProps | AnimatedStyle<any>;\n }[]\n ) => void)\n | undefined;\n var _removeFromPropsRegistry: (viewTags: number[]) => void | undefined;\n var _measurePaper:\n | ((viewTag: number | null) => MeasuredDimensions)\n | undefined;\n var _measureFabric:\n | ((shadowNodeWrapper: ShadowNodeWrapper | null) => MeasuredDimensions)\n | undefined;\n var _scrollToPaper:\n | ((viewTag: number, x: number, y: number, animated: boolean) => void)\n | undefined;\n var _dispatchCommandPaper:\n | ((viewTag: number, commandName: string, args: Array<unknown>) => void)\n | undefined;\n var _dispatchCommandFabric:\n | ((\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void)\n | undefined;\n var _getAnimationTimestamp: () => number;\n var __ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n var _frameCallbackRegistry: FrameCallbackRegistryUI;\n var console: Console;\n var __frameTimestamp: number | undefined;\n var __flushAnimationFrame: (timestamp: number) => void;\n var __workletsCache: Map<string, any>;\n var __handleCache: WeakMap<object, any>;\n var __callMicrotasks: () => void;\n var __mapperRegistry: MapperRegistry;\n var __sensorContainer: SensorContainer;\n var _maybeFlushUIUpdatesQueue: () => void;\n var LayoutAnimationsManager: LayoutAnimationsManager;\n var UpdatePropsManager: UpdatePropsManager;\n var ProgressTransitionRegister: ProgressTransitionRegister;\n var updateJSProps: (viewTag: number, props: Record<string, unknown>) => void;\n}\n"],"mappings":"AAAA;AACA;AACA,YAAY;;AAAC"}
1
+ {"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-var */\n'use strict';\nimport type {\n StyleProps,\n MeasuredDimensions,\n MapperRegistry,\n ShareableRef,\n ShadowNodeWrapper,\n FlatShareableRef,\n} from './commonTypes';\nimport type { AnimatedStyle } from './helperTypes';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { NativeReanimatedModule } from './NativeReanimated/NativeReanimated';\nimport type { SensorContainer } from './SensorContainer';\nimport type { LayoutAnimationsManager } from './layoutReanimation/animationsManager';\nimport type { ProgressTransitionRegister } from './layoutReanimation/sharedTransitions';\nimport type { UpdatePropsManager } from './UpdateProps';\nimport type { callGuardDEV } from './initializers';\nimport type { WorkletRuntime } from './runtimes';\nimport type { RNScreensTurboModuleType } from './screenTransition/commonTypes';\n\ndeclare global {\n var _REANIMATED_IS_REDUCED_MOTION: boolean | undefined;\n var _IS_FABRIC: boolean | undefined;\n var _REANIMATED_VERSION_CPP: string | undefined;\n var _REANIMATED_VERSION_JS: string | undefined;\n var __reanimatedModuleProxy: NativeReanimatedModule | undefined;\n var __callGuardDEV: typeof callGuardDEV | undefined;\n var evalWithSourceMap:\n | ((js: string, sourceURL: string, sourceMap: string) => any)\n | undefined;\n var evalWithSourceUrl: ((js: string, sourceURL: string) => any) | undefined;\n var _log: (value: unknown) => void;\n var _toString: (value: unknown) => string;\n var _notifyAboutProgress: (\n tag: number,\n value: Record<string, unknown>,\n isSharedTransition: boolean\n ) => void;\n var _notifyAboutEnd: (tag: number, removeView: boolean) => void;\n var _setGestureState: (handlerTag: number, newState: number) => void;\n var _makeShareableClone: <T>(\n value: T,\n nativeStateSource?: object\n ) => FlatShareableRef<T>;\n var _scheduleOnJS: (fun: (...args: A) => R, args?: A) => void;\n var _scheduleOnRuntime: (\n runtime: WorkletRuntime,\n worklet: ShareableRef<() => void>\n ) => void;\n var _updatePropsPaper:\n | ((\n operations: {\n tag: number;\n name: string | null;\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n updates: StyleProps | AnimatedStyle<any>;\n }[]\n ) => void)\n | undefined;\n var _updatePropsFabric:\n | ((\n operations: {\n shadowNodeWrapper: ShadowNodeWrapper;\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n updates: StyleProps | AnimatedStyle<any>;\n }[]\n ) => void)\n | undefined;\n var _removeFromPropsRegistry: (viewTags: number[]) => void | undefined;\n var _measurePaper:\n | ((viewTag: number | null) => MeasuredDimensions)\n | undefined;\n var _measureFabric:\n | ((shadowNodeWrapper: ShadowNodeWrapper | null) => MeasuredDimensions)\n | undefined;\n var _scrollToPaper:\n | ((viewTag: number, x: number, y: number, animated: boolean) => void)\n | undefined;\n var _dispatchCommandPaper:\n | ((viewTag: number, commandName: string, args: Array<unknown>) => void)\n | undefined;\n var _dispatchCommandFabric:\n | ((\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void)\n | undefined;\n var _getAnimationTimestamp: () => number;\n var __ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n var _frameCallbackRegistry: FrameCallbackRegistryUI;\n var console: Console;\n var __frameTimestamp: number | undefined;\n var __flushAnimationFrame: (timestamp: number) => void;\n var __workletsCache: Map<string, any>;\n var __handleCache: WeakMap<object, any>;\n var __callMicrotasks: () => void;\n var __mapperRegistry: MapperRegistry;\n var __sensorContainer: SensorContainer;\n var _maybeFlushUIUpdatesQueue: () => void;\n var LayoutAnimationsManager: LayoutAnimationsManager;\n var UpdatePropsManager: UpdatePropsManager;\n var ProgressTransitionRegister: ProgressTransitionRegister;\n var updateJSProps: (viewTag: number, props: Record<string, unknown>) => void;\n var RNScreensTurboModule: RNScreensTurboModuleType | undefined;\n var _obtainPropPaper: (viewTag: number, propName: string) => string;\n var _obtainPropFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n propName: string\n ) => string;\n}\n"],"mappings":"AAAA;AACA;AACA,YAAY;;AAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["helperTypes.ts"],"sourcesContent":["'use strict';\n/*\nThis file is a legacy remainder of manual types from react-native-reanimated.d.ts file. \nI wasn't able to get rid of all of them from the code. \nThey should be treated as a temporary solution\nuntil time comes to refactor the code and get necessary types right. \nThis will not be easy though! \n*/\n\nimport type {\n ImageStyle,\n RegisteredStyle,\n StyleProp,\n TextStyle,\n TransformsStyle,\n ViewStyle,\n} from 'react-native';\nimport type { AnimatableValue, SharedValue } from './commonTypes';\nimport type { BaseAnimationBuilder } from './layoutReanimation/animationBuilder/BaseAnimationBuilder';\nimport type {\n EntryExitAnimationFunction,\n LayoutAnimationFunction,\n} from './layoutReanimation/animationBuilder/commonTypes';\nimport type { ReanimatedKeyframe } from './layoutReanimation/animationBuilder/Keyframe';\nimport type { SharedTransition } from './layoutReanimation/sharedTransitions';\n\nexport type TransformArrayItem = Extract<\n TransformsStyle['transform'],\n Array<unknown>\n>[number];\n\nexport type AnimatedTransform = MaybeSharedValueRecursive<\n TransformsStyle['transform']\n>;\n\ntype MaybeSharedValue<Value> =\n | Value\n | (Value extends AnimatableValue ? SharedValue<Value> : never);\n\ntype MaybeSharedValueRecursive<Value> = Value extends (infer Item)[]\n ? SharedValue<Item[]> | (MaybeSharedValueRecursive<Item> | Item)[]\n : Value extends object\n ?\n | SharedValue<Value>\n | {\n [Key in keyof Value]:\n | MaybeSharedValueRecursive<Value[Key]>\n | Value[Key];\n }\n : MaybeSharedValue<Value>;\n\ntype DefaultStyle = ViewStyle & ImageStyle & TextStyle;\n\n// Ideally we want AnimatedStyle to not be generic, but there are\n// so many depenedencies on it being generic that it's not feasible at the moment.\nexport type AnimatedStyle<Style = DefaultStyle> =\n | Style\n | MaybeSharedValueRecursive<Style>;\n\ntype EntryOrExitLayoutType =\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | ReanimatedKeyframe;\n\n/*\n Style type properties (properties that extends StyleProp<ViewStyle>)\n can be defined with other property names than \"style\". For example `contentContainerStyle` in FlatList.\n Type definition for all style type properties should act similarly, hence we\n pick keys with 'Style' substring with the use of this utility type.\n*/\ntype PickStyleProps<Props> = Pick<\n Props,\n {\n [Key in keyof Props]-?: Key extends `${string}Style` | 'style'\n ? Key\n : never;\n }[keyof Props]\n>;\n\ntype AnimatedStyleProps<Props extends object> = {\n [Key in keyof PickStyleProps<Props>]: StyleProp<AnimatedStyle<Props[Key]>>;\n};\n\n/**\n * Component props that are not specially handled by us.\n */\ntype RestProps<Props extends object> = {\n [K in keyof Omit<Props, keyof PickStyleProps<Props> | 'style'>]:\n | Props[K]\n | SharedValue<Props[K]>;\n};\n\ntype LayoutProps = {\n /**\n * Lets you animate the layout changes when components are added to or removed from the view hierarchy.\n *\n * You can use the predefined layout transitions (eg. `LinearTransition`, `FadingTransition`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions\n */\n layout?:\n | BaseAnimationBuilder\n | LayoutAnimationFunction\n | typeof BaseAnimationBuilder;\n /**\n * Lets you animate an element when it's added to or removed from the view hierarchy.\n *\n * You can use the predefined entering animations (eg. `FadeIn`, `SlideInLeft`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/entering-exiting-animations\n */\n entering?: EntryOrExitLayoutType;\n /**\n * Lets you animate an element when it's added to or removed from the view hierarchy.\n *\n * You can use the predefined entering animations (eg. `FadeOut`, `SlideOutRight`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/entering-exiting-animations\n */\n exiting?: EntryOrExitLayoutType;\n};\n\ntype SharedTransitionProps = {\n /**\n * Lets you animate components between two navigation screens.\n *\n * Assign the same `sharedTransitionTag` to [animated components](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component) on two different navigation screens to create a shared transition.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n sharedTransitionTag?: string;\n /**\n * Lets you create a custom shared transition animation.\n *\n * Used alongside `SharedTransition.custom()` method.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n sharedTransitionStyle?: SharedTransition;\n};\n\ntype AnimatedPropsProp<Props extends object> = RestProps<Props> &\n AnimatedStyleProps<Props> &\n LayoutProps &\n SharedTransitionProps;\n\nexport type AnimatedProps<Props extends object> = RestProps<Props> &\n AnimatedStyleProps<Props> &\n LayoutProps &\n SharedTransitionProps & {\n /**\n * Lets you animate component props.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedProps\n */\n animatedProps?: Partial<AnimatedPropsProp<Props>>;\n };\n\n// THE LAND OF THE DEPRECATED\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type Adaptable<T> =\n | T\n | ReadonlyArray<T | ReadonlyArray<T>>\n | SharedValue<T>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type AdaptTransforms<T> = {\n [P in keyof T]: Adaptable<T[P]>;\n};\n\n/**\n * @deprecated Please use {@link TransformArrayItem} type instead.\n */\nexport type TransformStyleTypes = TransformArrayItem;\n\n/**\n * @deprecated Please use {@link AnimatedStyle} type instead.\n */\nexport type AnimateStyle<Style = DefaultStyle> = AnimatedStyle<Style>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type StylesOrDefault<T> = 'style' extends keyof T\n ? MaybeSharedValueRecursive<T['style']>\n : Record<string, unknown>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type AnimatedStyleProp<T> =\n | AnimatedStyle<T>\n | RegisteredStyle<AnimatedStyle<T>>;\n\n/**\n * @deprecated Please use {@link AnimatedProps} type instead.\n */\nexport type AnimateProps<Props extends object> = AnimatedProps<Props>;\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AANA"}
1
+ {"version":3,"names":[],"sources":["helperTypes.ts"],"sourcesContent":["'use strict';\n/*\nThis file is a legacy remainder of manual types from react-native-reanimated.d.ts file. \nI wasn't able to get rid of all of them from the code. \nThey should be treated as a temporary solution\nuntil time comes to refactor the code and get necessary types right. \nThis will not be easy though! \n*/\n\nimport type {\n ImageStyle,\n RegisteredStyle,\n StyleProp,\n TextStyle,\n TransformsStyle,\n ViewStyle,\n} from 'react-native';\nimport type { AnimatableValue, SharedValue } from './commonTypes';\nimport type { BaseAnimationBuilder } from './layoutReanimation/animationBuilder/BaseAnimationBuilder';\nimport type {\n EntryExitAnimationFunction,\n LayoutAnimationFunction,\n} from './layoutReanimation/animationBuilder/commonTypes';\nimport type { ReanimatedKeyframe } from './layoutReanimation/animationBuilder/Keyframe';\nimport type { SharedTransition } from './layoutReanimation/sharedTransitions';\n\nexport type TransformArrayItem = Extract<\n TransformsStyle['transform'],\n Array<unknown>\n>[number];\n\nexport type AnimatedTransform = MaybeSharedValueRecursive<\n TransformsStyle['transform']\n>;\n\ntype MaybeSharedValue<Value> =\n | Value\n | (Value extends AnimatableValue ? SharedValue<Value> : never);\n\ntype MaybeSharedValueRecursive<Value> = Value extends (infer Item)[]\n ? SharedValue<Item[]> | (MaybeSharedValueRecursive<Item> | Item)[]\n : Value extends object\n ?\n | SharedValue<Value>\n | {\n [Key in keyof Value]:\n | MaybeSharedValueRecursive<Value[Key]>\n | Value[Key];\n }\n : MaybeSharedValue<Value>;\n\ntype DefaultStyle = ViewStyle & ImageStyle & TextStyle;\n\n// Ideally we want AnimatedStyle to not be generic, but there are\n// so many depenedencies on it being generic that it's not feasible at the moment.\nexport type AnimatedStyle<Style = DefaultStyle> =\n | Style\n | MaybeSharedValueRecursive<Style>;\n\ntype EntryOrExitLayoutType =\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | ReanimatedKeyframe;\n\n/*\n Style type properties (properties that extends StyleProp<ViewStyle>)\n can be defined with other property names than \"style\". For example `contentContainerStyle` in FlatList.\n Type definition for all style type properties should act similarly, hence we\n pick keys with 'Style' substring with the use of this utility type.\n*/\ntype PickStyleProps<Props> = Pick<\n Props,\n {\n [Key in keyof Props]-?: Key extends `${string}Style` | 'style'\n ? Key\n : never;\n }[keyof Props]\n>;\n\ntype AnimatedStyleProps<Props extends object> = {\n [Key in keyof PickStyleProps<Props>]: StyleProp<AnimatedStyle<Props[Key]>>;\n};\n\n/**\n * Component props that are not specially handled by us.\n */\ntype RestProps<Props extends object> = {\n [K in keyof Omit<Props, keyof PickStyleProps<Props> | 'style'>]:\n | Props[K]\n | SharedValue<Props[K]>;\n};\n\ntype LayoutProps = {\n /**\n * Lets you animate the layout changes when components are added to or removed from the view hierarchy.\n *\n * You can use the predefined layout transitions (eg. `LinearTransition`, `FadingTransition`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions\n */\n layout?:\n | BaseAnimationBuilder\n | LayoutAnimationFunction\n | typeof BaseAnimationBuilder;\n /**\n * Lets you animate an element when it's added to or removed from the view hierarchy.\n *\n * You can use the predefined entering animations (eg. `FadeIn`, `SlideInLeft`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/entering-exiting-animations\n */\n entering?: EntryOrExitLayoutType;\n /**\n * Lets you animate an element when it's added to or removed from the view hierarchy.\n *\n * You can use the predefined entering animations (eg. `FadeOut`, `SlideOutRight`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/entering-exiting-animations\n */\n exiting?: EntryOrExitLayoutType;\n};\n\ntype SharedTransitionProps = {\n /**\n * Lets you animate components between two navigation screens.\n *\n * Assign the same `sharedTransitionTag` to [animated components](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component) on two different navigation screens to create a shared transition.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n sharedTransitionTag?: string;\n /**\n * Lets you create a custom shared transition animation.\n *\n * Used alongside `SharedTransition.custom()` method.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n sharedTransitionStyle?: SharedTransition;\n};\n\ntype AnimatedPropsProp<Props extends object> = RestProps<Props> &\n AnimatedStyleProps<Props> &\n LayoutProps &\n SharedTransitionProps;\n\nexport type AnimatedProps<Props extends object> = RestProps<Props> &\n AnimatedStyleProps<Props> &\n LayoutProps &\n SharedTransitionProps & {\n /**\n * Lets you animate component props.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedProps\n */\n animatedProps?: Partial<AnimatedPropsProp<Props>>;\n };\n\n// THE LAND OF THE DEPRECATED\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type Adaptable<T> =\n | T\n | ReadonlyArray<T | ReadonlyArray<T>>\n | SharedValue<T>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type AdaptTransforms<T> = {\n [P in keyof T]: Adaptable<T[P]>;\n};\n\n/**\n * @deprecated Please use {@link TransformArrayItem} type instead.\n */\nexport type TransformStyleTypes = TransformArrayItem;\n\n/**\n * @deprecated Please use {@link AnimatedStyle} type instead.\n */\nexport type AnimateStyle<Style = DefaultStyle> = AnimatedStyle<Style>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type StylesOrDefault<T> = 'style' extends keyof T\n ? MaybeSharedValueRecursive<T['style']>\n : Record<string, unknown>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type AnimatedStyleProp<T> =\n | AnimatedStyle<T>\n | RegisteredStyle<AnimatedStyle<T>>;\n\n/**\n * @deprecated Please use {@link AnimatedProps} type instead.\n */\nexport type AnimateProps<Props extends object> = AnimatedProps<Props>;\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AANA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\nimport type { Component, MutableRefObject } from 'react';\nimport type {\n AnimatedPropsAdapterFunction,\n ShadowNodeWrapper,\n SharedValue,\n WorkletFunction,\n} from '../commonTypes';\nimport type {\n ImageStyle,\n NativeSyntheticEvent,\n TextStyle,\n ViewStyle,\n NativeScrollEvent,\n} from 'react-native';\nimport type { ViewDescriptorsSet, ViewRefSet } from '../ViewDescriptorsSet';\nimport type { AnimatedStyle } from '../helperTypes';\n\nexport type DependencyList = Array<unknown> | undefined;\n\nexport interface Descriptor {\n tag: number;\n name: string;\n shadowNodeWrapper: ShadowNodeWrapper;\n}\n\nexport interface AnimatedRef<T extends Component> {\n (component?: T):\n | number // Paper\n | ShadowNodeWrapper // Fabric\n | HTMLElement; // web\n current: T | null;\n}\n\n// Might make that type generic if it's ever needed.\nexport type AnimatedRefOnJS = AnimatedRef<Component>;\n\n/**\n * `AnimatedRef` is mapped to this type on the UI thread via a shareable handle.\n */\nexport type AnimatedRefOnUI = {\n (): number | ShadowNodeWrapper | null;\n /**\n * @remarks `viewName` is required only on iOS with Paper and it's value is null on other platforms.\n */\n viewName: SharedValue<string | null>;\n};\n\ntype ReanimatedPayload = {\n eventName: string;\n};\n\n/**\n * This utility type is to convert type of events that would normally be\n * sent by React Native (they have `nativeEvent` field) to the type\n * that is sent by Reanimated.\n */\nexport type ReanimatedEvent<Event extends object> = ReanimatedPayload &\n (Event extends {\n nativeEvent: infer NativeEvent extends object;\n }\n ? NativeEvent\n : Event);\n\nexport type EventPayload<Event extends object> = Event extends {\n nativeEvent: infer NativeEvent extends object;\n}\n ? NativeEvent\n : Omit<Event, 'eventName'>;\n\nexport type NativeEventWrapper<Event extends object> = {\n nativeEvent: Event;\n};\n\nexport type DefaultStyle = ViewStyle | ImageStyle | TextStyle;\n\nexport type RNNativeScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;\n\nexport type ReanimatedScrollEvent = ReanimatedEvent<RNNativeScrollEvent>;\n\nexport interface AnimatedStyleHandle<\n Style extends DefaultStyle = DefaultStyle\n> {\n viewDescriptors: ViewDescriptorsSet;\n initial: {\n value: AnimatedStyle<Style>;\n updater: () => AnimatedStyle<Style>;\n };\n /**\n * @remarks `viewsRef` is only defined in Web implementation.\n */\n viewsRef: ViewRefSet<unknown> | undefined;\n}\n\nexport interface JestAnimatedStyleHandle<\n Style extends DefaultStyle = DefaultStyle\n> extends AnimatedStyleHandle<Style> {\n jestAnimatedStyle: MutableRefObject<AnimatedStyle<Style>>;\n}\n\nexport type UseAnimatedStyleInternal<Style extends DefaultStyle> = (\n updater: WorkletFunction<[], Style> | (() => Style),\n dependencies?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null,\n isAnimatedProps?: boolean\n) => AnimatedStyleHandle<Style> | JestAnimatedStyleHandle<Style>;\n"],"mappings":"AAAA,YAAY;;AAAC"}
1
+ {"version":3,"names":[],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\nimport type { Component, MutableRefObject } from 'react';\nimport type {\n AnimatedPropsAdapterFunction,\n ShadowNodeWrapper,\n SharedValue,\n WorkletFunction,\n} from '../commonTypes';\nimport type {\n ImageStyle,\n NativeSyntheticEvent,\n TextStyle,\n ViewStyle,\n NativeScrollEvent,\n} from 'react-native';\nimport type { ViewDescriptorsSet, ViewRefSet } from '../ViewDescriptorsSet';\nimport type { AnimatedStyle } from '../helperTypes';\n\nexport type DependencyList = Array<unknown> | undefined;\n\nexport interface Descriptor {\n tag: number;\n name: string;\n shadowNodeWrapper: ShadowNodeWrapper;\n}\n\nexport interface AnimatedRef<T extends Component> {\n (component?: T):\n | number // Paper\n | ShadowNodeWrapper // Fabric\n | HTMLElement; // web\n current: T | null;\n getTag: () => number;\n}\n\n// Might make that type generic if it's ever needed.\nexport type AnimatedRefOnJS = AnimatedRef<Component>;\n\n/**\n * `AnimatedRef` is mapped to this type on the UI thread via a shareable handle.\n */\nexport type AnimatedRefOnUI = {\n (): number | ShadowNodeWrapper | null;\n /**\n * @remarks `viewName` is required only on iOS with Paper and it's value is null on other platforms.\n */\n viewName: SharedValue<string | null>;\n};\n\ntype ReanimatedPayload = {\n eventName: string;\n};\n\n/**\n * This utility type is to convert type of events that would normally be\n * sent by React Native (they have `nativeEvent` field) to the type\n * that is sent by Reanimated.\n */\nexport type ReanimatedEvent<Event extends object> = ReanimatedPayload &\n (Event extends {\n nativeEvent: infer NativeEvent extends object;\n }\n ? NativeEvent\n : Event);\n\nexport type EventPayload<Event extends object> = Event extends {\n nativeEvent: infer NativeEvent extends object;\n}\n ? NativeEvent\n : Omit<Event, 'eventName'>;\n\nexport type NativeEventWrapper<Event extends object> = {\n nativeEvent: Event;\n};\n\nexport type DefaultStyle = ViewStyle | ImageStyle | TextStyle;\n\nexport type RNNativeScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;\n\nexport type ReanimatedScrollEvent = ReanimatedEvent<RNNativeScrollEvent>;\n\nexport interface IWorkletEventHandler<Event extends object> {\n updateEventHandler: (\n newWorklet: (event: ReanimatedEvent<Event>) => void,\n newEvents: string[]\n ) => void;\n registerForEvents: (viewTag: number, fallbackEventName?: string) => void;\n unregisterFromEvents: (viewTag: number) => void;\n}\n\nexport interface AnimatedStyleHandle<\n Style extends DefaultStyle = DefaultStyle\n> {\n viewDescriptors: ViewDescriptorsSet;\n initial: {\n value: AnimatedStyle<Style>;\n updater: () => AnimatedStyle<Style>;\n };\n /**\n * @remarks `viewsRef` is only defined in Web implementation.\n */\n viewsRef: ViewRefSet<unknown> | undefined;\n}\n\nexport interface JestAnimatedStyleHandle<\n Style extends DefaultStyle = DefaultStyle\n> extends AnimatedStyleHandle<Style> {\n jestAnimatedStyle: MutableRefObject<AnimatedStyle<Style>>;\n}\n\nexport type UseAnimatedStyleInternal<Style extends DefaultStyle> = (\n updater: WorkletFunction<[], Style> | (() => Style),\n dependencies?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null,\n isAnimatedProps?: boolean\n) => AnimatedStyleHandle<Style> | JestAnimatedStyleHandle<Style>;\n"],"mappings":"AAAA,YAAY;;AAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["useAnimatedProps","useWorkletCallback","useSharedValue","useReducedMotion","useAnimatedStyle","useAnimatedGestureHandler","useAnimatedReaction","useAnimatedRef","useAnimatedScrollHandler","useDerivedValue","useAnimatedSensor","useFrameCallback","useAnimatedKeyboard","useScrollViewOffset","useEvent","useHandler"],"sources":["index.ts"],"sourcesContent":["'use strict';\nexport type {\n DependencyList,\n AnimatedRef,\n ReanimatedScrollEvent as ScrollEvent,\n ReanimatedEvent,\n} from './commonTypes';\nexport { useAnimatedProps } from './useAnimatedProps';\nexport { useWorkletCallback } from './useWorkletCallback';\nexport { useSharedValue } from './useSharedValue';\nexport { useReducedMotion } from './useReducedMotion';\nexport { useAnimatedStyle } from './useAnimatedStyle';\nexport { useAnimatedGestureHandler } from './useAnimatedGestureHandler';\nexport type {\n GestureHandlerEvent,\n GestureHandlers,\n} from './useAnimatedGestureHandler';\nexport { useAnimatedReaction } from './useAnimatedReaction';\nexport { useAnimatedRef } from './useAnimatedRef';\nexport { useAnimatedScrollHandler } from './useAnimatedScrollHandler';\nexport type {\n ScrollHandler,\n ScrollHandlers,\n ScrollHandlerProcessed,\n ScrollHandlerInternal,\n} from './useAnimatedScrollHandler';\nexport { useDerivedValue } from './useDerivedValue';\nexport type { DerivedValue } from './useDerivedValue';\nexport { useAnimatedSensor } from './useAnimatedSensor';\nexport { useFrameCallback } from './useFrameCallback';\nexport type { FrameCallback } from './useFrameCallback';\nexport { useAnimatedKeyboard } from './useAnimatedKeyboard';\nexport { useScrollViewOffset } from './useScrollViewOffset';\nexport type {\n EventHandler,\n EventHandlerProcessed,\n EventHandlerInternal,\n} from './useEvent';\nexport { useEvent } from './useEvent';\nexport type { UseHandlerContext } from './useHandler';\nexport { useHandler } from './useHandler';\n"],"mappings":"AAAA,YAAY;;AAOZ,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,yBAAyB,QAAQ,6BAA6B;AAKvE,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,wBAAwB,QAAQ,4BAA4B;AAOrE,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,mBAAmB,QAAQ,uBAAuB;AAM3D,SAASC,QAAQ,QAAQ,YAAY;AAErC,SAASC,UAAU,QAAQ,cAAc"}
1
+ {"version":3,"names":["useAnimatedProps","useWorkletCallback","useSharedValue","useReducedMotion","useAnimatedStyle","useAnimatedGestureHandler","useAnimatedReaction","useAnimatedRef","useAnimatedScrollHandler","useDerivedValue","useAnimatedSensor","useFrameCallback","useAnimatedKeyboard","useScrollViewOffset","useEvent","useHandler"],"sources":["index.ts"],"sourcesContent":["'use strict';\nexport type {\n DependencyList,\n AnimatedRef,\n ReanimatedScrollEvent as ScrollEvent,\n ReanimatedEvent,\n} from './commonTypes';\nexport { useAnimatedProps } from './useAnimatedProps';\nexport { useWorkletCallback } from './useWorkletCallback';\nexport { useSharedValue } from './useSharedValue';\nexport { useReducedMotion } from './useReducedMotion';\nexport { useAnimatedStyle } from './useAnimatedStyle';\nexport { useAnimatedGestureHandler } from './useAnimatedGestureHandler';\nexport type {\n GestureHandlerEvent,\n GestureHandlers,\n} from './useAnimatedGestureHandler';\nexport { useAnimatedReaction } from './useAnimatedReaction';\nexport { useAnimatedRef } from './useAnimatedRef';\nexport { useAnimatedScrollHandler } from './useAnimatedScrollHandler';\nexport type {\n ScrollHandler,\n ScrollHandlers,\n ScrollHandlerProcessed,\n ScrollHandlerInternal,\n} from './useAnimatedScrollHandler';\nexport { useDerivedValue } from './useDerivedValue';\nexport type { DerivedValue } from './useDerivedValue';\nexport { useAnimatedSensor } from './useAnimatedSensor';\nexport { useFrameCallback } from './useFrameCallback';\nexport type { FrameCallback } from './useFrameCallback';\nexport { useAnimatedKeyboard } from './useAnimatedKeyboard';\nexport { useScrollViewOffset } from './useScrollViewOffset';\nexport type {\n EventHandler,\n EventHandlerProcessed,\n EventHandlerInternal,\n} from './useEvent';\nexport { useEvent } from './useEvent';\nexport type { UseHandlerContext } from './useHandler';\nexport { useHandler } from './useHandler';\n"],"mappings":"AAAA,YAAY;;AAOZ,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,yBAAyB,QAAQ,6BAA6B;AAKvE,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,wBAAwB,QAAQ,4BAA4B;AAOrE,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,mBAAmB,QAAQ,uBAAuB;AAM3D,SAASC,QAAQ,QAAQ,YAAY;AAErC,SAASC,UAAU,QAAQ,cAAc","ignoreList":[]}
@@ -13,6 +13,7 @@ const EVENT_TYPE = {
13
13
 
14
14
  // This type comes from React Native Gesture Handler
15
15
  // import type { PanGestureHandlerGestureEvent as DefaultEvent } from 'react-native-gesture-handler';
16
+
16
17
  /**
17
18
  * @deprecated useAnimatedGestureHandler is an old API which is no longer supported.
18
19
  *
@@ -1 +1 @@
1
- {"version":3,"names":["useHandler","useEvent","EVENT_TYPE","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END","useAnimatedGestureHandler","handlers","dependencies","context","doDependenciesDiffer","useWeb","handler","e","event","nativeEvent","state","onStart","onActive","oldState","onEnd","onFail","onCancel","onFinish"],"sources":["useAnimatedGestureHandler.ts"],"sourcesContent":["'use strict';\nimport type {\n DependencyList,\n NativeEventWrapper,\n ReanimatedEvent,\n} from './commonTypes';\nimport { useHandler } from './useHandler';\nimport { useEvent } from './useEvent';\n\nconst EVENT_TYPE = {\n UNDETERMINED: 0,\n FAILED: 1,\n BEGAN: 2,\n CANCELLED: 3,\n ACTIVE: 4,\n END: 5,\n} as const;\n\ntype StateType = (typeof EVENT_TYPE)[keyof typeof EVENT_TYPE];\n\n// This type comes from React Native Gesture Handler\n// import type { PanGestureHandlerGestureEvent as DefaultEvent } from 'react-native-gesture-handler';\ntype DefaultEvent = {\n nativeEvent: {\n readonly handlerTag: number;\n readonly numberOfPointers: number;\n readonly state: (typeof EVENT_TYPE)[keyof typeof EVENT_TYPE];\n readonly x: number;\n readonly y: number;\n readonly absoluteX: number;\n readonly absoluteY: number;\n readonly translationX: number;\n readonly translationY: number;\n readonly velocityX: number;\n readonly velocityY: number;\n };\n};\n\ninterface PropsUsedInUseAnimatedGestureHandler {\n handlerTag?: number;\n numberOfPointers?: number;\n state?: StateType;\n oldState?: StateType;\n}\n\nexport type GestureHandlerEvent<Event extends object> =\n | ReanimatedEvent<Event>\n | Event;\n\ntype GestureHandler<\n Event extends NativeEventWrapper<PropsUsedInUseAnimatedGestureHandler>,\n Context extends Record<string, unknown>\n> = (\n eventPayload: ReanimatedEvent<Event>,\n context: Context,\n isCanceledOrFailed?: boolean\n) => void;\n\nexport interface GestureHandlers<\n Event extends NativeEventWrapper<PropsUsedInUseAnimatedGestureHandler>,\n Context extends Record<string, unknown>\n> {\n [key: string]: GestureHandler<Event, Context> | undefined;\n onStart?: GestureHandler<Event, Context>;\n onActive?: GestureHandler<Event, Context>;\n onEnd?: GestureHandler<Event, Context>;\n onFail?: GestureHandler<Event, Context>;\n onCancel?: GestureHandler<Event, Context>;\n onFinish?: GestureHandler<Event, Context>;\n}\n\n/**\n * @deprecated useAnimatedGestureHandler is an old API which is no longer supported.\n *\n * Please check https://docs.swmansion.com/react-native-gesture-handler/docs/guides/upgrading-to-2/\n * for information about how to migrate to `react-native-gesture-handler` v2\n */\nexport function useAnimatedGestureHandler<\n Event extends NativeEventWrapper<PropsUsedInUseAnimatedGestureHandler> = DefaultEvent,\n Context extends Record<string, unknown> = Record<string, unknown>\n>(handlers: GestureHandlers<Event, Context>, dependencies?: DependencyList) {\n type WebOrNativeEvent = Event | ReanimatedEvent<Event>;\n\n const { context, doDependenciesDiffer, useWeb } = useHandler<Event, Context>(\n handlers,\n dependencies\n );\n const handler = (e: WebOrNativeEvent) => {\n 'worklet';\n const event = useWeb\n ? // On Web we get events straight from React Native and they don't have\n // the `eventName` field there. To simplify the types here we just\n // cast it as the field was available.\n ((e as Event).nativeEvent as ReanimatedEvent<Event>)\n : (e as ReanimatedEvent<Event>);\n\n if (event.state === EVENT_TYPE.BEGAN && handlers.onStart) {\n handlers.onStart(event, context);\n }\n if (event.state === EVENT_TYPE.ACTIVE && handlers.onActive) {\n handlers.onActive(event, context);\n }\n if (\n event.oldState === EVENT_TYPE.ACTIVE &&\n event.state === EVENT_TYPE.END &&\n handlers.onEnd\n ) {\n handlers.onEnd(event, context);\n }\n if (\n event.oldState === EVENT_TYPE.BEGAN &&\n event.state === EVENT_TYPE.FAILED &&\n handlers.onFail\n ) {\n handlers.onFail(event, context);\n }\n if (\n event.oldState === EVENT_TYPE.ACTIVE &&\n event.state === EVENT_TYPE.CANCELLED &&\n handlers.onCancel\n ) {\n handlers.onCancel(event, context);\n }\n if (\n (event.oldState === EVENT_TYPE.BEGAN ||\n event.oldState === EVENT_TYPE.ACTIVE) &&\n event.state !== EVENT_TYPE.BEGAN &&\n event.state !== EVENT_TYPE.ACTIVE &&\n handlers.onFinish\n ) {\n handlers.onFinish(\n event,\n context,\n event.state === EVENT_TYPE.CANCELLED ||\n event.state === EVENT_TYPE.FAILED\n );\n }\n };\n\n if (useWeb) {\n return handler;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useEvent<Event>(\n handler,\n ['onGestureHandlerStateChange', 'onGestureHandlerEvent'],\n doDependenciesDiffer\n // This is not correct but we want to make GH think it receives a function.\n ) as unknown as (e: Event) => void;\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,QAAQ,YAAY;AAErC,MAAMC,UAAU,GAAG;EACjBC,YAAY,EAAE,CAAC;EACfC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,MAAM,EAAE,CAAC;EACTC,GAAG,EAAE;AACP,CAAU;;AAIV;AACA;AAkDA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CAGvCC,QAAyC,EAAEC,YAA6B,EAAE;EAG1E,MAAM;IAAEC,OAAO;IAAEC,oBAAoB;IAAEC;EAAO,CAAC,GAAGd,UAAU,CAC1DU,QAAQ,EACRC,YAAY,CACb;EACD,MAAMI,OAAO,GAAIC,CAAmB,IAAK;IACvC,SAAS;;IACT,MAAMC,KAAK,GAAGH,MAAM;IAChB;IACA;IACA;IACEE,CAAC,CAAWE,WAAW,GACxBF,CAA4B;IAEjC,IAAIC,KAAK,CAACE,KAAK,KAAKjB,UAAU,CAACG,KAAK,IAAIK,QAAQ,CAACU,OAAO,EAAE;MACxDV,QAAQ,CAACU,OAAO,CAACH,KAAK,EAAEL,OAAO,CAAC;IAClC;IACA,IAAIK,KAAK,CAACE,KAAK,KAAKjB,UAAU,CAACK,MAAM,IAAIG,QAAQ,CAACW,QAAQ,EAAE;MAC1DX,QAAQ,CAACW,QAAQ,CAACJ,KAAK,EAAEL,OA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andler","useEvent","EVENT_TYPE","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END","useAnimatedGestureHandler","handlers","dependencies","context","doDependenciesDiffer","useWeb","handler","e","event","nativeEvent","state","onStart","onActive","oldState","onEnd","onFail","onCancel","onFinish"],"sources":["useAnimatedGestureHandler.ts"],"sourcesContent":["'use strict';\nimport type {\n DependencyList,\n NativeEventWrapper,\n ReanimatedEvent,\n} from './commonTypes';\nimport { useHandler } from './useHandler';\nimport { useEvent } from './useEvent';\n\nconst EVENT_TYPE = {\n UNDETERMINED: 0,\n FAILED: 1,\n BEGAN: 2,\n CANCELLED: 3,\n ACTIVE: 4,\n END: 5,\n} as const;\n\ntype StateType = (typeof EVENT_TYPE)[keyof typeof EVENT_TYPE];\n\n// This type comes from React Native Gesture Handler\n// import type { PanGestureHandlerGestureEvent as DefaultEvent } from 'react-native-gesture-handler';\ntype DefaultEvent = {\n nativeEvent: {\n readonly handlerTag: number;\n readonly numberOfPointers: number;\n readonly state: (typeof EVENT_TYPE)[keyof typeof EVENT_TYPE];\n readonly x: number;\n readonly y: number;\n readonly absoluteX: number;\n readonly absoluteY: number;\n readonly translationX: number;\n readonly translationY: number;\n readonly velocityX: number;\n readonly velocityY: number;\n };\n};\n\ninterface PropsUsedInUseAnimatedGestureHandler {\n handlerTag?: number;\n numberOfPointers?: number;\n state?: StateType;\n oldState?: StateType;\n}\n\nexport type GestureHandlerEvent<Event extends object> =\n | ReanimatedEvent<Event>\n | Event;\n\ntype GestureHandler<\n Event extends NativeEventWrapper<PropsUsedInUseAnimatedGestureHandler>,\n Context extends Record<string, unknown>\n> = (\n eventPayload: ReanimatedEvent<Event>,\n context: Context,\n isCanceledOrFailed?: boolean\n) => void;\n\nexport interface GestureHandlers<\n Event extends NativeEventWrapper<PropsUsedInUseAnimatedGestureHandler>,\n Context extends Record<string, unknown>\n> {\n [key: string]: GestureHandler<Event, Context> | undefined;\n onStart?: GestureHandler<Event, Context>;\n onActive?: GestureHandler<Event, Context>;\n onEnd?: GestureHandler<Event, Context>;\n onFail?: GestureHandler<Event, Context>;\n onCancel?: GestureHandler<Event, Context>;\n onFinish?: GestureHandler<Event, Context>;\n}\n\n/**\n * @deprecated useAnimatedGestureHandler is an old API which is no longer supported.\n *\n * Please check https://docs.swmansion.com/react-native-gesture-handler/docs/guides/upgrading-to-2/\n * for information about how to migrate to `react-native-gesture-handler` v2\n */\nexport function useAnimatedGestureHandler<\n Event extends NativeEventWrapper<PropsUsedInUseAnimatedGestureHandler> = DefaultEvent,\n Context extends Record<string, unknown> = Record<string, unknown>\n>(handlers: GestureHandlers<Event, Context>, dependencies?: DependencyList) {\n type WebOrNativeEvent = Event | ReanimatedEvent<Event>;\n\n const { context, doDependenciesDiffer, useWeb } = useHandler<Event, Context>(\n handlers,\n dependencies\n );\n const handler = (e: WebOrNativeEvent) => {\n 'worklet';\n const event = useWeb\n ? // On Web we get events straight from React Native and they don't have\n // the `eventName` field there. To simplify the types here we just\n // cast it as the field was available.\n ((e as Event).nativeEvent as ReanimatedEvent<Event>)\n : (e as ReanimatedEvent<Event>);\n\n if (event.state === EVENT_TYPE.BEGAN && handlers.onStart) {\n handlers.onStart(event, context);\n }\n if (event.state === EVENT_TYPE.ACTIVE && handlers.onActive) {\n handlers.onActive(event, context);\n }\n if (\n event.oldState === EVENT_TYPE.ACTIVE &&\n event.state === EVENT_TYPE.END &&\n handlers.onEnd\n ) {\n handlers.onEnd(event, context);\n }\n if (\n event.oldState === EVENT_TYPE.BEGAN &&\n event.state === EVENT_TYPE.FAILED &&\n handlers.onFail\n ) {\n handlers.onFail(event, context);\n }\n if (\n event.oldState === EVENT_TYPE.ACTIVE &&\n event.state === EVENT_TYPE.CANCELLED &&\n handlers.onCancel\n ) {\n handlers.onCancel(event, context);\n }\n if (\n (event.oldState === EVENT_TYPE.BEGAN ||\n event.oldState === EVENT_TYPE.ACTIVE) &&\n event.state !== EVENT_TYPE.BEGAN &&\n event.state !== EVENT_TYPE.ACTIVE &&\n handlers.onFinish\n ) {\n handlers.onFinish(\n event,\n context,\n event.state === EVENT_TYPE.CANCELLED ||\n event.state === EVENT_TYPE.FAILED\n );\n }\n };\n\n if (useWeb) {\n return handler;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useEvent<Event>(\n handler,\n ['onGestureHandlerStateChange', 'onGestureHandlerEvent'],\n doDependenciesDiffer\n // This is not correct but we want to make GH think it receives a function.\n ) as unknown as (e: Event) => void;\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,QAAQ,YAAY;AAErC,MAAMC,UAAU,GAAG;EACjBC,YAAY,EAAE,CAAC;EACfC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,MAAM,EAAE,CAAC;EACTC,GAAG,EAAE;AACP,CAAU;;AAIV;AACA;;AAkDA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CAGvCC,QAAyC,EAAEC,YAA6B,EAAE;EAG1E,MAAM;IAAEC,OAAO;IAAEC,oBAAoB;IAAEC;EAAO,CAAC,GAAGd,UAAU,CAC1DU,QAAQ,EACRC,YACF,CAAC;EACD,MAAMI,OAAO,GAAIC,CAAmB,IAAK;IACvC,SAAS;;IACT,MAAMC,KAAK,GAAGH,MAAM;IAChB;IACA;IACA;IACEE,CAAC,CAAWE,WAAW,GACxBF,CAA4B;IAEjC,IAAIC,KAAK,CAACE,KAAK,KAAKjB,UAAU,CAACG,KAAK,IAAIK,QAAQ,CAACU,OAAO,EAAE;MACxDV,QAAQ,CAACU,OAAO,CAACH,KAAK,EAAEL,OAAO,CAAC;IAClC;IACA,IAAIK,KAAK,CAACE,KAAK,KAAKjB,UAAU,CAACK,MAAM,IAAIG,QAAQ,CAACW,QAAQ,EAAE;MAC1DX,QAAQ,CAACW,QAAQ,CAACJ,KAAK,EAAEL,OAAO,CAAC;IACnC;IACA,IACEK,KAAK,C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11
11
  * @returns An object with the current keyboard `height` and `state` as [shared values](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value).
12
12
  * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedKeyboard
13
13
  */
14
- export function useAnimatedKeyboard() {
15
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
16
- isStatusBarTranslucentAndroid: false
17
- };
14
+ export function useAnimatedKeyboard(options = {
15
+ isStatusBarTranslucentAndroid: false
16
+ }) {
18
17
  const ref = useRef(null);
19
18
  const listenerId = useRef(-1);
20
19
  const isSubscribed = useRef(false);
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useRef","makeMutable","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","KeyboardState","useAnimatedKeyboard","options","arguments","length","undefined","isStatusBarTranslucentAndroid","ref","listenerId","isSubscribed","current","keyboardEventData","state","UNKNOWN","height","value"],"sources":["useAnimatedKeyboard.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport {\n makeMutable,\n subscribeForKeyboardEvents,\n unsubscribeFromKeyboardEvents,\n} from '../core';\nimport type {\n AnimatedKeyboardInfo,\n AnimatedKeyboardOptions,\n} from '../commonTypes';\nimport { KeyboardState } from '../commonTypes';\n\n/**\n * Lets you synchronously get the position and state of the keyboard.\n *\n * @param options - An additional keyboard configuration options.\n * @returns An object with the current keyboard `height` and `state` as [shared values](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value).\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedKeyboard\n */\nexport function useAnimatedKeyboard(\n options: AnimatedKeyboardOptions = { isStatusBarTranslucentAndroid: false }\n): AnimatedKeyboardInfo {\n const ref = useRef<AnimatedKeyboardInfo | null>(null);\n const listenerId = useRef<number>(-1);\n const isSubscribed = useRef<boolean>(false);\n\n if (ref.current === null) {\n const keyboardEventData: AnimatedKeyboardInfo = {\n state: makeMutable<KeyboardState>(KeyboardState.UNKNOWN),\n height: makeMutable(0),\n };\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n }, options);\n ref.current = keyboardEventData;\n isSubscribed.current = true;\n }\n useEffect(() => {\n if (isSubscribed.current === false && ref.current !== null) {\n const keyboardEventData = ref.current;\n // subscribe again after Fast Refresh\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n }, options);\n isSubscribed.current = true;\n }\n return () => {\n unsubscribeFromKeyboardEvents(listenerId.current);\n isSubscribed.current = false;\n };\n }, []);\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,6BAA6B,QACxB,SAAS;AAKhB,SAASC,aAAa,QAAQ,gBAAgB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAEX;EAAA,IADtBC,OAAgC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IAAEG,6BAA6B,EAAE;EAAM,CAAC;EAE3E,MAAMC,GAAG,GAAGX,MAAM,CAA8B,IAAI,CAAC;EACrD,MAAMY,UAAU,GAAGZ,MAAM,CAAS,CAAC,CAAC,CAAC;EACrC,MAAMa,YAAY,GAAGb,MAAM,CAAU,KAAK,CAAC;EAE3C,IAAIW,GAAG,CAACG,OAAO,KAAK,IAAI,EAAE;IACxB,MAAMC,iBAAuC,GAAG;MAC9CC,KAAK,EAAEf,WAAW,CAAgBG,aAAa,CAACa,OAAO,CAAC;MACxDC,MAAM,EAAEjB,WAAW,CAAC,CAAC;IACvB,CAAC;IACDW,UAAU,CAACE,OAAO,GAAGZ,0BAA0B,CAAC,CAACc,KAAK,EAAEE,MAAM,KAAK;MACjE,SAAS;;MACTH,iBAAiB,CAACC,KAAK,CAACG,KAAK,GAAGH,KAAK;MACrCD,iBAAiB,CAACG,MAAM,CAACC,KAAK,GAAGD,MAAM;IACzC,CAAC,EAAEZ,OAAO,CAAC;IACXK,GAAG,CAACG,OAAO,GAAGC,iBAAiB;IAC/BF,YAAY,CAACC,OAAO,GAAG,IAAI;EAC7B;EACAf,SAAS,CAAC,MAAM;IACd,IAAIc,YAAY,CAACC,OAAO,KAAK,KAAK,IAAIH,GAAG,CAACG,OAAO,KAAK,IAAI,EAAE;MAC1D,MAAMC,iBAAiB,GAAGJ,GAAG,CAACG,OAAO;MACrC;MACAF,UAAU,CAACE,OAAO,GAAGZ,0BAA0B,CAAC,CAACc,KAAK,EAAEE,MAAM,KAAK;QACjE,SAAS;;QACTH,iBAAiB,CAACC,KAAK,CAACG,KAAK,GAAGH,KAAK;QACrCD,iBAAiB,CAACG,MAAM,CAACC,KAAK,GAAGD,MAAM;MACzC,CAAC,EAAEZ,OAAO,CAAC;MACXO,YAAY,CAACC,OAAO,GAAG,IAAI;IAC7B;IACA,OAAO,MAAM;MACXX,6BAA6B,CAACS,UAAU,CAACE,OAAO,CAAC;MACjDD,YAAY,CAACC,OAAO,GAAG,KAAK;IAC9B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,OAAOH,GAAG,CAACG,OAAO;AACpB"}
1
+ {"version":3,"names":["useEffect","useRef","makeMutable","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","KeyboardState","useAnimatedKeyboard","options","isStatusBarTranslucentAndroid","ref","listenerId","isSubscribed","current","keyboardEventData","state","UNKNOWN","height","value"],"sources":["useAnimatedKeyboard.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport {\n makeMutable,\n subscribeForKeyboardEvents,\n unsubscribeFromKeyboardEvents,\n} from '../core';\nimport type {\n AnimatedKeyboardInfo,\n AnimatedKeyboardOptions,\n} from '../commonTypes';\nimport { KeyboardState } from '../commonTypes';\n\n/**\n * Lets you synchronously get the position and state of the keyboard.\n *\n * @param options - An additional keyboard configuration options.\n * @returns An object with the current keyboard `height` and `state` as [shared values](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value).\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedKeyboard\n */\nexport function useAnimatedKeyboard(\n options: AnimatedKeyboardOptions = { isStatusBarTranslucentAndroid: false }\n): AnimatedKeyboardInfo {\n const ref = useRef<AnimatedKeyboardInfo | null>(null);\n const listenerId = useRef<number>(-1);\n const isSubscribed = useRef<boolean>(false);\n\n if (ref.current === null) {\n const keyboardEventData: AnimatedKeyboardInfo = {\n state: makeMutable<KeyboardState>(KeyboardState.UNKNOWN),\n height: makeMutable(0),\n };\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n }, options);\n ref.current = keyboardEventData;\n isSubscribed.current = true;\n }\n useEffect(() => {\n if (isSubscribed.current === false && ref.current !== null) {\n const keyboardEventData = ref.current;\n // subscribe again after Fast Refresh\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n }, options);\n isSubscribed.current = true;\n }\n return () => {\n unsubscribeFromKeyboardEvents(listenerId.current);\n isSubscribed.current = false;\n };\n }, []);\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,6BAA6B,QACxB,SAAS;AAKhB,SAASC,aAAa,QAAQ,gBAAgB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,OAAgC,GAAG;EAAEC,6BAA6B,EAAE;AAAM,CAAC,EACrD;EACtB,MAAMC,GAAG,GAAGR,MAAM,CAA8B,IAAI,CAAC;EACrD,MAAMS,UAAU,GAAGT,MAAM,CAAS,CA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le","shouldBeUseWeb","useAnimatedPropsJS","updater","deps","adapters","useAnimatedPropsNative","useAnimatedProps"],"sources":["useAnimatedProps.ts"],"sourcesContent":["'use strict';\nimport { useAnimatedStyle } from './useAnimatedStyle';\nimport type { DependencyList, UseAnimatedStyleInternal } from './commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport type { AnimatedPropsAdapterFunction } from '../commonTypes';\n\n// TODO: we should make sure that when useAP is used we are not assigning styles\n\ntype UseAnimatedProps = <Props extends object>(\n updater: () => Partial<Props>,\n dependencies?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null,\n isAnimatedProps?: boolean\n) => Partial<Props>;\n\nfunction useAnimatedPropsJS<Props extends object>(\n updater: () => Props,\n deps?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null\n) {\n return (useAnimatedStyle as UseAnimatedStyleInternal<Props>)(\n updater,\n deps,\n adapters,\n true\n );\n}\n\nconst useAnimatedPropsNative = useAnimatedStyle;\n\n/**\n * Lets you create an animated props object which can be animated using shared values.\n *\n * @param updater - A function returning an object with properties you want to animate.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @param adapters - An optional function or array of functions allowing to adopt prop naming between JS and the native side.\n * @returns An animated props object which has to be passed to `animatedProps` property of an Animated component that you want to animate.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedProps\n */\nexport const useAnimatedProps: UseAnimatedProps = shouldBeUseWeb()\n ? (useAnimatedPropsJS as UseAnimatedProps)\n : useAnimatedPropsNative;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,QAAQ,oBAAoB;;AAGnD;;AAYA,SAASC,kBAAkBA,CACzBC,OAAoB,EACpBC,IAA4B,EAC5BC,QAGQ,EACR;EACA,OAAQL,gBAAgB,CACtBG,OAAO,EACPC,IAAI,EACJC,QAAQ,EACR,IAAI,CACL;AACH;AAEA,MAAMC,sBAAsB,GAAGN,gBAAgB;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,gBAAkC,GAAGN,cAAc,EAAE,GAC7DC,kBAAkB,GACnBI,sBAAsB"}
1
+ {"version":3,"names":["useAnimatedStyle","shouldBeUseWeb","useAnimatedPropsJS","updater","deps","adapters","useAnimatedPropsNative","useAnimatedProps"],"sources":["useAnimatedProps.ts"],"sourcesContent":["'use strict';\nimport { useAnimatedStyle } from './useAnimatedStyle';\nimport type { DependencyList, UseAnimatedStyleInternal } from './commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport type { AnimatedPropsAdapterFunction } from '../commonTypes';\n\n// TODO: we should make sure that when useAP is used we are not assigning styles\n\ntype UseAnimatedProps = <Props extends object>(\n updater: () => Partial<Props>,\n dependencies?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null,\n isAnimatedProps?: boolean\n) => Partial<Props>;\n\nfunction useAnimatedPropsJS<Props extends object>(\n updater: () => Props,\n deps?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null\n) {\n return (useAnimatedStyle as UseAnimatedStyleInternal<Props>)(\n updater,\n deps,\n adapters,\n true\n );\n}\n\nconst useAnimatedPropsNative = useAnimatedStyle;\n\n/**\n * Lets you create an animated props object which can be animated using shared values.\n *\n * @param updater - A function returning an object with properties you want to animate.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @param adapters - An optional function or array of functions allowing to adopt prop naming between JS and the native side.\n * @returns An animated props object which has to be passed to `animatedProps` property of an Animated component that you want to animate.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedProps\n */\nexport const useAnimatedProps: UseAnimatedProps = shouldBeUseWeb()\n ? (useAnimatedPropsJS as UseAnimatedProps)\n : useAnimatedPropsNative;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,QAAQ,oBAAoB;;AAGnD;;AAYA,SAASC,kBAAkBA,CACzBC,OAAoB,EACpBC,IAA4B,EAC5BC,QAGQ,EACR;EACA,OAAQL,gBAAgB,CACtBG,OAAO,EACPC,IAAI,EACJC,QAAQ,EACR,IACF,CAAC;AACH;AAEA,MAAMC,sBAAsB,GAAGN,gBAAgB;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,gBAAkC,GAAGN,cAAc,CAAC,CAAC,GAC7DC,kBAAkB,GACnBI,sBAAsB","ignoreList":[]}
@@ -14,6 +14,7 @@ import { shouldBeUseWeb } from '../PlatformChecker';
14
14
  * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useAnimatedReaction
15
15
  */
16
16
  // @ts-expect-error This overload is required by our API.
17
+
17
18
  export function useAnimatedReaction(prepare, react, dependencies) {
18
19
  const previous = useSharedValue(null);
19
20
  let inputs = Object.values(prepare.__closure ?? {});
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","startMapper","stopMapper","useSharedValue","shouldBeUseWeb","useAnimatedReaction","prepare","react","dependencies","previous","inputs","Object","values","__closure","_dependencies","length","undefined","__workletHash","push","fun","input","value","mapperId"],"sources":["useAnimatedReaction.ts"],"sourcesContent":["'use strict';\nimport { useEffect } from 'react';\nimport type { WorkletFunction } from '../commonTypes';\nimport { startMapper, stopMapper } from '../core';\nimport type { DependencyList } from './commonTypes';\nimport { useSharedValue } from './useSharedValue';\nimport { shouldBeUseWeb } from '../PlatformChecker';\n\n/**\n * Lets you to respond to changes in a [shared value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value). It's especially useful when comparing values previously stored in the shared value with the current one.\n *\n * @param prepare - A function that should return a value to which you'd like to react.\n * @param react - A function that reacts to changes in the value returned by the `prepare` function.\n * @param dependencies - an optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useAnimatedReaction\n */\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedReaction<PreparedResult>(\n prepare: () => PreparedResult,\n react: (prepared: PreparedResult, previous: PreparedResult | null) => void,\n dependencies?: DependencyList\n): void;\n\nexport function useAnimatedReaction<PreparedResult>(\n prepare: WorkletFunction<[], PreparedResult>,\n react: WorkletFunction<\n [prepare: PreparedResult, previous: PreparedResult | null],\n void\n >,\n dependencies?: DependencyList\n) {\n const previous = useSharedValue<PreparedResult | null>(null);\n\n let inputs = Object.values(prepare.__closure ?? {});\n\n if (shouldBeUseWeb()) {\n if (!inputs.length && dependencies?.length) {\n // let web work without a Reanimated Babel plugin\n inputs = dependencies;\n }\n }\n\n if (dependencies === undefined) {\n dependencies = [\n ...Object.values(prepare.__closure ?? {}),\n ...Object.values(react.__closure ?? {}),\n prepare.__workletHash,\n react.__workletHash,\n ];\n } else {\n dependencies.push(prepare.__workletHash, react.__workletHash);\n }\n\n useEffect(() => {\n const fun = () => {\n 'worklet';\n const input = prepare();\n react(input, previous.value);\n previous.value = input;\n };\n const mapperId = startMapper(fun, inputs);\n return () => {\n stopMapper(mapperId);\n };\n }, dependencies);\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,WAAW,EAAEC,UAAU,QAAQ,SAAS;AAEjD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,cAAc,QAAQ,oBAAoB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,OAAO,SAASC,mBAAmBA,CACjCC,OAA4C,EAC5CC,KAGC,EACDC,YAA6B,EAC7B;EACA,MAAMC,QAAQ,GAAGN,cAAc,CAAwB,IAAI,CAAC;EAE5D,IAAIO,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACN,OAAO,CAACO,SAAS,IAAI,CAAC,CAAC,CAAC;EAEnD,IAAIT,cAAc,EAAE,EAAE;IAAA,IAAAU,aAAA;IACpB,IAAI,CAACJ,MAAM,CAACK,MAAM,KAAAD,aAAA,GAAIN,YAAY,cAAAM,aAAA,eAAZA,aAAA,CAAcC,MAAM,EAAE;MAC1C;MACAL,MAAM,GAAGF,YAAY;IACvB;EACF;EAEA,IAAIA,YAAY,KAAKQ,SAAS,EAAE;IAC9BR,YAAY,GAAG,CACb,GAAGG,MAAM,CAACC,MAAM,CAACN,OAAO,CAACO,SAAS,IAAI,CAAC,CAAC,CAAC,EACzC,GAAGF,MAAM,CAACC,MAAM,CAACL,KAAK,CAACM,SAAS,IAAI,CAAC,CAAC,CAAC,EACvCP,OAAO,CAACW,aAAa,EACrBV,KAAK,CAACU,aAAa,CACpB;EACH,CAAC,MAAM;IACLT,YAAY,CAACU,IAAI,CAACZ,OAAO,CAACW,aAAa,EAAEV,KAAK,CAACU,aAAa,CAAC;EAC/D;EAEAjB,SAAS,CAAC,MAAM;IACd,MAAMmB,GAAG,GAAGA,CAAA,KAAM;MAChB,SAAS;;MACT,MAAMC,KAAK,GAAGd,OAAO,EAAE;MACvBC,KAAK,CAACa,KAAK,EAAEX,QAAQ,CAACY,KAAK,CAAC;MAC5BZ,QAAQ,CAACY,KAAK,GAAGD,KAAK;IACxB,CAAC;IACD,MAAME,QAAQ,GAAGrB,WAAW,CAACkB,GAAG,EAAET,MAAM,CAAC;IACzC,OAAO,MAAM;MACXR,UAAU,CAACoB,QAAQ,CAAC;IACtB,CAAC;EACH,CAAC,EAAEd,YAAY,CAAC;AAClB"}
1
+ {"version":3,"names":["useEffect","startMapper","stopMapper","useSharedValue","shouldBeUseWeb","useAnimatedReaction","prepare","react","dependencies","previous","inputs","Object","values","__closure","_dependencies","length","undefined","__workletHash","push","fun","input","value","mapperId"],"sources":["useAnimatedReaction.ts"],"sourcesContent":["'use strict';\nimport { useEffect } from 'react';\nimport type { WorkletFunction } from '../commonTypes';\nimport { startMapper, stopMapper } from '../core';\nimport type { DependencyList } from './commonTypes';\nimport { useSharedValue } from './useSharedValue';\nimport { shouldBeUseWeb } from '../PlatformChecker';\n\n/**\n * Lets you to respond to changes in a [shared value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value). It's especially useful when comparing values previously stored in the shared value with the current one.\n *\n * @param prepare - A function that should return a value to which you'd like to react.\n * @param react - A function that reacts to changes in the value returned by the `prepare` function.\n * @param dependencies - an optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useAnimatedReaction\n */\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedReaction<PreparedResult>(\n prepare: () => PreparedResult,\n react: (prepared: PreparedResult, previous: PreparedResult | null) => void,\n dependencies?: DependencyList\n): void;\n\nexport function useAnimatedReaction<PreparedResult>(\n prepare: WorkletFunction<[], PreparedResult>,\n react: WorkletFunction<\n [prepare: PreparedResult, previous: PreparedResult | null],\n void\n >,\n dependencies?: DependencyList\n) {\n const previous = useSharedValue<PreparedResult | null>(null);\n\n let inputs = Object.values(prepare.__closure ?? {});\n\n if (shouldBeUseWeb()) {\n if (!inputs.length && dependencies?.length) {\n // let web work without a Reanimated Babel plugin\n inputs = dependencies;\n }\n }\n\n if (dependencies === undefined) {\n dependencies = [\n ...Object.values(prepare.__closure ?? {}),\n ...Object.values(react.__closure ?? {}),\n prepare.__workletHash,\n react.__workletHash,\n ];\n } else {\n dependencies.push(prepare.__workletHash, react.__workletHash);\n }\n\n useEffect(() => {\n const fun = () => {\n 'worklet';\n const input = prepare();\n react(input, previous.value);\n previous.value = input;\n };\n const mapperId = startMapper(fun, inputs);\n return () => {\n stopMapper(mapperId);\n };\n }, dependencies);\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,WAAW,EAAEC,UAAU,QAAQ,SAAS;AAEjD,SAASC,cAAc,QAAQ,kBAAkB;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Q,CAAC;IACtB,CAAC;EACH,CAAC,EAAEd,YAAY,CAAC;AAClB","ignoreList":[]}
@@ -7,17 +7,15 @@ import { makeShareableCloneRecursive } from '../shareables';
7
7
  import { shareableMappingCache } from '../shareableMappingCache';
8
8
  import { Platform, findNodeHandle } from 'react-native';
9
9
  import { isFabric, isWeb } from '../PlatformChecker';
10
- const IS_FABRIC = isFabric();
11
10
  const IS_WEB = isWeb();
12
11
  function getComponentOrScrollable(component) {
13
- if (IS_FABRIC && component.getNativeScrollRef) {
12
+ if (isFabric() && component.getNativeScrollRef) {
14
13
  return component.getNativeScrollRef();
15
- } else if (!IS_FABRIC && component.getScrollableNode) {
14
+ } else if (!isFabric() && component.getScrollableNode) {
16
15
  return component.getScrollableNode();
17
16
  }
18
17
  return component;
19
18
  }
20
- const getTagValueFunction = IS_FABRIC ? getShadowNodeWrapperFromRef : findNodeHandle;
21
19
 
22
20
  /**
23
21
  * Lets you get a reference of a view that you can use inside a worklet.
@@ -33,12 +31,19 @@ export function useAnimatedRef() {
33
31
  const fun = component => {
34
32
  // enters when ref is set by attaching to a component
35
33
  if (component) {
36
- tag.value = IS_WEB ? getComponentOrScrollable(component) : getTagValueFunction(getComponentOrScrollable(component));
34
+ const getTagValueFunction = isFabric() ? getShadowNodeWrapperFromRef : findNodeHandle;
35
+ const getTagOrShadowNodeWrapper = () => {
36
+ return IS_WEB ? getComponentOrScrollable(component) : getTagValueFunction(getComponentOrScrollable(component));
37
+ };
38
+ tag.value = getTagOrShadowNodeWrapper();
39
+
40
+ // On Fabric we have to unwrap the tag from the shadow node wrapper
41
+ fun.getTag = isFabric() ? () => findNodeHandle(getComponentOrScrollable(component)) : getTagOrShadowNodeWrapper;
37
42
  fun.current = component;
38
43
  // viewName is required only on iOS with Paper
39
- if (Platform.OS === 'ios' && !IS_FABRIC) {
44
+ if (Platform.OS === 'ios' && !isFabric()) {
40
45
  var _viewConfig;
41
- viewName.value = (component === null || component === void 0 ? void 0 : (_viewConfig = component.viewConfig) === null || _viewConfig === void 0 ? void 0 : _viewConfig.uiViewClassName) || 'RCTView';
46
+ viewName.value = (component === null || component === void 0 || (_viewConfig = component.viewConfig) === null || _viewConfig === void 0 ? void 0 : _viewConfig.uiViewClassName) || 'RCTView';
42
47
  }
43
48
  }
44
49
  return tag.value;
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","useSharedValue","getShadowNodeWrapperFromRef","makeShareableCloneRecursive","shareableMappingCache","Platform","findNodeHandle","isFabric","isWeb","IS_FABRIC","IS_WEB","getComponentOrScrollable","component","getNativeScrollRef","getScrollableNode","getTagValueFunction","useAnimatedRef","tag","viewName","ref","current","fun","value","OS","_viewConfig","viewConfig","uiViewClassName","animatedRefShareableHandle","__init","f","set"],"sources":["useAnimatedRef.ts"],"sourcesContent":["'use strict';\nimport type { Component } from 'react';\nimport { useRef } from 'react';\nimport { useSharedValue } from './useSharedValue';\nimport type { AnimatedRef, AnimatedRefOnUI } from './commonTypes';\nimport type { ShadowNodeWrapper } from '../commonTypes';\nimport { getShadowNodeWrapperFromRef } from '../fabricUtils';\nimport { makeShareableCloneRecursive } from '../shareables';\nimport { shareableMappingCache } from '../shareableMappingCache';\nimport { Platform, findNodeHandle } from 'react-native';\nimport type { ScrollView, FlatList } from 'react-native';\nimport { isFabric, isWeb } from '../PlatformChecker';\n\nconst IS_FABRIC = isFabric();\nconst IS_WEB = isWeb();\n\ninterface MaybeScrollableComponent extends Component {\n getNativeScrollRef?: FlatList['getNativeScrollRef'];\n getScrollableNode?:\n | ScrollView['getScrollableNode']\n | FlatList['getScrollableNode'];\n viewConfig?: {\n uiViewClassName?: string;\n };\n}\n\nfunction getComponentOrScrollable(component: MaybeScrollableComponent) {\n if (IS_FABRIC && component.getNativeScrollRef) {\n return component.getNativeScrollRef();\n } else if (!IS_FABRIC && component.getScrollableNode) {\n return component.getScrollableNode();\n }\n return component;\n}\n\nconst getTagValueFunction = IS_FABRIC\n ? getShadowNodeWrapperFromRef\n : findNodeHandle;\n\n/**\n * Lets you get a reference of a view that you can use inside a worklet.\n *\n * @returns An object with a `.current` property which contains an instance of a component.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef\n */\nexport function useAnimatedRef<\n TComponent extends Component\n>(): AnimatedRef<TComponent> {\n const tag = useSharedValue<number | ShadowNodeWrapper | null>(-1);\n const viewName = useSharedValue<string | null>(null);\n\n const ref = useRef<AnimatedRef<TComponent>>();\n\n if (!ref.current) {\n const fun: AnimatedRef<TComponent> = <AnimatedRef<TComponent>>((\n component\n ) => {\n // enters when ref is set by attaching to a component\n if (component) {\n tag.value = IS_WEB\n ? getComponentOrScrollable(component)\n : getTagValueFunction(getComponentOrScrollable(component));\n fun.current = component;\n // viewName is required only on iOS with Paper\n if (Platform.OS === 'ios' && !IS_FABRIC) {\n viewName.value =\n (component as MaybeScrollableComponent)?.viewConfig\n ?.uiViewClassName || 'RCTView';\n }\n }\n return tag.value;\n });\n\n fun.current = null;\n\n const animatedRefShareableHandle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n const f: AnimatedRefOnUI = () => tag.value;\n f.viewName = viewName;\n return f;\n },\n });\n shareableMappingCache.set(fun, animatedRefShareableHandle);\n ref.current = fun;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,cAAc,QAAQ,kBAAkB;AAGjD,SAASC,2BAA2B,QAAQ,gBAAgB;AAC5D,SAASC,2BAA2B,QAAQ,eAAe;AAC3D,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,QAAQ,EAAEC,cAAc,QAAQ,cAAc;AAEvD,SAASC,QAAQ,EAAEC,KAAK,QAAQ,oBAAoB;AAEpD,MAAMC,SAAS,GAAGF,QAAQ,EAAE;AAC5B,MAAMG,MAAM,GAAGF,KAAK,EAAE;AAYtB,SAASG,wBAAwBA,CAACC,SAAmC,EAAE;EACrE,IAAIH,SAAS,IAAIG,SAAS,CAACC,kBAAkB,EA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ACK,KAAK;QAC1CO,CAAC,CAACX,QAAQ,GAAGA,QAAQ;QACrB,OAAOW,CAAC;MACV;IACF,CAAC,CAAC;IACFzB,qBAAqB,CAAC0B,GAAG,CAACT,GAAG,EAAEM,0BAA0B,CAAC;IAC1DR,GAAG,CAACC,OAAO,GAAGC,GAAG;EACnB;EAEA,OAAOF,GAAG,CAACC,OAAO;AACpB"}
1
+ {"version":3,"names":["useRef","useSharedValue","getShadowNodeWrapperFromRef","makeShareableCloneRecursive","shareableMappingCache","Platform","findNodeHandle","isFabric","isWeb","IS_WEB","getComponentOrScrollable","component","getNativeScrollRef","getScrollableNode","useAnimatedRef","tag","viewName","ref","current","fun","getTagValueFunction","getTagOrShadowNodeWrapper","value","getTag","OS","_viewConfig","viewConfig","uiViewClassName","animatedRefShareableHandle","__init","f","set"],"sources":["useAnimatedRef.ts"],"sourcesContent":["'use strict';\nimport type { Component } from 'react';\nimport { useRef } from 'react';\nimport { useSharedValue } from './useSharedValue';\nimport type { AnimatedRef, AnimatedRefOnUI } from './commonTypes';\nimport type { ShadowNodeWrapper } from '../commonTypes';\nimport { getShadowNodeWrapperFromRef } from '../fabricUtils';\nimport { makeShareableCloneRecursive } from '../shareables';\nimport { shareableMappingCache } from '../shareableMappingCache';\nimport { Platform, findNodeHandle } from 'react-native';\nimport type { ScrollView, FlatList } from 'react-native';\nimport { isFabric, isWeb } from '../PlatformChecker';\n\nconst IS_WEB = isWeb();\n\ninterface MaybeScrollableComponent extends Component {\n getNativeScrollRef?: FlatList['getNativeScrollRef'];\n getScrollableNode?:\n | ScrollView['getScrollableNode']\n | FlatList['getScrollableNode'];\n viewConfig?: {\n uiViewClassName?: string;\n };\n}\n\nfunction getComponentOrScrollable(component: MaybeScrollableComponent) {\n if (isFabric() && component.getNativeScrollRef) {\n return component.getNativeScrollRef();\n } else if (!isFabric() && component.getScrollableNode) {\n return component.getScrollableNode();\n }\n return component;\n}\n\n/**\n * Lets you get a reference of a view that you can use inside a worklet.\n *\n * @returns An object with a `.current` property which contains an instance of a component.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef\n */\nexport function useAnimatedRef<\n TComponent extends Component\n>(): AnimatedRef<TComponent> {\n const tag = useSharedValue<number | ShadowNodeWrapper | null>(-1);\n const viewName = useSharedValue<string | null>(null);\n\n const ref = useRef<AnimatedRef<TComponent>>();\n\n if (!ref.current) {\n const fun: AnimatedRef<TComponent> = <AnimatedRef<TComponent>>((\n component\n ) => {\n // enters when ref is set by attaching to a component\n if (component) {\n const getTagValueFunction = isFabric()\n ? getShadowNodeWrapperFromRef\n : findNodeHandle;\n\n const getTagOrShadowNodeWrapper = () => {\n return IS_WEB\n ? getComponentOrScrollable(component)\n : getTagValueFunction(getComponentOrScrollable(component));\n };\n\n tag.value = getTagOrShadowNodeWrapper();\n\n // On Fabric we have to unwrap the tag from the shadow node wrapper\n fun.getTag = isFabric()\n ? () => findNodeHandle(getComponentOrScrollable(component))\n : getTagOrShadowNodeWrapper;\n\n fun.current = component;\n // viewName is required only on iOS with Paper\n if (Platform.OS === 'ios' && !isFabric()) {\n viewName.value =\n (component as MaybeScrollableComponent)?.viewConfig\n ?.uiViewClassName || 'RCTView';\n }\n }\n return tag.value;\n });\n\n fun.current = null;\n\n const animatedRefShareableHandle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n const f: AnimatedRefOnUI = () => tag.value;\n f.viewName = viewName;\n return f;\n },\n });\n shareableMappingCache.set(fun, animatedRefShareableHandle);\n ref.current = fun;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,cAAc,QAAQ,kBAAkB;AAGjD,SAASC,2BAA2B,QAAQ,gBAAgB;AAC5D,SAASC,2BAA2B,QAAQ,eAAe;AAC3D,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,QAAQ,EAAEC,cAAc,QAAQ,cAAc;AAEvD,SAASC,QAAQ,EAAEC,KAAK,QAA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AACjB,QAAQ,CAAC,CAAC,EAAE;UAAA,IAAAkB,WAAA;UACxCT,QAAQ,CAACM,KAAK,GACZ,CAACX,SAAS,aAATA,SAAS,gBAAAc,WAAA,GAATd,SAAS,CAA+Be,UAAU,cAAAD,WAAA,uBAAnDA,WAAA,CACIE,eAAe,KAAI,SAAS;QACpC;MACF;MACA,OAAOZ,GAAG,CAACO,KAAK;IAClB,CAAE;IAEFH,GAAG,CAACD,OAAO,GAAG,IAAI;IAElB,MAAMU,0BAA0B,GAAGzB,2BAA2B,CAAC;MAC7D0B,MAAM,EAAEA,CAAA,KAAM;QACZ,SAAS;;QACT,MAAMC,CAAkB,GAAGA,CAAA,KAAMf,GAAG,CAACO,KAAK;QAC1CQ,CAAC,CAACd,QAAQ,GAAGA,QAAQ;QACrB,OAAOc,CAAC;MACV;IACF,CAAC,CAAC;IACF1B,qBAAqB,CAAC2B,GAAG,CAACZ,GAAG,EAAES,0BAA0B,CAAC;IAC1DX,GAAG,CAACC,OAAO,GAAGC,GAAG;EACnB;EAEA,OAAOF,GAAG,CAACC,OAAO;AACpB","ignoreList":[]}
@@ -12,7 +12,9 @@ import { useEvent } from './useEvent';
12
12
  * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.
13
13
  * @returns An object you need to pass to `onScroll` prop on the `Animated.ScrollView` component.
14
14
  * @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useAnimatedScrollHandler
15
- */ // @ts-expect-error This overload is required by our API.
15
+ */
16
+ // @ts-expect-error This overload is required by our API.
17
+
16
18
  export function useAnimatedScrollHandler(handlers, dependencies) {
17
19
  // case when handlers is a function
18
20
  const scrollHandlers = typeof handlers === 'function' ? {
@@ -1 +1 @@
1
- {"version":3,"names":["useHandler","useEvent","useAnimatedScrollHandler","handlers","dependencies","scrollHandlers","onScroll","context","doDependenciesDiffer","subscribeForEvents","onBeginDrag","undefined","push","onEndDrag","onMomentumBegin","onMomentumEnd","event","eventName","endsWith"],"sources":["useAnimatedScrollHandler.ts"],"sourcesContent":["'use strict';\nimport type {\n DependencyList,\n RNNativeScrollEvent,\n ReanimatedScrollEvent,\n} from './commonTypes';\nimport { useHandler } from './useHandler';\nimport type { EventHandlerInternal, EventHandlerProcessed } from './useEvent';\nimport { useEvent } from './useEvent';\n\nexport type ScrollHandler<\n Context extends Record<string, unknown> = Record<string, unknown>\n> = (event: ReanimatedScrollEvent, context: Context) => void;\nexport interface ScrollHandlers<Context extends Record<string, unknown>> {\n onScroll?: ScrollHandler<Context>;\n onBeginDrag?: ScrollHandler<Context>;\n onEndDrag?: ScrollHandler<Context>;\n onMomentumBegin?: ScrollHandler<Context>;\n onMomentumEnd?: ScrollHandler<Context>;\n}\n\nexport type ScrollHandlerProcessed<\n Context extends Record<string, unknown> = Record<string, unknown>\n> = EventHandlerProcessed<RNNativeScrollEvent, Context>;\n\nexport type ScrollHandlerInternal = EventHandlerInternal<RNNativeScrollEvent>;\n\n/**\n * Lets you run callbacks on ScrollView events. Supports `onScroll`, `onBeginDrag`, `onEndDrag`, `onMomentumBegin`, and `onMomentumEnd` events.\n *\n * These callbacks are automatically workletized and ran on the UI thread.\n *\n * @param handlers - An object containing event handlers.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @returns An object you need to pass to `onScroll` prop on the `Animated.ScrollView` component.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useAnimatedScrollHandler\n */\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedScrollHandler<\n Context extends Record<string, unknown>\n>(\n handlers: ScrollHandler<Context> | ScrollHandlers<Context>,\n dependencies?: DependencyList\n): ScrollHandlerProcessed<Context>;\n\nexport function useAnimatedScrollHandler<\n Context extends Record<string, unknown>\n>(\n handlers: ScrollHandlers<Context> | ScrollHandler<Context>,\n dependencies?: DependencyList\n) {\n // case when handlers is a function\n const scrollHandlers: ScrollHandlers<Context> =\n typeof handlers === 'function' ? { onScroll: handlers } : handlers;\n const { context, doDependenciesDiffer } = useHandler<\n RNNativeScrollEvent,\n Context\n >(scrollHandlers as Record<string, ScrollHandler<Context>>, dependencies);\n\n // build event subscription array\n const subscribeForEvents = ['onScroll'];\n if (scrollHandlers.onBeginDrag !== undefined) {\n subscribeForEvents.push('onScrollBeginDrag');\n }\n if (scrollHandlers.onEndDrag !== undefined) {\n subscribeForEvents.push('onScrollEndDrag');\n }\n if (scrollHandlers.onMomentumBegin !== undefined) {\n subscribeForEvents.push('onMomentumScrollBegin');\n }\n if (scrollHandlers.onMomentumEnd !== undefined) {\n subscribeForEvents.push('onMomentumScrollEnd');\n }\n\n return useEvent<RNNativeScrollEvent, Context>(\n (event: ReanimatedScrollEvent) => {\n 'worklet';\n const {\n onScroll,\n onBeginDrag,\n onEndDrag,\n onMomentumBegin,\n onMomentumEnd,\n } = scrollHandlers;\n if (onScroll && event.eventName.endsWith('onScroll')) {\n onScroll(event, context);\n } else if (onBeginDrag && event.eventName.endsWith('onScrollBeginDrag')) {\n onBeginDrag(event, context);\n } else if (onEndDrag && event.eventName.endsWith('onScrollEndDrag')) {\n onEndDrag(event, context);\n } else if (\n onMomentumBegin &&\n event.eventName.endsWith('onMomentumScrollBegin')\n ) {\n onMomentumBegin(event, context);\n } else if (\n onMomentumEnd &&\n event.eventName.endsWith('onMomentumScrollEnd')\n ) {\n onMomentumEnd(event, context);\n }\n },\n subscribeForEvents,\n doDependenciesDiffer\n // Read https://github.com/software-mansion/react-native-reanimated/pull/5056\n // for more information about this cast.\n ) as unknown as ScrollHandlerInternal;\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,QAAQ,QAAQ,YAAY;;AAmBrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GATA,CAUA;AAQA,OAAO,SAASC,wBAAwBA,CAGtCC,QAA0D,EAC1DC,YAA6B,EAC7B;EACA;EACA,MAAMC,cAAuC,GAC3C,OAAOF,QAAQ,KAAK,UAAU,GAAG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C,QAAQ,CAAC,uBAAuB,CAAC,EACjD;MACAJ,eAAe,CAACE,KAAK,EAAET,OAAO,CAAC;IACjC,CAAC,MAAM,IACLQ,aAAa,IACbC,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,qBAAqB,CAAC,EAC/C;MACAH,aAAa,CAACC,KAAK,EAAET,OAAO,CAAC;IAC/B;EACF,CAAC,EACDE,kBAAkB,EAClBD;EACA;EACA;EAAA,CACD;AACH"}
1
+ {"version":3,"names":["useHandler","useEvent","useAnimatedScrollHandler","handlers","dependencies","scrollHandlers","onScroll","context","doDependenciesDiffer","subscribeForEvents","onBeginDrag","undefined","push","onEndDrag","onMomentumBegin","onMomentumEnd","event","eventName","endsWith"],"sources":["useAnimatedScrollHandler.ts"],"sourcesContent":["'use strict';\nimport type {\n DependencyList,\n RNNativeScrollEvent,\n ReanimatedScrollEvent,\n} from './commonTypes';\nimport { useHandler } from './useHandler';\nimport type { EventHandlerInternal, EventHandlerProcessed } from './useEvent';\nimport { useEvent } from './useEvent';\n\nexport type ScrollHandler<\n Context extends Record<string, unknown> = Record<string, unknown>\n> = (event: ReanimatedScrollEvent, context: Context) => void;\nexport interface ScrollHandlers<Context extends Record<string, unknown>> {\n onScroll?: ScrollHandler<Context>;\n onBeginDrag?: ScrollHandler<Context>;\n onEndDrag?: ScrollHandler<Context>;\n onMomentumBegin?: ScrollHandler<Context>;\n onMomentumEnd?: ScrollHandler<Context>;\n}\n\nexport type ScrollHandlerProcessed<\n Context extends Record<string, unknown> = Record<string, unknown>\n> = EventHandlerProcessed<RNNativeScrollEvent, Context>;\n\nexport type ScrollHandlerInternal = EventHandlerInternal<RNNativeScrollEvent>;\n\n/**\n * Lets you run callbacks on ScrollView events. Supports `onScroll`, `onBeginDrag`, `onEndDrag`, `onMomentumBegin`, and `onMomentumEnd` events.\n *\n * These callbacks are automatically workletized and ran on the UI thread.\n *\n * @param handlers - An object containing event handlers.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @returns An object you need to pass to `onScroll` prop on the `Animated.ScrollView` component.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useAnimatedScrollHandler\n */\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedScrollHandler<\n Context extends Record<string, unknown>\n>(\n handlers: ScrollHandler<Context> | ScrollHandlers<Context>,\n dependencies?: DependencyList\n): ScrollHandlerProcessed<Context>;\n\nexport function useAnimatedScrollHandler<\n Context extends Record<string, unknown>\n>(\n handlers: ScrollHandlers<Context> | ScrollHandler<Context>,\n dependencies?: DependencyList\n) {\n // case when handlers is a function\n const scrollHandlers: ScrollHandlers<Context> =\n typeof handlers === 'function' ? { onScroll: handlers } : handlers;\n const { context, doDependenciesDiffer } = useHandler<\n RNNativeScrollEvent,\n Context\n >(scrollHandlers as Record<string, ScrollHandler<Context>>, dependencies);\n\n // build event subscription array\n const subscribeForEvents = ['onScroll'];\n if (scrollHandlers.onBeginDrag !== undefined) {\n subscribeForEvents.push('onScrollBeginDrag');\n }\n if (scrollHandlers.onEndDrag !== undefined) {\n subscribeForEvents.push('onScrollEndDrag');\n }\n if (scrollHandlers.onMomentumBegin !== undefined) {\n subscribeForEvents.push('onMomentumScrollBegin');\n }\n if (scrollHandlers.onMomentumEnd !== undefined) {\n subscribeForEvents.push('onMomentumScrollEnd');\n }\n\n return useEvent<RNNativeScrollEvent, Context>(\n (event: ReanimatedScrollEvent) => {\n 'worklet';\n const {\n onScroll,\n onBeginDrag,\n onEndDrag,\n onMomentumBegin,\n onMomentumEnd,\n } = scrollHandlers;\n if (onScroll && event.eventName.endsWith('onScroll')) {\n onScroll(event, context);\n } else if (onBeginDrag && event.eventName.endsWith('onScrollBeginDrag')) {\n onBeginDrag(event, context);\n } else if (onEndDrag && event.eventName.endsWith('onScrollEndDrag')) {\n onEndDrag(event, context);\n } else if (\n onMomentumBegin &&\n event.eventName.endsWith('onMomentumScrollBegin')\n ) {\n onMomentumBegin(event, context);\n } else if (\n onMomentumEnd &&\n event.eventName.endsWith('onMomentumScrollEnd')\n ) {\n onMomentumEnd(event, context);\n }\n },\n subscribeForEvents,\n doDependenciesDiffer\n // Read https://github.com/software-mansion/react-native-reanimated/pull/5056\n // for more information about this cast.\n ) as unknown as ScrollHandlerInternal;\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,QAAQ,QAAQ,YAAY;;AAmBrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAO,SAASC,wBAAwBA,CAGtCC,QAA0D,EAC1DC,YAA6B,EAC7B;EACA;EACA,MAAMC,cAAuC,GAC3C,OAAOF,QAAQ,KAAK,UAAU,GAAG;IAAEG,QAAQ,EAAEH;EAAS,CAAC,GAAGA,QAAQ;EACpE,MAAM;IAAEI,OAAO;IAAEC;EAAqB,CAAC,GAAGR,UAAU,CAGlDK,cAAc,EAA4CD,YAAY,CAAC;;EAEzE;EACA,MAAMK,kBAAkB,GAAG,CAAC,UAAU,CAAC;EACvC,IAAIJ,cAAc,CAACK,WAAW,KAAKC,SAAS,EAAE;IAC5CF,kBAAkB,CAACG,IAAI,CAAC,mBAAmB,CAAC;EAC9C;EACA,IAAIP,cAAc,CAACQ,SAAS,KAAKF,SAAS,EAAE;IAC1CF,kBAAkB,CAACG,IAAI,CAAC,iBAAiB,CAAC;EAC5C;EACA,IAAIP,cAAc,CAACS,eAAe,KAAKH,SAAS,EAAE;IAChDF,kBAAkB,CAACG,IAAI,CAAC,uBAAuB,CAAC;EAClD;EACA,IAAIP,cAAc,CAACU,aAAa,KAAKJ,SAAS,EAAE;IAC9CF,kBAAkB,CAACG,IAAI,CAAC,qBAAqB,CAAC;EAChD;EAEA,OAAOX,QAAQ,CACZe,KAA4B,IAAK;IAChC,SAAS;;IACT,MAAM;MACJV,QAAQ;MACRI,WAAW;MACXG,SAAS;MACTC,eAAe;MACfC;IACF,CAAC,GAAGV,cAAc;IAClB,IAAIC,QAAQ,IAAIU,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,UAAU,CAAC,EAAE;MACpDZ,QAAQ,CAACU,KAAK,EAAET,OAAO,CAAC;IAC1B,CAAC,MAAM,IAAIG,WAAW,IAAIM,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;MACvER,WAAW,CAACM,KAAK,EAAET,OAAO,CAAC;IAC7B,CAAC,MAAM,IAAIM,SAAS,IAAIG,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;MACnEL,SAAS,CAACG,KAAK,EAAET,OAAO,CAAC;IAC3B,CAAC,MAAM,IACLO,eAAe,IACfE,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,uBAAuB,CAAC,EACjD;MACAJ,eAAe,CAACE,KAAK,EAAET,OAAO,CAAC;IACjC,CAAC,MAAM,IACLQ,aAAa,IACbC,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,qBAAqB,CAAC,EAC/C;MACAH,aAAa,CAACC,KAAK,EAAET,OAAO,CAAC;IAC/B;EACF,CAAC,EACDE,kBAAkB,EAClBD;EACA;EACA;EACF,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useMemo","useRef","initializeSensor","registerSensor","unregisterSensor","SensorType","IOSReferenceFrame","InterfaceOrientation","callMicrotasks","eulerToQuaternion","pitch","roll","yaw","c1","Math","cos","s1","sin","c2","s2","c3","s3","adjustRotationToInterfaceOrientation","data","interfaceOrientation","ROTATION_90","PI","ROTATION_270","ROTATION_180","q","qx","qy","qz","qw","adjustVectorToInterfaceOrientation","x","y","useAnimatedSensor","sensorType","userConfig","_userConfigRef$curren","_userConfigRef$curren2","_userConfigRef$curren3","userConfigRef","hasConfigChanged","current","adjustToInterfaceOrientation","interval","iosReferenceFrame","config","Auto","ref","sensor","unregister","isAvailable","sensorData","id","ROTATION","value"],"sources":["useAnimatedSensor.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { initializeSensor, registerSensor, unregisterSensor } from '../core';\nimport type {\n SensorConfig,\n AnimatedSensor,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n SensorType,\n IOSReferenceFrame,\n InterfaceOrientation,\n} from '../commonTypes';\nimport { callMicrotasks } from '../threads';\n\n// euler angles are in order ZXY, z = yaw, x = pitch, y = roll\n// https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js#L237\nfunction eulerToQuaternion(pitch: number, roll: number, yaw: number) {\n 'worklet';\n const c1 = Math.cos(pitch / 2);\n const s1 = Math.sin(pitch / 2);\n const c2 = Math.cos(roll / 2);\n const s2 = Math.sin(roll / 2);\n const c3 = Math.cos(yaw / 2);\n const s3 = Math.sin(yaw / 2);\n\n return [\n s1 * c2 * c3 - c1 * s2 * s3,\n c1 * s2 * c3 + s1 * c2 * s3,\n c1 * c2 * s3 + s1 * s2 * c3,\n c1 * c2 * c3 - s1 * s2 * s3,\n ];\n}\n\nfunction adjustRotationToInterfaceOrientation(data: ValueRotation) {\n 'worklet';\n const { interfaceOrientation, pitch, roll, yaw } = data;\n if (interfaceOrientation === InterfaceOrientation.ROTATION_90) {\n data.pitch = roll;\n data.roll = -pitch;\n data.yaw = yaw - Math.PI / 2;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_270) {\n data.pitch = -roll;\n data.roll = pitch;\n data.yaw = yaw + Math.PI / 2;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_180) {\n data.pitch *= -1;\n data.roll *= -1;\n data.yaw *= -1;\n }\n\n const q = eulerToQuaternion(data.pitch, data.roll, data.yaw);\n data.qx = q[0];\n data.qy = q[1];\n data.qz = q[2];\n data.qw = q[3];\n return data;\n}\n\nfunction adjustVectorToInterfaceOrientation(data: Value3D) {\n 'worklet';\n const { interfaceOrientation, x, y } = data;\n if (interfaceOrientation === InterfaceOrientation.ROTATION_90) {\n data.x = -y;\n data.y = x;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_270) {\n data.x = y;\n data.y = -x;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_180) {\n data.x *= -1;\n data.y *= -1;\n }\n return data;\n}\n\n/**\n * Lets you create animations based on data from the device's sensors.\n *\n * @param sensorType - Type of the sensor to use. Configured with {@link SensorType} enum.\n * @param config - The sensor configuration - {@link SensorConfig}.\n * @returns An object containing the sensor measurements [shared value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value) and a function to unregister the sensor\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedSensor\n */\nexport function useAnimatedSensor(\n sensorType: SensorType.ROTATION,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<ValueRotation>;\nexport function useAnimatedSensor(\n sensorType: Exclude<SensorType, SensorType.ROTATION>,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<Value3D>;\nexport function useAnimatedSensor(\n sensorType: SensorType,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<ValueRotation> | AnimatedSensor<Value3D> {\n const userConfigRef = useRef(userConfig);\n\n const hasConfigChanged =\n userConfigRef.current?.adjustToInterfaceOrientation !==\n userConfig?.adjustToInterfaceOrientation ||\n userConfigRef.current?.interval !== userConfig?.interval ||\n userConfigRef.current?.iosReferenceFrame !== userConfig?.iosReferenceFrame;\n\n if (hasConfigChanged) {\n userConfigRef.current = { ...userConfig };\n }\n\n const config: SensorConfig = useMemo(\n () => ({\n interval: 'auto',\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n ...userConfigRef.current,\n }),\n [userConfigRef.current]\n );\n\n const ref = useRef<AnimatedSensor<Value3D | ValueRotation>>({\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config,\n });\n\n useEffect(() => {\n ref.current = {\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config,\n };\n\n const sensorData = ref.current.sensor;\n const adjustToInterfaceOrientation =\n ref.current.config.adjustToInterfaceOrientation;\n\n const id = registerSensor(sensorType, config, (data) => {\n 'worklet';\n if (adjustToInterfaceOrientation) {\n if (sensorType === SensorType.ROTATION) {\n data = adjustRotationToInterfaceOrientation(data as ValueRotation);\n } else {\n data = adjustVectorToInterfaceOrientation(data as Value3D);\n }\n }\n sensorData.value = data;\n callMicrotasks();\n });\n\n if (id !== -1) {\n // if sensor is available\n ref.current.unregister = () => unregisterSensor(id);\n ref.current.isAvailable = true;\n } else {\n // if sensor is unavailable\n ref.current.unregister = () => {\n // NOOP\n };\n ref.current.isAvailable = false;\n }\n\n return () => {\n ref.current.unregister();\n };\n }, [sensorType, config]);\n\n return ref.current as AnimatedSensor<ValueRotation> | AnimatedSensor<Value3D>;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,SAAS;AAO5E,SACEC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,QACf,gBAAgB;AACvB,SAASC,cAAc,QAAQ,YAAY;;AAE3C;AACA;AACA,SAASC,iBAAiBA,CAACC,KAAa,EAAEC,IAAY,EAAEC,GAAW,EAAE;EACnE,SAAS;;EACT,MAAMC,EAAE,GAAGC,IAAI,CAACC,GAAG,CAACL,KAAK,GAAG,CAAC,CAAC;EAC9B,MAAMM,EAAE,GAAGF,IAAI,CAACG,GAAG,CAACP,KAAK,GAAG,CAAC,CAAC;EAC9B,MAAMQ,EAAE,GAAGJ,IAAI,CAACC,GAAG,CAACJ,IAAI,GAAG,CAAC,CAAC;EAC7B,MAAMQ,EAAE,GAAGL,IAAI,CAACG,GAAG,CAACN,IAAI,GAAG,CAAC,CAAC;EAC7B,MAAMS,EAAE,GAAGN,IAAI,CAACC,GAAG,CAACH,GAAG,GAAG,CAAC,CAAC;EAC5B,MAAMS,EAAE,GAAGP,IAA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A4B;IAEjD,MAAMU,EAAE,GAAGrD,cAAc,CAACmC,UAAU,EAAEW,MAAM,EAAG1B,IAAI,IAAK;MACtD,SAAS;;MACT,IAAIuB,4BAA4B,EAAE;QAChC,IAAIR,UAAU,KAAKjC,UAAU,CAACoD,QAAQ,EAAE;UACtClC,IAAI,GAAGD,oCAAoC,CAACC,IAAI,CAAkB;QACpE,CAAC,MAAM;UACLA,IAAI,GAAGW,kCAAkC,CAACX,IAAI,CAAY;QAC5D;MACF;MACAgC,UAAU,CAACG,KAAK,GAAGnC,IAAI;MACvBf,cAAc,EAAE;IAClB,CAAC,CAAC;IAEF,IAAIgD,EAAE,KAAK,CAAC,CAAC,EAAE;MACb;MACAL,GAAG,CAACN,OAAO,CAACQ,UAAU,GAAG,MAAMjD,gBAAgB,CAACoD,EAAE,CAAC;MACnDL,GAAG,CAACN,OAAO,CAACS,WAAW,GAAG,IAAI;IAChC,CAAC,MAAM;MACL;MACAH,GAAG,CAACN,OAAO,CAACQ,UAAU,GAAG,MAAM;QAC7B;MAAA,CACD;MACDF,GAAG,CAACN,OAAO,CAACS,WAAW,GAAG,KAAK;IACjC;IAEA,OAAO,MAAM;MACXH,GAAG,CAACN,OAAO,CAACQ,UAAU,EAAE;IAC1B,CAAC;EACH,CAAC,EAAE,CAACf,UAAU,EAAEW,MAAM,CAAC,CAAC;EAExB,OAAOE,GAAG,CAACN,OAAO;AACpB"}
1
+ {"version":3,"names":["useEffect","useMemo","useRef","initializeSensor","registerSensor","unregisterSensor","SensorType","IOSReferenceFrame","InterfaceOrientation","callMicrotasks","eulerToQuaternion","pitch","roll","yaw","c1","Math","cos","s1","sin","c2","s2","c3","s3","adjustRotationToInterfaceOrientation","data","interfaceOrientation","ROTATION_90","PI","ROTATION_270","ROTATION_180","q","qx","qy","qz","qw","adjustVectorToInterfaceOrientation","x","y","useAnimatedSensor","sensorType","userConfig","_userConfigRef$curren","_userConfigRef$curren2","_userConfigRef$curren3","userConfigRef","hasConfigChanged","current","adjustToInterfaceOrientation","interval","iosReferenceFrame","config","Auto","ref","sensor","unregister","isAvailable","sensorData","id","ROTATION","value"],"sources":["useAnimatedSensor.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { initializeSensor, registerSensor, unregisterSensor } from '../core';\nimport type {\n SensorConfig,\n AnimatedSensor,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n SensorType,\n IOSReferenceFrame,\n InterfaceOrientation,\n} from '../commonTypes';\nimport { callMicrotasks } from '../threads';\n\n// euler angles are in order ZXY, z = yaw, x = pitch, y = roll\n// https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js#L237\nfunction eulerToQuaternion(pitch: number, roll: number, yaw: number) {\n 'worklet';\n const c1 = Math.cos(pitch / 2);\n const s1 = Math.sin(pitch / 2);\n const c2 = Math.cos(roll / 2);\n const s2 = Math.sin(roll / 2);\n const c3 = Math.cos(yaw / 2);\n const s3 = Math.sin(yaw / 2);\n\n return [\n s1 * c2 * c3 - c1 * s2 * s3,\n c1 * s2 * c3 + s1 * c2 * s3,\n c1 * c2 * s3 + s1 * s2 * c3,\n c1 * c2 * c3 - s1 * s2 * s3,\n ];\n}\n\nfunction adjustRotationToInterfaceOrientation(data: ValueRotation) {\n 'worklet';\n const { interfaceOrientation, pitch, roll, yaw } = data;\n if (interfaceOrientation === InterfaceOrientation.ROTATION_90) {\n data.pitch = roll;\n data.roll = -pitch;\n data.yaw = yaw - Math.PI / 2;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_270) {\n data.pitch = -roll;\n data.roll = pitch;\n data.yaw = yaw + Math.PI / 2;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_180) {\n data.pitch *= -1;\n data.roll *= -1;\n data.yaw *= -1;\n }\n\n const q = eulerToQuaternion(data.pitch, data.roll, data.yaw);\n data.qx = q[0];\n data.qy = q[1];\n data.qz = q[2];\n data.qw = q[3];\n return data;\n}\n\nfunction adjustVectorToInterfaceOrientation(data: Value3D) {\n 'worklet';\n const { interfaceOrientation, x, y } = data;\n if (interfaceOrientation === InterfaceOrientation.ROTATION_90) {\n data.x = -y;\n data.y = x;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_270) {\n data.x = y;\n data.y = -x;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_180) {\n data.x *= -1;\n data.y *= -1;\n }\n return data;\n}\n\n/**\n * Lets you create animations based on data from the device's sensors.\n *\n * @param sensorType - Type of the sensor to use. Configured with {@link SensorType} enum.\n * @param config - The sensor configuration - {@link SensorConfig}.\n * @returns An object containing the sensor measurements [shared value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value) and a function to unregister the sensor\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedSensor\n */\nexport function useAnimatedSensor(\n sensorType: SensorType.ROTATION,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<ValueRotation>;\nexport function useAnimatedSensor(\n sensorType: Exclude<SensorType, SensorType.ROTATION>,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<Value3D>;\nexport function useAnimatedSensor(\n sensorType: SensorType,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<ValueRotation> | AnimatedSensor<Value3D> {\n const userConfigRef = useRef(userConfig);\n\n const hasConfigChanged =\n userConfigRef.current?.adjustToInterfaceOrientation !==\n userConfig?.adjustToInterfaceOrientation ||\n userConfigRef.current?.interval !== userConfig?.interval ||\n userConfigRef.current?.iosReferenceFrame !== userConfig?.iosReferenceFrame;\n\n if (hasConfigChanged) {\n userConfigRef.current = { ...userConfig };\n }\n\n const config: SensorConfig = useMemo(\n () => ({\n interval: 'auto',\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n ...userConfigRef.current,\n }),\n [userConfigRef.current]\n );\n\n const ref = useRef<AnimatedSensor<Value3D | ValueRotation>>({\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config,\n });\n\n useEffect(() => {\n ref.current = {\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config,\n };\n\n const sensorData = ref.current.sensor;\n const adjustToInterfaceOrientation =\n ref.current.config.adjustToInterfaceOrientation;\n\n const id = registerSensor(sensorType, config, (data) => {\n 'worklet';\n if (adjustToInterfaceOrientation) {\n if (sensorType === SensorType.ROTATION) {\n data = adjustRotationToInterfaceOrientation(data as ValueRotation);\n } else {\n data = adjustVectorToInterfaceOrientation(data as Value3D);\n }\n }\n sensorData.value = data;\n callMicrotasks();\n });\n\n if (id !== -1) {\n // if sensor is available\n ref.current.unregister = () => unregisterSensor(id);\n ref.current.isAvailable = true;\n } else {\n // if sensor is unavailable\n ref.current.unregister = () => {\n // NOOP\n };\n ref.current.isAvailable = false;\n }\n\n return () => {\n ref.current.unregister();\n };\n }, [sensorType, config]);\n\n return ref.current as AnimatedSensor<ValueRotation> | AnimatedSensor<Value3D>;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,SAAS;AAO5E,SACEC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,QACf,gBAAgB;AACvB,SAASC,cAAc,QAAQ,YAAY;;AAE3C;AACA;AACA,SAASC,iBAAiBA,CAACC,KAAa,EAAEC,IAAY,EAAEC,GAAW,EAAE;EACnE,SAAS;;EACT,MAAMC,EAAE,GAAGC,IAAI,CAACC,GAAG,CAACL,KAAK,GAAG,CAAC,CAAC;EAC9B,MAAMM,EAAE,GAAGF,IAAI,CAACG,GAAG,CAACP,KAAK,GAAG,CAAC,CAAC;EAC9B,MAAMQ,EAAE,GAAGJ,IAAI,CAACC,GAAG,CAACJ,IAAI,GAAG,CAAC,CAAC;EAC7B,MAAMQ,EAAE,GAAGL,IAAI,CAACG,GAAG,CAACN,IAAI,GAAG,CA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MM,UAAU,GAAGJ,GAAG,CAACN,OAAO,CAACO,MAAM;IACrC,MAAMN,4BAA4B,GAChCK,GAAG,CAACN,OAAO,CAACI,MAAM,CAACH,4BAA4B;IAEjD,MAAMU,EAAE,GAAGrD,cAAc,CAACmC,UAAU,EAAEW,MAAM,EAAG1B,IAAI,IAAK;MACtD,SAAS;;MACT,IAAIuB,4BAA4B,EAAE;QAChC,IAAIR,UAAU,KAAKjC,UAAU,CAACoD,QAAQ,EAAE;UACtClC,IAAI,GAAGD,oCAAoC,CAACC,IAAqB,CAAC;QACpE,CAAC,MAAM;UACLA,IAAI,GAAGW,kCAAkC,CAACX,IAAe,CAAC;QAC5D;MACF;MACAgC,UAAU,CAACG,KAAK,GAAGnC,IAAI;MACvBf,cAAc,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,IAAIgD,EAAE,KAAK,CAAC,CAAC,EAAE;MACb;MACAL,GAAG,CAACN,OAAO,CAACQ,UAAU,GAAG,MAAMjD,gBAAgB,CAACoD,EAAE,CAAC;MACnDL,GAAG,CAACN,OAAO,CAACS,WAAW,GAAG,IAAI;IAChC,CAAC,MAAM;MACL;MACAH,GAAG,CAACN,OAAO,CAACQ,UAAU,GAAG,MAAM;QAC7B;MAAA,CACD;MACDF,GAAG,CAACN,OAAO,CAACS,WAAW,GAAG,KAAK;IACjC;IAEA,OAAO,MAAM;MACXH,GAAG,CAACN,OAAO,CAACQ,UAAU,CAAC,CAAC;IAC1B,CAAC;EACH,CAAC,EAAE,CAACf,UAAU,EAAEW,MAAM,CAAC,CAAC;EAExB,OAAOE,GAAG,CAACN,OAAO;AACpB","ignoreList":[]}
@@ -19,7 +19,6 @@ function prepareAnimation(frameTimestamp, animatedProp, lastAnimation, lastValue
19
19
  });
20
20
  // return animatedProp;
21
21
  }
22
-
23
22
  if (typeof animatedProp === 'object' && animatedProp.onFrame) {
24
23
  const animation = animatedProp;
25
24
  let value = animation.current;
@@ -81,7 +80,6 @@ function runAnimations(animation, timestamp, key, result, animationsActive) {
81
80
  animation.callback && animation.callback(true /* finished */);
82
81
  }
83
82
  }
84
-
85
83
  result[key] = animation.current;
86
84
  return finished;
87
85
  } else if (typeof animation === 'object') {
@@ -98,10 +96,9 @@ function runAnimations(animation, timestamp, key, result, animationsActive) {
98
96
  return true;
99
97
  }
100
98
  }
101
- function styleUpdater(viewDescriptors, updater, state, maybeViewRef, animationsActive) {
99
+ function styleUpdater(viewDescriptors, updater, state, maybeViewRef, animationsActive, isAnimatedProps = false) {
102
100
  'worklet';
103
101
 
104
- let isAnimatedProps = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
105
102
  const animations = state.animations ?? {};
106
103
  const newValues = updater() ?? {};
107
104
  const oldValues = state.last;
@@ -275,8 +272,8 @@ function checkSharedValueUsage(prop, currentKey) {
275
272
  */
276
273
  // You cannot pass Shared Values to `useAnimatedStyle` directly.
277
274
  // @ts-expect-error This overload is required by our API.
278
- export function useAnimatedStyle(updater, dependencies, adapters) {
279
- let isAnimatedProps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
275
+
276
+ export function useAnimatedStyle(updater, dependencies, adapters, isAnimatedProps = false) {
280
277
  const viewsRef = useViewRefSet();
281
278
  const animatedUpdaterData = useRef();
282
279
  let inputs = Object.values(updater.__closure ?? {});