react-native-reanimated 3.6.0 → 3.6.2

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 (263) hide show
  1. package/lib/module/createAnimatedComponent/createAnimatedComponent.js +12 -0
  2. package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
  3. package/lib/module/createAnimatedComponent/setAndForwardRef.js +2 -0
  4. package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
  5. package/lib/module/reanimated2/Easing.js +3 -3
  6. package/lib/module/reanimated2/Easing.js.map +1 -1
  7. package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
  8. package/lib/module/reanimated2/animation/decay/decay.js +9 -0
  9. package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
  10. package/lib/module/reanimated2/animation/decay/utils.js +13 -0
  11. package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
  12. package/lib/module/reanimated2/animation/delay.js +9 -0
  13. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  14. package/lib/module/reanimated2/animation/repeat.js +11 -0
  15. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  16. package/lib/module/reanimated2/animation/sequence.js +10 -0
  17. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  18. package/lib/module/reanimated2/animation/spring.js +9 -0
  19. package/lib/module/reanimated2/animation/spring.js.map +1 -1
  20. package/lib/module/reanimated2/animation/springUtils.js +16 -0
  21. package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
  22. package/lib/module/reanimated2/animation/timing.js +18 -0
  23. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  24. package/lib/module/reanimated2/animation/util.js +7 -0
  25. package/lib/module/reanimated2/animation/util.js.map +1 -1
  26. package/lib/module/reanimated2/commonTypes.js +30 -7
  27. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  28. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  29. package/lib/module/reanimated2/component/LayoutAnimationConfig.js +7 -0
  30. package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
  31. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  32. package/lib/module/reanimated2/globals.d.js.map +1 -1
  33. package/lib/module/reanimated2/helperTypes.js.map +1 -1
  34. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +8 -0
  35. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  36. package/lib/module/reanimated2/hook/useAnimatedProps.js +9 -0
  37. package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
  38. package/lib/module/reanimated2/hook/useAnimatedReaction.js +6 -4
  39. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  40. package/lib/module/reanimated2/hook/useAnimatedRef.js +7 -0
  41. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  42. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +10 -2
  43. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  44. package/lib/module/reanimated2/hook/useAnimatedSensor.js +10 -0
  45. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  46. package/lib/module/reanimated2/hook/useAnimatedStyle.js +8 -0
  47. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  48. package/lib/module/reanimated2/hook/useDerivedValue.js +14 -8
  49. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  50. package/lib/module/reanimated2/hook/useEvent.js +7 -6
  51. package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
  52. package/lib/module/reanimated2/hook/useFrameCallback.js +17 -0
  53. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  54. package/lib/module/reanimated2/hook/useHandler.js +8 -2
  55. package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
  56. package/lib/module/reanimated2/hook/useReducedMotion.js +9 -0
  57. package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
  58. package/lib/module/reanimated2/hook/useScrollViewOffset.js +8 -0
  59. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  60. package/lib/module/reanimated2/hook/useSharedValue.js +11 -3
  61. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  62. package/lib/module/reanimated2/hook/useWorkletCallback.js +3 -0
  63. package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
  64. package/lib/module/reanimated2/index.js +1 -1
  65. package/lib/module/reanimated2/index.js.map +1 -1
  66. package/lib/module/reanimated2/interpolateColor.js +21 -0
  67. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  68. package/lib/module/reanimated2/interpolation.js +51 -21
  69. package/lib/module/reanimated2/interpolation.js.map +1 -1
  70. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +29 -2
  71. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  72. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +67 -2
  73. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  74. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +6 -3
  75. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  76. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -0
  77. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  78. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +80 -0
  79. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  80. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +79 -0
  81. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  82. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +96 -0
  83. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  84. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +31 -0
  85. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  86. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +15 -0
  87. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  88. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +31 -0
  89. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  90. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +63 -0
  91. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  92. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +64 -0
  93. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  94. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +32 -0
  95. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  96. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +128 -0
  97. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  98. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +8 -0
  99. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  100. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +9 -0
  101. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  102. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +8 -0
  103. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  104. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +8 -0
  105. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  106. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +10 -3
  107. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  108. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +8 -0
  109. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  110. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +49 -3
  111. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
  112. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +4 -4
  113. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
  114. package/lib/module/reanimated2/platform-specific/checkCppVersion.js +0 -2
  115. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
  116. package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
  117. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
  118. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +9 -0
  119. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
  120. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +14 -4
  121. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
  122. package/lib/module/reanimated2/platformFunctions/measure.js +7 -0
  123. package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
  124. package/lib/module/reanimated2/platformFunctions/scrollTo.js +9 -0
  125. package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
  126. package/lib/module/reanimated2/platformFunctions/setNativeProps.js +8 -0
  127. package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
  128. package/lib/module/reanimated2/runtimes.js +8 -0
  129. package/lib/module/reanimated2/runtimes.js.map +1 -1
  130. package/lib/module/reanimated2/threads.js +16 -6
  131. package/lib/module/reanimated2/threads.js.map +1 -1
  132. package/lib/typescript/createAnimatedComponent/createAnimatedComponent.d.ts +12 -0
  133. package/lib/typescript/reanimated2/Easing.d.ts +3 -3
  134. package/lib/typescript/reanimated2/animation/decay/decay.d.ts +8 -0
  135. package/lib/typescript/reanimated2/animation/decay/utils.d.ts +12 -0
  136. package/lib/typescript/reanimated2/animation/delay.d.ts +9 -0
  137. package/lib/typescript/reanimated2/animation/repeat.d.ts +11 -0
  138. package/lib/typescript/reanimated2/animation/sequence.d.ts +8 -0
  139. package/lib/typescript/reanimated2/animation/spring.d.ts +9 -0
  140. package/lib/typescript/reanimated2/animation/springUtils.d.ts +15 -0
  141. package/lib/typescript/reanimated2/animation/timing.d.ts +17 -0
  142. package/lib/typescript/reanimated2/animation/util.d.ts +6 -0
  143. package/lib/typescript/reanimated2/commonTypes.d.ts +25 -7
  144. package/lib/typescript/reanimated2/component/FlatList.d.ts +6 -0
  145. package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +7 -0
  146. package/lib/typescript/reanimated2/component/ScrollView.d.ts +3 -2
  147. package/lib/typescript/reanimated2/helperTypes.d.ts +45 -3
  148. package/lib/typescript/reanimated2/hook/useAnimatedKeyboard.d.ts +7 -0
  149. package/lib/typescript/reanimated2/hook/useAnimatedProps.d.ts +9 -0
  150. package/lib/typescript/reanimated2/hook/useAnimatedReaction.d.ts +6 -4
  151. package/lib/typescript/reanimated2/hook/useAnimatedRef.d.ts +6 -0
  152. package/lib/typescript/reanimated2/hook/useAnimatedScrollHandler.d.ts +10 -0
  153. package/lib/typescript/reanimated2/hook/useAnimatedSensor.d.ts +8 -0
  154. package/lib/typescript/reanimated2/hook/useAnimatedStyle.d.ts +8 -0
  155. package/lib/typescript/reanimated2/hook/useDerivedValue.d.ts +9 -1
  156. package/lib/typescript/reanimated2/hook/useEvent.d.ts +8 -5
  157. package/lib/typescript/reanimated2/hook/useFrameCallback.d.ts +14 -0
  158. package/lib/typescript/reanimated2/hook/useHandler.d.ts +8 -0
  159. package/lib/typescript/reanimated2/hook/useReducedMotion.d.ts +8 -0
  160. package/lib/typescript/reanimated2/hook/useScrollViewOffset.d.ts +7 -0
  161. package/lib/typescript/reanimated2/hook/useSharedValue.d.ts +8 -1
  162. package/lib/typescript/reanimated2/hook/useWorkletCallback.d.ts +3 -0
  163. package/lib/typescript/reanimated2/index.d.ts +1 -1
  164. package/lib/typescript/reanimated2/interpolateColor.d.ts +17 -0
  165. package/lib/typescript/reanimated2/interpolation.d.ts +30 -2
  166. package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +25 -2
  167. package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +56 -1
  168. package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +4 -0
  169. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +70 -0
  170. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +70 -0
  171. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +84 -0
  172. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +28 -0
  173. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +14 -0
  174. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +28 -0
  175. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +56 -0
  176. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +56 -0
  177. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +28 -0
  178. package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +112 -0
  179. package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +7 -0
  180. package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +8 -0
  181. package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +7 -0
  182. package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +7 -0
  183. package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +10 -0
  184. package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +7 -0
  185. package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.d.ts +43 -1
  186. package/lib/typescript/reanimated2/layoutReanimation/web/createAnimation.d.ts +4 -4
  187. package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
  188. package/lib/typescript/reanimated2/platformFunctions/dispatchCommand.d.ts +8 -0
  189. package/lib/typescript/reanimated2/platformFunctions/getRelativeCoords.d.ts +11 -3
  190. package/lib/typescript/reanimated2/platformFunctions/measure.d.ts +7 -0
  191. package/lib/typescript/reanimated2/platformFunctions/scrollTo.d.ts +9 -0
  192. package/lib/typescript/reanimated2/platformFunctions/setNativeProps.d.ts +7 -0
  193. package/lib/typescript/reanimated2/runtimes.d.ts +8 -0
  194. package/lib/typescript/reanimated2/threads.d.ts +17 -2
  195. package/package.json +2 -1
  196. package/src/createAnimatedComponent/createAnimatedComponent.tsx +18 -0
  197. package/src/createAnimatedComponent/setAndForwardRef.ts +2 -0
  198. package/src/reanimated2/Easing.ts +3 -3
  199. package/src/reanimated2/PlatformChecker.ts +1 -1
  200. package/src/reanimated2/animation/decay/decay.ts +8 -0
  201. package/src/reanimated2/animation/decay/utils.ts +12 -0
  202. package/src/reanimated2/animation/delay.ts +9 -0
  203. package/src/reanimated2/animation/repeat.ts +11 -0
  204. package/src/reanimated2/animation/sequence.ts +8 -0
  205. package/src/reanimated2/animation/spring.ts +9 -0
  206. package/src/reanimated2/animation/springUtils.ts +15 -0
  207. package/src/reanimated2/animation/timing.ts +17 -0
  208. package/src/reanimated2/animation/util.ts +6 -0
  209. package/src/reanimated2/commonTypes.ts +25 -7
  210. package/src/reanimated2/component/FlatList.tsx +6 -0
  211. package/src/reanimated2/component/LayoutAnimationConfig.tsx +7 -0
  212. package/src/reanimated2/component/ScrollView.tsx +3 -1
  213. package/src/reanimated2/globals.d.ts +1 -1
  214. package/src/reanimated2/helperTypes.ts +45 -3
  215. package/src/reanimated2/hook/useAnimatedKeyboard.ts +7 -0
  216. package/src/reanimated2/hook/useAnimatedProps.ts +9 -0
  217. package/src/reanimated2/hook/useAnimatedReaction.ts +6 -4
  218. package/src/reanimated2/hook/useAnimatedRef.ts +6 -0
  219. package/src/reanimated2/hook/useAnimatedScrollHandler.ts +10 -0
  220. package/src/reanimated2/hook/useAnimatedSensor.ts +8 -0
  221. package/src/reanimated2/hook/useAnimatedStyle.ts +8 -0
  222. package/src/reanimated2/hook/useDerivedValue.ts +15 -7
  223. package/src/reanimated2/hook/useEvent.ts +9 -6
  224. package/src/reanimated2/hook/useFrameCallback.ts +14 -0
  225. package/src/reanimated2/hook/useHandler.ts +8 -0
  226. package/src/reanimated2/hook/useReducedMotion.ts +8 -0
  227. package/src/reanimated2/hook/useScrollViewOffset.ts +7 -0
  228. package/src/reanimated2/hook/useSharedValue.ts +12 -3
  229. package/src/reanimated2/hook/useWorkletCallback.ts +3 -0
  230. package/src/reanimated2/index.ts +1 -1
  231. package/src/reanimated2/interpolateColor.ts +17 -0
  232. package/src/reanimated2/interpolation.ts +48 -22
  233. package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +26 -3
  234. package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +57 -2
  235. package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +7 -6
  236. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +4 -0
  237. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +71 -0
  238. package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +70 -1
  239. package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +84 -0
  240. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +28 -0
  241. package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +14 -0
  242. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +28 -0
  243. package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +56 -0
  244. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +56 -0
  245. package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +28 -0
  246. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +112 -0
  247. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +7 -0
  248. package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +8 -0
  249. package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +7 -0
  250. package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +8 -0
  251. package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +10 -3
  252. package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +7 -0
  253. package/src/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.ts +45 -3
  254. package/src/reanimated2/layoutReanimation/web/createAnimation.ts +4 -4
  255. package/src/reanimated2/platform-specific/checkCppVersion.ts +0 -4
  256. package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
  257. package/src/reanimated2/platformFunctions/dispatchCommand.ts +8 -0
  258. package/src/reanimated2/platformFunctions/getRelativeCoords.ts +12 -4
  259. package/src/reanimated2/platformFunctions/measure.ts +7 -0
  260. package/src/reanimated2/platformFunctions/scrollTo.ts +9 -0
  261. package/src/reanimated2/platformFunctions/setNativeProps.ts +7 -0
  262. package/src/reanimated2/runtimes.ts +8 -0
  263. package/src/reanimated2/threads.ts +18 -7
@@ -5,6 +5,14 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
5
5
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
6
  import { withSequence, withTiming } from '../../animation';
7
7
  import { BaseAnimationBuilder } from '../animationBuilder';
8
+
9
+ /**
10
+ * Fades out components from one position and shows them in another. You can modify the behavior by chaining methods like `.duration(500)` or `.delay(500)`.
11
+ *
12
+ * You pass it to the `layout` prop on [an Animated component](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component).
13
+ *
14
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#fading-transition
15
+ */
8
16
  export class FadingTransition extends BaseAnimationBuilder {
9
17
  constructor() {
10
18
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withSequence","withTiming","BaseAnimationBuilder","FadingTransition","constructor","arguments","delayFunction","getDelayFunction","callback","callbackV","delay","getDelay","duration","durationV","values","initialValues","opacity","originX","currentOriginX","originY","currentOriginY","width","currentWidth","height","currentHeight","animations","targetOriginX","targetOriginY","targetWidth","targetHeight","createInstance"],"sources":["FadingTransition.ts"],"sourcesContent":["'use strict';\nimport { withSequence, withTiming } from '../../animation';\nimport type {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from '../animationBuilder/commonTypes';\nimport { BaseAnimationBuilder } from '../animationBuilder';\n\nexport class FadingTransition\n extends BaseAnimationBuilder\n implements ILayoutAnimationBuilder\n{\n static createInstance<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n return new FadingTransition() as InstanceType<T>;\n }\n\n build = (): LayoutAnimationFunction => {\n const delayFunction = this.getDelayFunction();\n const callback = this.callbackV;\n const delay = this.getDelay();\n const duration = this.durationV ?? 500;\n\n return (values) => {\n 'worklet';\n return {\n initialValues: {\n opacity: 1,\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {\n opacity: delayFunction(\n delay,\n withSequence(\n withTiming(0, { duration: duration }),\n withTiming(1, { duration: duration })\n )\n ),\n originX: delayFunction(\n delay + duration,\n withTiming(values.targetOriginX, { duration: 50 })\n ),\n originY: delayFunction(\n delay + duration,\n withTiming(values.targetOriginY, { duration: 50 })\n ),\n width: delayFunction(\n delay + duration,\n withTiming(values.targetWidth, { duration: 50 })\n ),\n height: delayFunction(\n delay + duration,\n withTiming(values.targetHeight, { duration: 50 })\n ),\n },\n callback: callback,\n };\n };\n };\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AACb,SAASU,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAK1D,SAASC,oBAAoB,QAAQ,qBAAqB;AAE1D,OAA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Aa,CACnBI,KAAK,GAAGE,QAAQ,EAChBX,UAAU,CAACa,MAAM,CAACe,YAAY,EAAE;cAAEjB,QAAQ,EAAE;YAAG,CAAC,CAAC;UAErD,CAAC;UACDJ,QAAQ,EAAEA;QACZ,CAAC;MACH,CAAC;IACH,CAAC;EAAA;EAlDD,OAAOsB,cAAcA,CAAA,EAEF;IACjB,OAAO,IAAI3B,gBAAgB,EAAE;EAC/B;AA+CF"}
1
+ {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withSequence","withTiming","BaseAnimationBuilder","FadingTransition","constructor","arguments","delayFunction","getDelayFunction","callback","callbackV","delay","getDelay","duration","durationV","values","initialValues","opacity","originX","currentOriginX","originY","currentOriginY","width","currentWidth","height","currentHeight","animations","targetOriginX","targetOriginY","targetWidth","targetHeight","createInstance"],"sources":["FadingTransition.ts"],"sourcesContent":["'use strict';\nimport { withSequence, withTiming } from '../../animation';\nimport type {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from '../animationBuilder/commonTypes';\nimport { BaseAnimationBuilder } from '../animationBuilder';\n\n/**\n * Fades out components from one position and shows them in another. You can modify the behavior by chaining methods like `.duration(500)` or `.delay(500)`.\n *\n * You pass it to the `layout` prop on [an Animated component](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component).\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#fading-transition\n */\nexport class FadingTransition\n extends BaseAnimationBuilder\n implements ILayoutAnimationBuilder\n{\n static createInstance<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n return new FadingTransition() as InstanceType<T>;\n }\n\n build = (): LayoutAnimationFunction => {\n const delayFunction = this.getDelayFunction();\n const callback = this.callbackV;\n const delay = this.getDelay();\n const duration = this.durationV ?? 500;\n\n return (values) => {\n 'worklet';\n return {\n initialValues: {\n opacity: 1,\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {\n opacity: delayFunction(\n delay,\n withSequence(\n withTiming(0, { duration: duration }),\n withTiming(1, { duration: duration })\n )\n ),\n originX: delayFunction(\n delay + duration,\n withTiming(values.targetOriginX, { duration: 50 })\n ),\n originY: delayFunction(\n delay + duration,\n withTiming(values.targetOriginY, { duration: 50 })\n ),\n width: delayFunction(\n delay + duration,\n withTiming(values.targetWidth, { duration: 50 })\n ),\n height: delayFunction(\n delay + duration,\n withTiming(values.targetHeight, { duration: 50 })\n ),\n },\n callback: callback,\n };\n };\n };\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AACb,SAASU,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAK1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AW,EAAE;cAAEhB,QAAQ,EAAE;YAAG,CAAC,CAAC,CACjD;YACDW,MAAM,EAAEjB,aAAa,CACnBI,KAAK,GAAGE,QAAQ,EAChBX,UAAU,CAACa,MAAM,CAACe,YAAY,EAAE;cAAEjB,QAAQ,EAAE;YAAG,CAAC,CAAC;UAErD,CAAC;UACDJ,QAAQ,EAAEA;QACZ,CAAC;MACH,CAAC;IACH,CAAC;EAAA;EAlDD,OAAOsB,cAAcA,CAAA,EAEF;IACjB,OAAO,IAAI3B,gBAAgB,EAAE;EAC/B;AA+CF"}
@@ -6,6 +6,14 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
6
6
  import { withSequence, withTiming } from '../../animation';
7
7
  import { Easing } from '../../Easing';
8
8
  import { BaseAnimationBuilder } from '../animationBuilder';
9
+
10
+ /**
11
+ * Layout jumps - quite literally - from one position to another. You can modify the behavior by chaining methods like `.springify()` or `.duration(500)`.
12
+ *
13
+ * You pass it to the `layout` prop on [an Animated component](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component).
14
+ *
15
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#jumping-transition
16
+ */
9
17
  export class JumpingTransition extends BaseAnimationBuilder {
10
18
  constructor() {
11
19
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withSequence","withTiming","Easing","BaseAnimationBuilder","JumpingTransition","constructor","arguments","delayFunction","getDelayFunction","callback","callbackV","delay","getDelay","duration","durationV","config","values","d","Math","max","abs","targetOriginX","currentOriginX","targetOriginY","currentOriginY","initialValues","originX","originY","width","currentWidth","height","currentHeight","animations","min","easing","out","exp","bounce","targetWidth","targetHeight","createInstance"],"sources":["JumpingTransition.ts"],"sourcesContent":["'use strict';\nimport type {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from '../animationBuilder/commonTypes';\nimport { withSequence, withTiming } from '../../animation';\nimport { Easing } from '../../Easing';\nimport { BaseAnimationBuilder } from '../animationBuilder';\nexport class JumpingTransition\n extends BaseAnimationBuilder\n implements ILayoutAnimationBuilder\n{\n static createInstance<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n return new JumpingTransition() as InstanceType<T>;\n }\n\n build = (): LayoutAnimationFunction => {\n const delayFunction = this.getDelayFunction();\n const callback = this.callbackV;\n const delay = this.getDelay();\n const duration = (this.durationV ?? 300) / 2;\n const config = { duration: duration * 2 };\n\n return (values) => {\n 'worklet';\n const d = Math.max(\n Math.abs(values.targetOriginX - values.currentOriginX),\n Math.abs(values.targetOriginY - values.currentOriginY)\n );\n return {\n initialValues: {\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {\n originX: delayFunction(\n delay,\n withTiming(values.targetOriginX, config)\n ),\n originY: delayFunction(\n delay,\n withSequence(\n withTiming(\n Math.min(values.targetOriginY, values.currentOriginY) - d,\n {\n duration,\n easing: Easing.out(Easing.exp),\n }\n ),\n withTiming(values.targetOriginY, {\n ...config,\n duration,\n easing: Easing.bounce,\n })\n )\n ),\n width: delayFunction(delay, withTiming(values.targetWidth, config)),\n height: delayFunction(delay, withTiming(values.targetHeight, config)),\n },\n callback: callback,\n };\n };\n };\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QA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ACbC,OAAO,EAAEV,MAAM,CAACM,cAAc;YAC9BK,OAAO,EAAEX,MAAM,CAACQ,cAAc;YAC9BI,KAAK,EAAEZ,MAAM,CAACa,YAAY;YAC1BC,MAAM,EAAEd,MAAM,CAACe;UACjB,CAAC;UACDC,UAAU,EAAE;YACVN,OAAO,EAAEnB,aAAa,CACpBI,KAAK,EACLV,UAAU,CAACe,MAAM,CAACK,aAAa,EAAEN,MAAM,CAAC,CACzC;YACDY,OAAO,EAAEpB,aAAa,CACpBI,KAAK,EACLX,YAAY,CACVC,UAAU,CACRiB,IAAI,CAACe,GAAG,CAACjB,MAAM,CAACO,aAAa,EAAEP,MAAM,CAACQ,cAAc,CAAC,GAAGP,CAAC,EACzD;cACEJ,QAAQ;cACRqB,MAAM,EAAEhC,MAAM,CAACiC,GAAG,CAACjC,MAAM,CAACkC,GAAG;YAC/B,CAAC,CACF,EACDnC,UAAU,CAACe,MAAM,CAACO,aAAa,EAAE;cAC/B,GAAGR,MAAM;cACTF,QAAQ;cACRqB,MAAM,EAAEhC,MAAM,CAACmC;YACjB,CAAC,CAAC,CACH,CACF;YACDT,KAAK,EAAErB,aAAa,CAACI,KAAK,EAAEV,UAAU,CAACe,MAAM,CAACsB,WAAW,EAAEvB,MAAM,CAAC,CAAC;YACnEe,MAAM,EAAEvB,aAAa,CAACI,KAAK,EAAEV,UAAU,CAACe,MAAM,CAACuB,YAAY,EAAExB,MAAM,CAAC;UACtE,CAAC;UACDN,QAAQ,EAAEA;QACZ,CAAC;MACH,CAAC;IACH,CAAC;EAAA;EAtDD,OAAO+B,cAAcA,CAAA,EAEF;IACjB,OAAO,IAAIpC,iBAAiB,EAAE;EAChC;AAmDF"}
1
+ {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withSequence","withTiming","Easing","BaseAnimationBuilder","JumpingTransition","constructor","arguments","delayFunction","getDelayFunction","callback","callbackV","delay","getDelay","duration","durationV","config","values","d","Math","max","abs","targetOriginX","currentOriginX","targetOriginY","currentOriginY","initialValues","originX","originY","width","currentWidth","height","currentHeight","animations","min","easing","out","exp","bounce","targetWidth","targetHeight","createInstance"],"sources":["JumpingTransition.ts"],"sourcesContent":["'use strict';\nimport type {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from '../animationBuilder/commonTypes';\nimport { withSequence, withTiming } from '../../animation';\nimport { Easing } from '../../Easing';\nimport { BaseAnimationBuilder } from '../animationBuilder';\n\n/**\n * Layout jumps - quite literally - from one position to another. You can modify the behavior by chaining methods like `.springify()` or `.duration(500)`.\n *\n * You pass it to the `layout` prop on [an Animated component](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component).\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#jumping-transition\n */\nexport class JumpingTransition\n extends BaseAnimationBuilder\n implements ILayoutAnimationBuilder\n{\n static createInstance<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n return new JumpingTransition() as InstanceType<T>;\n }\n\n build = (): LayoutAnimationFunction => {\n const delayFunction = this.getDelayFunction();\n const callback = this.callbackV;\n const delay = this.getDelay();\n const duration = (this.durationV ?? 300) / 2;\n const config = { duration: duration * 2 };\n\n return (values) => {\n 'worklet';\n const d = Math.max(\n Math.abs(values.targetOriginX - values.currentOriginX),\n Math.abs(values.targetOriginY - values.currentOriginY)\n );\n return {\n initialValues: {\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {\n originX: delayFunction(\n delay,\n withTiming(values.targetOriginX, config)\n ),\n originY: delayFunction(\n delay,\n withSequence(\n withTiming(\n Math.min(values.targetOriginY, values.currentOriginY) - d,\n {\n duration,\n easing: Easing.out(Easing.exp),\n }\n ),\n withTiming(values.targetOriginY, {\n ...config,\n duration,\n easing: Easing.bounce,\n })\n )\n ),\n width: delayFunction(delay, withTiming(values.targetWidth, config)),\n height: delayFunction(delay, withTiming(values.targetHeight, config)),\n },\n callback: callback,\n };\n };\n };\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAKb,SAASU,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAC1D,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,oBAAoB,QAAQ,qBAAqB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,SACpBD,oBAAoB,CAE9B;EAAAE,YAAA;IAAA,SAAAC,SAAA;IAAA7B,eAAA,gBAOU,MAA+B;MACrC,MAAM8B,aAAa,GAAG,IAAI,CAACC,gBAAgB,EAAE;MAC7C,MAAMC,QAAQ,GAAG,IAAI,CAACC,SAAS;MAC/B,MA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B,WAAW,EAAEvB,MAAM,CAAC,CAAC;YACnEe,MAAM,EAAEvB,aAAa,CAACI,KAAK,EAAEV,UAAU,CAACe,MAAM,CAACuB,YAAY,EAAExB,MAAM,CAAC;UACtE,CAAC;UACDN,QAAQ,EAAEA;QACZ,CAAC;MACH,CAAC;IACH,CAAC;EAAA;EAtDD,OAAO+B,cAAcA,CAAA,EAEF;IACjB,OAAO,IAAIpC,iBAAiB,EAAE;EAChC;AAmDF"}
@@ -4,6 +4,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
4
4
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
5
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
6
  import { ComplexAnimationBuilder } from '../animationBuilder';
7
+ /**
8
+ * Linearly transforms the layout from one position to another. You can modify the behavior by chaining methods like `.springify()` or `.duration(500)`.
9
+ *
10
+ * You pass it to the `layout` prop on [an Animated component](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component).
11
+ *
12
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#linear-transition
13
+ */
7
14
  export class LinearTransition extends ComplexAnimationBuilder {
8
15
  constructor() {
9
16
  super(...arguments);
@@ -38,8 +45,8 @@ export class LinearTransition extends ComplexAnimationBuilder {
38
45
  }
39
46
  }
40
47
 
41
- // This export is unofficially deprecated because it's
42
- // name makes little sense - should be something among the lines of
43
- // `DefaultLayoutTransition` but it's so long!
48
+ /**
49
+ * @deprecated Please use {@link LinearTransition} instead.
50
+ */
44
51
  export const Layout = LinearTransition;
45
52
  //# sourceMappingURL=LinearTransition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","ComplexAnimationBuilder","LinearTransition","constructor","arguments","delayFunction","getDelayFunction","animation","config","getAnimationAndConfig","callback","callbackV","delay","getDelay","values","initialValues","originX","currentOriginX","originY","currentOriginY","width","currentWidth","height","currentHeight","animations","targetOriginX","targetOriginY","targetWidth","targetHeight","createInstance","Layout"],"sources":["LinearTransition.ts"],"sourcesContent":["'use strict';\nimport type { BaseAnimationBuilder } from '../animationBuilder';\nimport { ComplexAnimationBuilder } from '../animationBuilder';\nimport type {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from '../animationBuilder/commonTypes';\n\nexport class LinearTransition\n extends ComplexAnimationBuilder\n implements ILayoutAnimationBuilder\n{\n static createInstance<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n return new LinearTransition() as InstanceType<T>;\n }\n\n build = (): LayoutAnimationFunction => {\n const delayFunction = this.getDelayFunction();\n const [animation, config] = this.getAnimationAndConfig();\n const callback = this.callbackV;\n const delay = this.getDelay();\n\n return (values) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {\n originX: delayFunction(\n delay,\n animation(values.targetOriginX, config)\n ),\n originY: delayFunction(\n delay,\n animation(values.targetOriginY, config)\n ),\n width: delayFunction(delay, animation(values.targetWidth, config)),\n height: delayFunction(delay, animation(values.targetHeight, config)),\n },\n callback: callback,\n };\n };\n };\n}\n\n// This export is unofficially deprecated because it's\n// name makes little sense - should be something among the lines of\n// `DefaultLayoutTransition` but it's so long!\nexport const Layout = LinearTransition;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAA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E;YACVR,OAAO,EAAEX,aAAa,CACpBO,KAAK,EACLL,SAAS,CAACO,MAAM,CAACW,aAAa,EAAEjB,MAAM,CAAC,CACxC;YACDU,OAAO,EAAEb,aAAa,CACpBO,KAAK,EACLL,SAAS,CAACO,MAAM,CAACY,aAAa,EAAElB,MAAM,CAAC,CACxC;YACDY,KAAK,EAAEf,aAAa,CAACO,KAAK,EAAEL,SAAS,CAACO,MAAM,CAACa,WAAW,EAAEnB,MAAM,CAAC,CAAC;YAClEc,MAAM,EAAEjB,aAAa,CAACO,KAAK,EAAEL,SAAS,CAACO,MAAM,CAACc,YAAY,EAAEpB,MAAM,CAAC;UACrE,CAAC;UACDE,QAAQ,EAAEA;QACZ,CAAC;MACH,CAAC;IACH,CAAC;EAAA;EApCD,OAAOmB,cAAcA,CAAA,EAEF;IACjB,OAAO,IAAI3B,gBAAgB,EAAE;EAC/B;AAiCF;;AAEA;AACA;AACA;AACA,OAAO,MAAM4B,MAAM,GAAG5B,gBAAgB"}
1
+ {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","ComplexAnimationBuilder","LinearTransition","constructor","arguments","delayFunction","getDelayFunction","animation","config","getAnimationAndConfig","callback","callbackV","delay","getDelay","values","initialValues","originX","currentOriginX","originY","currentOriginY","width","currentWidth","height","currentHeight","animations","targetOriginX","targetOriginY","targetWidth","targetHeight","createInstance","Layout"],"sources":["LinearTransition.ts"],"sourcesContent":["'use strict';\nimport type { BaseAnimationBuilder } from '../animationBuilder';\nimport { ComplexAnimationBuilder } from '../animationBuilder';\nimport type {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from '../animationBuilder/commonTypes';\n\n/**\n * Linearly transforms the layout from one position to another. You can modify the behavior by chaining methods like `.springify()` or `.duration(500)`.\n *\n * You pass it to the `layout` prop on [an Animated component](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component).\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#linear-transition\n */\nexport class LinearTransition\n extends ComplexAnimationBuilder\n implements ILayoutAnimationBuilder\n{\n static createInstance<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n return new LinearTransition() as InstanceType<T>;\n }\n\n build = (): LayoutAnimationFunction => {\n const delayFunction = this.getDelayFunction();\n const [animation, config] = this.getAnimationAndConfig();\n const callback = this.callbackV;\n const delay = this.getDelay();\n\n return (values) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {\n originX: delayFunction(\n delay,\n animation(values.targetOriginX, config)\n ),\n originY: delayFunction(\n delay,\n animation(values.targetOriginY, config)\n ),\n width: delayFunction(delay, animation(values.targetWidth, config)),\n height: delayFunction(delay, animation(values.targetHeight, config)),\n },\n callback: callback,\n };\n };\n };\n}\n\n/**\n * @deprecated Please use {@link LinearTransition} instead.\n */\nexport const Layout = LinearTransition;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,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AM,CAACc,YAAY,EAAEpB,MAAM,CAAC;UACrE,CAAC;UACDE,QAAQ,EAAEA;QACZ,CAAC;MACH,CAAC;IACH,CAAC;EAAA;EApCD,OAAOmB,cAAcA,CAAA,EAEF;IACjB,OAAO,IAAI3B,gBAAgB,EAAE;EAC/B;AAiCF;;AAEA;AACA;AACA;AACA,OAAO,MAAM4B,MAAM,GAAG5B,gBAAgB"}
@@ -5,6 +5,14 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
5
5
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
6
  import { withSequence, withTiming } from '../../animation';
7
7
  import { BaseAnimationBuilder } from '../animationBuilder';
8
+
9
+ /**
10
+ * Transforms layout starting from the X-axis and width first, followed by the Y-axis and height. You can modify the behavior by chaining methods like `.springify()` or `.duration(500)`.
11
+ *
12
+ * You pass it to the `layout` prop on [an Animated component](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component).
13
+ *
14
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#sequenced-transition
15
+ */
8
16
  export class SequencedTransition extends BaseAnimationBuilder {
9
17
  constructor() {
10
18
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withSequence","withTiming","BaseAnimationBuilder","SequencedTransition","constructor","arguments","delayFunction","getDelayFunction","callback","callbackV","delay","getDelay","sequenceDuration","durationV","config","duration","reverse","reversed","values","initialValues","originX","currentOriginX","originY","currentOriginY","width","currentWidth","height","currentHeight","animations","targetOriginX","targetOriginY","targetWidth","targetHeight","createInstance","instance"],"sources":["SequencedTransition.ts"],"sourcesContent":["'use strict';\nimport { withSequence, withTiming } from '../../animation';\nimport type {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from '../animationBuilder/commonTypes';\nimport { BaseAnimationBuilder } from '../animationBuilder';\n\nexport class SequencedTransition\n extends BaseAnimationBuilder\n implements ILayoutAnimationBuilder\n{\n reversed = false;\n\n static createInstance<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n return new SequencedTransition() as InstanceType<T>;\n }\n\n static reverse(): SequencedTransition {\n const instance = SequencedTransition.createInstance();\n return instance.reverse();\n }\n\n reverse(): SequencedTransition {\n this.reversed = !this.reversed;\n return this;\n }\n\n build = (): LayoutAnimationFunction => {\n const delayFunction = this.getDelayFunction();\n const callback = this.callbackV;\n const delay = this.getDelay();\n const sequenceDuration = (this.durationV ?? 500) / 2;\n const config = { duration: sequenceDuration };\n const reverse = this.reversed;\n\n return (values) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {\n originX: delayFunction(\n delay,\n withSequence(\n withTiming(\n reverse ? values.currentOriginX : values.targetOriginX,\n config\n ),\n withTiming(values.targetOriginX, config)\n )\n ),\n originY: delayFunction(\n delay,\n withSequence(\n withTiming(\n reverse ? values.targetOriginY : values.currentOriginY,\n config\n ),\n withTiming(values.targetOriginY, config)\n )\n ),\n width: delayFunction(\n delay,\n withSequence(\n withTiming(\n reverse ? values.currentWidth : values.targetWidth,\n config\n ),\n withTiming(values.targetWidth, config)\n )\n ),\n height: delayFunction(\n delay,\n withSequence(\n withTiming(\n reverse ? values.targetHeight : values.currentHeight,\n config\n ),\n withTiming(values.targetHeight, config)\n )\n ),\n },\n callback: callback,\n };\n };\n };\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GA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AAOA,CAAA,EAAwB;IACpC,MAAMkB,QAAQ,GAAG/B,mBAAmB,CAAC8B,cAAc,EAAE;IACrD,OAAOC,QAAQ,CAAClB,OAAO,EAAE;EAC3B;EAEAA,OAAOA,CAAA,EAAwB;IAC7B,IAAI,CAACC,QAAQ,GAAG,CAAC,IAAI,CAACA,QAAQ;IAC9B,OAAO,IAAI;EACb;AAiEF"}
1
+ {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withSequence","withTiming","BaseAnimationBuilder","SequencedTransition","constructor","arguments","delayFunction","getDelayFunction","callback","callbackV","delay","getDelay","sequenceDuration","durationV","config","duration","reverse","reversed","values","initialValues","originX","currentOriginX","originY","currentOriginY","width","currentWidth","height","currentHeight","animations","targetOriginX","targetOriginY","targetWidth","targetHeight","createInstance","instance"],"sources":["SequencedTransition.ts"],"sourcesContent":["'use strict';\nimport { withSequence, withTiming } from '../../animation';\nimport type {\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from '../animationBuilder/commonTypes';\nimport { BaseAnimationBuilder } from '../animationBuilder';\n\n/**\n * Transforms layout starting from the X-axis and width first, followed by the Y-axis and height. You can modify the behavior by chaining methods like `.springify()` or `.duration(500)`.\n *\n * You pass it to the `layout` prop on [an Animated component](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component).\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#sequenced-transition\n */\nexport class SequencedTransition\n extends BaseAnimationBuilder\n implements ILayoutAnimationBuilder\n{\n reversed = false;\n\n static createInstance<T extends typeof BaseAnimationBuilder>(\n this: T\n ): InstanceType<T> {\n return new SequencedTransition() as InstanceType<T>;\n }\n\n static reverse(): SequencedTransition {\n const instance = SequencedTransition.createInstance();\n return instance.reverse();\n }\n\n reverse(): SequencedTransition {\n this.reversed = !this.reversed;\n return this;\n }\n\n build = (): LayoutAnimationFunction => {\n const delayFunction = this.getDelayFunction();\n const callback = this.callbackV;\n const delay = this.getDelay();\n const sequenceDuration = (this.durationV ?? 500) / 2;\n const config = { duration: sequenceDuration };\n const reverse = this.reversed;\n\n return (values) => {\n 'worklet';\n return {\n initialValues: {\n originX: values.currentOriginX,\n originY: values.currentOriginY,\n width: values.currentWidth,\n height: values.currentHeight,\n },\n animations: {\n originX: delayFunction(\n delay,\n withSequence(\n withTiming(\n reverse ? values.currentOriginX : values.targetOriginX,\n config\n ),\n withTiming(values.targetOriginX, config)\n )\n ),\n originY: delayFunction(\n delay,\n withSequence(\n withTiming(\n reverse ? values.targetOriginY : values.currentOriginY,\n config\n ),\n withTiming(values.targetOriginY, config)\n )\n ),\n width: delayFunction(\n delay,\n withSequence(\n withTiming(\n reverse ? values.currentWidth : values.targetWidth,\n config\n ),\n withTiming(values.targetWidth, config)\n )\n ),\n height: delayFunction(\n delay,\n withSequence(\n withTiming(\n reverse ? values.targetHeight : values.currentHeight,\n config\n ),\n withTiming(values.targetHeight, config)\n )\n ),\n },\n callback: callback,\n };\n };\n };\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,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,MAAM,CAACW,aAAa,EAAEf,MAAM,CAAC,CACzC,CACF;YACDQ,OAAO,EAAEhB,aAAa,CACpBI,KAAK,EACLV,YAAY,CACVC,UAAU,CACRe,OAAO,GAAGE,MAAM,CAACY,aAAa,GAAGZ,MAAM,CAACK,cAAc,EACtDT,MAAM,CACP,EACDb,UAAU,CAACiB,MAAM,CAACY,aAAa,EAAEhB,MAAM,CAAC,CACzC,CACF;YACDU,KAAK,EAAElB,aAAa,CAClBI,KAAK,EACLV,YAAY,CACVC,UAAU,CACRe,OAAO,GAAGE,MAAM,CAACO,YAAY,GAAGP,MAAM,CAACa,WAAW,EAClDjB,MAAM,CACP,EACDb,UAAU,CAACiB,MAAM,CAACa,WAAW,EAAEjB,MAAM,CAAC,CACvC,CACF;YACDY,MAAM,EAAEpB,aAAa,CACnBI,KAAK,EACLV,YAAY,CACVC,UAAU,CACRe,OAAO,GAAGE,MAAM,CAACc,YAAY,GAAGd,MAAM,CAACS,aAAa,EACpDb,MAAM,CACP,EACDb,UAAU,CAACiB,MAAM,CAACc,YAAY,EAAElB,MAAM,CAAC,CACxC;UAEL,CAAC;UACDN,QAAQ,EAAEA;QACZ,CAAC;MACH,CAAC;IACH,CAAC;EAAA;EA9ED,OAAOyB,cAAcA,CAAA,EAEF;IACjB,OAAO,IAAI9B,mBAAmB,EAAE;EAClC;EAEA,OAAOa,OAAOA,CAAA,EAAwB;IACpC,MAAMkB,QAAQ,GAAG/B,mBAAmB,CAAC8B,cAAc,EAAE;IACrD,OAAOC,QAAQ,CAAClB,OAAO,EAAE;EAC3B;EAEAA,OAAOA,CAAA,EAAwB;IAC7B,IAAI,CAACC,QAAQ,GAAG,CAAC,IAAI,CAACA,QAAQ;IAC9B,OAAO,IAAI;EACb;AAiEF"}
@@ -9,6 +9,12 @@ import { ReduceMotion } from '../../commonTypes';
9
9
  import { configureLayoutAnimations } from '../../core';
10
10
  import { ProgressTransitionManager } from './ProgressTransitionManager';
11
11
  const SUPPORTED_PROPS = ['width', 'height', 'originX', 'originY', 'transform', 'borderRadius'];
12
+ /**
13
+ * A SharedTransition builder class.
14
+ *
15
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
16
+ * @experimental
17
+ */
12
18
  export class SharedTransition {
13
19
  constructor() {
14
20
  _defineProperty(this, "_customAnimationFactory", null);
@@ -159,22 +165,62 @@ export class SharedTransition {
159
165
  };
160
166
  }
161
167
 
162
- // static builder methods
168
+ // static builder methods i.e. shared transition modifiers
163
169
 
170
+ /**
171
+ * Lets you create a custom shared transition animation. Other shared transition modifiers can be chained alongside this modifier.
172
+ *
173
+ * @param customAnimationFactory - Callback function that have to return an object with styles for the custom shared transition.
174
+ * @returns A {@link SharedTransition} object. Styles returned from this function need to be to the `sharedTransitionStyle` prop.
175
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
176
+ * @experimental
177
+ */
164
178
  static custom(customAnimationFactory) {
165
179
  return new SharedTransition().custom(customAnimationFactory);
166
180
  }
181
+
182
+ /**
183
+ * Lets you change the duration of the shared transition. Other shared transition modifiers can be chained alongside this modifier.
184
+ *
185
+ * @param duration - The duration of the shared transition animation in milliseconds.
186
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
187
+ * @experimental
188
+ */
167
189
  static duration(duration) {
168
190
  return new SharedTransition().duration(duration);
169
191
  }
192
+
193
+ /**
194
+ * Lets you create a shared transition animation bound to the progress between navigation screens. Other shared transition modifiers can be chained alongside this modifier.
195
+ *
196
+ * @param progressAnimationCallback - A callback called with the current progress value on every animation frame. It should return an object with styles for the shared transition.
197
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
198
+ * @experimental
199
+ */
170
200
  static progressAnimation(progressAnimationCallback) {
171
201
  return new SharedTransition().progressAnimation(progressAnimationCallback);
172
202
  }
203
+
204
+ /**
205
+ * Whether the transition is progress-bound or not. Other shared transition modifiers can be chained alongside this modifier.
206
+ *
207
+ * @param transitionType - Type of the transition. Configured with {@link SharedTransitionType} enum.
208
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
209
+ * @experimental
210
+ */
173
211
  static defaultTransitionType(transitionType) {
174
212
  return new SharedTransition().defaultTransitionType(transitionType);
175
213
  }
176
- static reduceMotion(_reduceMotion) {
177
- return new SharedTransition().reduceMotion(_reduceMotion);
214
+
215
+ /**
216
+ * Lets you adjust the behavior when the device's reduced motion accessibility setting is turned on. Other shared transition modifiers can be chained alongside this modifier.
217
+ *
218
+ * @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
219
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview
220
+ * @experimental
221
+ */
222
+ static reduceMotion(reduceMotion) {
223
+ return new SharedTransition().reduceMotion(reduceMotion);
178
224
  }
179
225
  }
180
226
  _defineProperty(SharedTransition, "_progressTransitionManager", new ProgressTransitionManager());
@@ -1 +1 @@
1
- {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withTiming","LayoutAnimationType","SharedTransitionType","ReduceMotion","configureLayoutAnimations","ProgressTransitionManager","SUPPORTED_PROPS","SharedTransition","constructor","System","custom","customAnimationFactory","_customAnimationFactory","progressAnimation","progressAnimationCallback","_customProgressAnimation","viewTag","values","progress","newStyles","_notifyAboutProgress","duration","_transitionDuration","reduceMotion","_reduceMotion","defaultTransitionType","transitionType","_defaultTransitionType","registerTransition","sharedTransitionTag","transitionAnimation","getTransitionAnimation","getProgressAnimation","ANIMATION","PROGRESS_ANIMATION","layoutAnimationType","SHARED_ELEMENT_TRANSITION","SHARED_ELEMENT_TRANSITION_PROGRESS","_progressTransitionManager","addProgressAnimation","unregisterTransition","removeProgressAnimation","getReduceMotion","_animation","buildAnimation","_progressAnimation","buildProgressAnimation","animationFactory","transitionDuration","animations","initialValues","includes","Error","propName","matrix","targetTransformMatrix","transformMatrix","capitalizedPropName","charAt","toUpperCase","slice","keyToTargetValue","currentTransformMatrix","keyToCurrentValue","propertyName","currentMatrix","targetMatrix","newMatrix","Array","i","PropertyName","currentPropertyName","targetPropertyName","currentValue","targetValue"],"sources":["SharedTransition.ts"],"sourcesContent":["'use strict';\nimport { withTiming } from '../../animation';\nimport type {\n SharedTransitionAnimationsFunction,\n SharedTransitionAnimationsValues,\n CustomProgressAnimation,\n ProgressAnimation,\n LayoutAnimationsOptions,\n} from '../animationBuilder/commonTypes';\nimport {\n LayoutAnimationType,\n SharedTransitionType,\n} from '../animationBuilder/commonTypes';\nimport type { StyleProps } from '../../commonTypes';\nimport { ReduceMotion } from '../../commonTypes';\nimport { configureLayoutAnimations } from '../../core';\nimport { ProgressTransitionManager } from './ProgressTransitionManager';\n\nconst SUPPORTED_PROPS = [\n 'width',\n 'height',\n 'originX',\n 'originY',\n 'transform',\n 'borderRadius',\n] as const;\n\ntype AnimationFactory = (\n values: SharedTransitionAnimationsValues\n) => StyleProps;\n\nexport class SharedTransition {\n private _customAnimationFactory: AnimationFactory | null = null;\n private _animation: SharedTransitionAnimationsFunction | null = null;\n private _transitionDuration = 500;\n private _reduceMotion: ReduceMotion = ReduceMotion.System;\n private _customProgressAnimation?: ProgressAnimation = undefined;\n private _progressAnimation?: ProgressAnimation = undefined;\n private _defaultTransitionType?: SharedTransitionType = undefined;\n private static _progressTransitionManager = new ProgressTransitionManager();\n\n public custom(customAnimationFactory: AnimationFactory): SharedTransition {\n this._customAnimationFactory = customAnimationFactory;\n return this;\n }\n\n public progressAnimation(\n progressAnimationCallback: CustomProgressAnimation\n ): SharedTransition {\n this._customProgressAnimation = (viewTag, values, progress) => {\n 'worklet';\n const newStyles = progressAnimationCallback(values, progress);\n _notifyAboutProgress(viewTag, newStyles, true);\n };\n return this;\n }\n\n public duration(duration: number): SharedTransition {\n this._transitionDuration = duration;\n return this;\n }\n\n public reduceMotion(_reduceMotion: ReduceMotion): this {\n this._reduceMotion = _reduceMotion;\n return this;\n }\n\n public defaultTransitionType(\n transitionType: SharedTransitionType\n ): SharedTransition {\n this._defaultTransitionType = transitionType;\n return this;\n }\n\n public registerTransition(\n viewTag: number,\n sharedTransitionTag: string\n ): void {\n const transitionAnimation = this.getTransitionAnimation();\n const progressAnimation = this.getProgressAnimation();\n if (!this._defaultTransitionType) {\n if (this._customAnimationFactory && !this._customProgressAnimation) {\n this._defaultTransitionType = SharedTransitionType.ANIMATION;\n } else {\n this._defaultTransitionType = SharedTransitionType.PROGRESS_ANIMATION;\n }\n }\n const layoutAnimationType =\n this._defaultTransitionType === SharedTransitionType.ANIMATION\n ? LayoutAnimationType.SHARED_ELEMENT_TRANSITION\n : LayoutAnimationType.SHARED_ELEMENT_TRANSITION_PROGRESS;\n configureLayoutAnimations(\n viewTag,\n layoutAnimationType,\n transitionAnimation,\n sharedTransitionTag\n );\n SharedTransition._progressTransitionManager.addProgressAnimation(\n viewTag,\n progressAnimation\n );\n }\n\n public unregisterTransition(viewTag: number): void {\n SharedTransition._progressTransitionManager.removeProgressAnimation(\n viewTag\n );\n }\n\n public getReduceMotion(): ReduceMotion {\n return this._reduceMotion;\n }\n\n private getTransitionAnimation(): SharedTransitionAnimationsFunction {\n if (!this._animation) {\n this.buildAnimation();\n }\n return this._animation!;\n }\n\n private getProgressAnimation(): ProgressAnimation {\n if (!this._progressAnimation) {\n this.buildProgressAnimation();\n }\n return this._progressAnimation!;\n }\n\n private buildAnimation() {\n const animationFactory = this._customAnimationFactory;\n const transitionDuration = this._transitionDuration;\n const reduceMotion = this._reduceMotion;\n this._animation = (values: SharedTransitionAnimationsValues) => {\n 'worklet';\n let animations: {\n [key: string]: unknown;\n } = {};\n const initialValues: {\n [key: string]: unknown;\n } = {};\n\n if (animationFactory) {\n animations = animationFactory(values);\n for (const key in animations) {\n if (!(SUPPORTED_PROPS as readonly string[]).includes(key)) {\n throw new Error(\n `[Reanimated] The prop '${key}' is not supported yet.`\n );\n }\n }\n } else {\n for (const propName of SUPPORTED_PROPS) {\n if (propName === 'transform') {\n const matrix = values.targetTransformMatrix;\n animations.transformMatrix = withTiming(matrix, {\n reduceMotion,\n duration: transitionDuration,\n });\n } else {\n const capitalizedPropName = `${propName\n .charAt(0)\n .toUpperCase()}${propName.slice(\n 1\n )}` as Capitalize<LayoutAnimationsOptions>;\n const keyToTargetValue = `target${capitalizedPropName}` as const;\n animations[propName] = withTiming(values[keyToTargetValue], {\n reduceMotion,\n duration: transitionDuration,\n });\n }\n }\n }\n\n for (const propName in animations) {\n if (propName === 'transform') {\n initialValues.transformMatrix = values.currentTransformMatrix;\n } else {\n const capitalizedPropName = (propName.charAt(0).toUpperCase() +\n propName.slice(1)) as Capitalize<LayoutAnimationsOptions>;\n const keyToCurrentValue = `current${capitalizedPropName}` as const;\n initialValues[propName] = values[keyToCurrentValue];\n }\n }\n\n return { initialValues, animations };\n };\n }\n\n private buildProgressAnimation() {\n if (this._customProgressAnimation) {\n this._progressAnimation = this._customProgressAnimation;\n return;\n }\n this._progressAnimation = (viewTag, values, progress) => {\n 'worklet';\n const newStyles: { [key: string]: number | number[] } = {};\n for (const propertyName of SUPPORTED_PROPS) {\n if (propertyName === 'transform') {\n // this is not the perfect solution, but at this moment it just interpolates the whole\n // matrix instead of interpolating scale, translate, rotate, etc. separately\n const currentMatrix = values.currentTransformMatrix as number[];\n const targetMatrix = values.targetTransformMatrix as number[];\n const newMatrix = new Array(9);\n for (let i = 0; i < 9; i++) {\n newMatrix[i] =\n progress * (targetMatrix[i] - currentMatrix[i]) +\n currentMatrix[i];\n }\n newStyles.transformMatrix = newMatrix;\n } else {\n // PropertyName == propertyName with capitalized fist letter, (width -> Width)\n const PropertyName = (propertyName.charAt(0).toUpperCase() +\n propertyName.slice(1)) as Capitalize<LayoutAnimationsOptions>;\n const currentPropertyName = `current${PropertyName}` as const;\n const targetPropertyName = `target${PropertyName}` as const;\n\n const currentValue = values[currentPropertyName];\n const targetValue = values[targetPropertyName];\n\n newStyles[propertyName] =\n progress * (targetValue - currentValue) + currentValue;\n }\n }\n _notifyAboutProgress(viewTag, newStyles, true);\n };\n }\n\n // static builder methods\n\n public static custom(\n customAnimationFactory: AnimationFactory\n ): SharedTransition {\n return new SharedTransition().custom(customAnimationFactory);\n }\n\n public static duration(duration: number): SharedTransition {\n return new SharedTransition().duration(duration);\n }\n\n public static progressAnimation(\n progressAnimationCallback: CustomProgressAnimation\n ): SharedTransition {\n return new SharedTransition().progressAnimation(progressAnimationCallback);\n }\n\n public static defaultTransitionType(\n transitionType: SharedTransitionType\n ): SharedTransition {\n return new SharedTransition().defaultTransitionType(transitionType);\n }\n\n public static reduceMotion(_reduceMotion: ReduceMotion): SharedTransition {\n return new SharedTransition().reduceMotion(_reduceMotion);\n }\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,M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QiB,IAAIF,yBAAyB,EAAE"}
1
+ {"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","withTiming","LayoutAnimationType","SharedTransitionType","ReduceMotion","configureLayoutAnimations","ProgressTransitionManager","SUPPORTED_PROPS","SharedTransition","constructor","System","custom","customAnimationFactory","_customAnimationFactory","progressAnimation","progressAnimationCallback","_customProgressAnimation","viewTag","values","progress","newStyles","_notifyAboutProgress","duration","_transitionDuration","reduceMotion","_reduceMotion","defaultTransitionType","transitionType","_defaultTransitionType","registerTransition","sharedTransitionTag","transitionAnimation","getTransitionAnimation","getProgressAnimation","ANIMATION","PROGRESS_ANIMATION","layoutAnimationType","SHARED_ELEMENT_TRANSITION","SHARED_ELEMENT_TRANSITION_PROGRESS","_progressTransitionManager","addProgressAnimation","unregisterTransition","removeProgressAnimation","getReduceMotion","_animation","buildAnimation","_progressAnimation","buildProgressAnimation","animationFactory","transitionDuration","animations","initialValues","includes","Error","propName","matrix","targetTransformMatrix","transformMatrix","capitalizedPropName","charAt","toUpperCase","slice","keyToTargetValue","currentTransformMatrix","keyToCurrentValue","propertyName","currentMatrix","targetMatrix","newMatrix","Array","i","PropertyName","currentPropertyName","targetPropertyName","currentValue","targetValue"],"sources":["SharedTransition.ts"],"sourcesContent":["'use strict';\nimport { withTiming } from '../../animation';\nimport type {\n SharedTransitionAnimationsFunction,\n SharedTransitionAnimationsValues,\n CustomProgressAnimation,\n ProgressAnimation,\n LayoutAnimationsOptions,\n} from '../animationBuilder/commonTypes';\nimport {\n LayoutAnimationType,\n SharedTransitionType,\n} from '../animationBuilder/commonTypes';\nimport type { StyleProps } from '../../commonTypes';\nimport { ReduceMotion } from '../../commonTypes';\nimport { configureLayoutAnimations } from '../../core';\nimport { ProgressTransitionManager } from './ProgressTransitionManager';\n\nconst SUPPORTED_PROPS = [\n 'width',\n 'height',\n 'originX',\n 'originY',\n 'transform',\n 'borderRadius',\n] as const;\n\ntype AnimationFactory = (\n values: SharedTransitionAnimationsValues\n) => StyleProps;\n\n/**\n * A SharedTransition builder class.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\nexport class SharedTransition {\n private _customAnimationFactory: AnimationFactory | null = null;\n private _animation: SharedTransitionAnimationsFunction | null = null;\n private _transitionDuration = 500;\n private _reduceMotion: ReduceMotion = ReduceMotion.System;\n private _customProgressAnimation?: ProgressAnimation = undefined;\n private _progressAnimation?: ProgressAnimation = undefined;\n private _defaultTransitionType?: SharedTransitionType = undefined;\n private static _progressTransitionManager = new ProgressTransitionManager();\n\n public custom(customAnimationFactory: AnimationFactory): SharedTransition {\n this._customAnimationFactory = customAnimationFactory;\n return this;\n }\n\n public progressAnimation(\n progressAnimationCallback: CustomProgressAnimation\n ): SharedTransition {\n this._customProgressAnimation = (viewTag, values, progress) => {\n 'worklet';\n const newStyles = progressAnimationCallback(values, progress);\n _notifyAboutProgress(viewTag, newStyles, true);\n };\n return this;\n }\n\n public duration(duration: number): SharedTransition {\n this._transitionDuration = duration;\n return this;\n }\n\n public reduceMotion(_reduceMotion: ReduceMotion): this {\n this._reduceMotion = _reduceMotion;\n return this;\n }\n\n public defaultTransitionType(\n transitionType: SharedTransitionType\n ): SharedTransition {\n this._defaultTransitionType = transitionType;\n return this;\n }\n\n public registerTransition(\n viewTag: number,\n sharedTransitionTag: string\n ): void {\n const transitionAnimation = this.getTransitionAnimation();\n const progressAnimation = this.getProgressAnimation();\n if (!this._defaultTransitionType) {\n if (this._customAnimationFactory && !this._customProgressAnimation) {\n this._defaultTransitionType = SharedTransitionType.ANIMATION;\n } else {\n this._defaultTransitionType = SharedTransitionType.PROGRESS_ANIMATION;\n }\n }\n const layoutAnimationType =\n this._defaultTransitionType === SharedTransitionType.ANIMATION\n ? LayoutAnimationType.SHARED_ELEMENT_TRANSITION\n : LayoutAnimationType.SHARED_ELEMENT_TRANSITION_PROGRESS;\n configureLayoutAnimations(\n viewTag,\n layoutAnimationType,\n transitionAnimation,\n sharedTransitionTag\n );\n SharedTransition._progressTransitionManager.addProgressAnimation(\n viewTag,\n progressAnimation\n );\n }\n\n public unregisterTransition(viewTag: number): void {\n SharedTransition._progressTransitionManager.removeProgressAnimation(\n viewTag\n );\n }\n\n public getReduceMotion(): ReduceMotion {\n return this._reduceMotion;\n }\n\n private getTransitionAnimation(): SharedTransitionAnimationsFunction {\n if (!this._animation) {\n this.buildAnimation();\n }\n return this._animation!;\n }\n\n private getProgressAnimation(): ProgressAnimation {\n if (!this._progressAnimation) {\n this.buildProgressAnimation();\n }\n return this._progressAnimation!;\n }\n\n private buildAnimation() {\n const animationFactory = this._customAnimationFactory;\n const transitionDuration = this._transitionDuration;\n const reduceMotion = this._reduceMotion;\n this._animation = (values: SharedTransitionAnimationsValues) => {\n 'worklet';\n let animations: {\n [key: string]: unknown;\n } = {};\n const initialValues: {\n [key: string]: unknown;\n } = {};\n\n if (animationFactory) {\n animations = animationFactory(values);\n for (const key in animations) {\n if (!(SUPPORTED_PROPS as readonly string[]).includes(key)) {\n throw new Error(\n `[Reanimated] The prop '${key}' is not supported yet.`\n );\n }\n }\n } else {\n for (const propName of SUPPORTED_PROPS) {\n if (propName === 'transform') {\n const matrix = values.targetTransformMatrix;\n animations.transformMatrix = withTiming(matrix, {\n reduceMotion,\n duration: transitionDuration,\n });\n } else {\n const capitalizedPropName = `${propName\n .charAt(0)\n .toUpperCase()}${propName.slice(\n 1\n )}` as Capitalize<LayoutAnimationsOptions>;\n const keyToTargetValue = `target${capitalizedPropName}` as const;\n animations[propName] = withTiming(values[keyToTargetValue], {\n reduceMotion,\n duration: transitionDuration,\n });\n }\n }\n }\n\n for (const propName in animations) {\n if (propName === 'transform') {\n initialValues.transformMatrix = values.currentTransformMatrix;\n } else {\n const capitalizedPropName = (propName.charAt(0).toUpperCase() +\n propName.slice(1)) as Capitalize<LayoutAnimationsOptions>;\n const keyToCurrentValue = `current${capitalizedPropName}` as const;\n initialValues[propName] = values[keyToCurrentValue];\n }\n }\n\n return { initialValues, animations };\n };\n }\n\n private buildProgressAnimation() {\n if (this._customProgressAnimation) {\n this._progressAnimation = this._customProgressAnimation;\n return;\n }\n this._progressAnimation = (viewTag, values, progress) => {\n 'worklet';\n const newStyles: { [key: string]: number | number[] } = {};\n for (const propertyName of SUPPORTED_PROPS) {\n if (propertyName === 'transform') {\n // this is not the perfect solution, but at this moment it just interpolates the whole\n // matrix instead of interpolating scale, translate, rotate, etc. separately\n const currentMatrix = values.currentTransformMatrix as number[];\n const targetMatrix = values.targetTransformMatrix as number[];\n const newMatrix = new Array(9);\n for (let i = 0; i < 9; i++) {\n newMatrix[i] =\n progress * (targetMatrix[i] - currentMatrix[i]) +\n currentMatrix[i];\n }\n newStyles.transformMatrix = newMatrix;\n } else {\n // PropertyName == propertyName with capitalized fist letter, (width -> Width)\n const PropertyName = (propertyName.charAt(0).toUpperCase() +\n propertyName.slice(1)) as Capitalize<LayoutAnimationsOptions>;\n const currentPropertyName = `current${PropertyName}` as const;\n const targetPropertyName = `target${PropertyName}` as const;\n\n const currentValue = values[currentPropertyName];\n const targetValue = values[targetPropertyName];\n\n newStyles[propertyName] =\n progress * (targetValue - currentValue) + currentValue;\n }\n }\n _notifyAboutProgress(viewTag, newStyles, true);\n };\n }\n\n // static builder methods i.e. shared transition modifiers\n\n /**\n * Lets you create a custom shared transition animation. Other shared transition modifiers can be chained alongside this modifier.\n *\n * @param customAnimationFactory - Callback function that have to return an object with styles for the custom shared transition.\n * @returns A {@link SharedTransition} object. Styles returned from this function need to be to the `sharedTransitionStyle` prop.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n public static custom(\n customAnimationFactory: AnimationFactory\n ): SharedTransition {\n return new SharedTransition().custom(customAnimationFactory);\n }\n\n /**\n * Lets you change the duration of the shared transition. Other shared transition modifiers can be chained alongside this modifier.\n *\n * @param duration - The duration of the shared transition animation in milliseconds.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n public static duration(duration: number): SharedTransition {\n return new SharedTransition().duration(duration);\n }\n\n /**\n * Lets you create a shared transition animation bound to the progress between navigation screens. Other shared transition modifiers can be chained alongside this modifier.\n *\n * @param progressAnimationCallback - A callback called with the current progress value on every animation frame. It should return an object with styles for the shared transition.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n public static progressAnimation(\n progressAnimationCallback: CustomProgressAnimation\n ): SharedTransition {\n return new SharedTransition().progressAnimation(progressAnimationCallback);\n }\n\n /**\n * Whether the transition is progress-bound or not. Other shared transition modifiers can be chained alongside this modifier.\n *\n * @param transitionType - Type of the transition. Configured with {@link SharedTransitionType} enum.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n public static defaultTransitionType(\n transitionType: SharedTransitionType\n ): SharedTransition {\n return new SharedTransition().defaultTransitionType(transitionType);\n }\n\n /**\n * Lets you adjust the behavior when the device's reduced motion accessibility setting is turned on. Other shared transition modifiers can be chained alongside this modifier.\n *\n * @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n public static reduceMotion(reduceMotion: ReduceMotion): SharedTransition {\n return new SharedTransition().reduceMotion(reduceMotion);\n }\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAA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;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAcU,QAAQA,CAACA,QAAgB,EAAoB;IACzD,OAAO,IAAId,gBAAgB,EAAE,CAACc,QAAQ,CAACA,QAAQ,CAAC;EAClD;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAcR,iBAAiBA,CAC7BC,yBAAkD,EAChC;IAClB,OAAO,IAAIP,gBAAgB,EAAE,CAACM,iBAAiB,CAACC,yBAAyB,CAAC;EAC5E;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAcW,qBAAqBA,CACjCC,cAAoC,EAClB;IAClB,OAAO,IAAInB,gBAAgB,EAAE,CAACkB,qBAAqB,CAACC,cAAc,CAAC;EACrE;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAcH,YAAYA,CAACA,YAA0B,EAAoB;IACvE,OAAO,IAAIhB,gBAAgB,EAAE,CAACgB,YAAY,CAACA,YAAY,CAAC;EAC1D;AACF;AAAC9C,eAAA,CAlQY8B,gBAAgB,gCAQiB,IAAIF,yBAAyB,EAAE"}
@@ -46,8 +46,8 @@ function addExistingTransform(newAnimationData, newTransform) {
46
46
  /**
47
47
  * Modifies default animation by preserving transformations that given element already contains.
48
48
  *
49
- * @param animationName Name of the animation to be modified (e.g. `FadeIn`).
50
- * @param existingTransform Transform values that element already contains.
49
+ * @param animationName - Name of the animation to be modified (e.g. `FadeIn`).
50
+ * @param existingTransform - Transform values that element already contains.
51
51
  * @returns Animation parsed to keyframe string.
52
52
  */
53
53
  export function createAnimationWithExistingTransform(animationName, existingTransform, layoutTransition) {
@@ -76,8 +76,8 @@ function generateNextCustomKeyframeName() {
76
76
  /**
77
77
  * Creates transition of given type, appends it to stylesheet and returns keyframe name.
78
78
  *
79
- * @param transitionType Type of transition (e.g. LINEAR).
80
- * @param transitionData Object containing data for transforms (translateX, scaleX,...).
79
+ * @param transitionType - Type of transition (e.g. LINEAR).
80
+ * @param transitionData - Object containing data for transforms (translateX, scaleX,...).
81
81
  * @returns Keyframe name that represents transition.
82
82
  */
83
83
  export function TransitionGenerator(transitionType, transitionData, existingTransform) {
@@ -1 +1 @@
1
- {"version":3,"names":["Animations","AnimationsData","TransitionType","convertAnimationObjectToKeyframes","LinearTransition","SequencedTransition","FadingTransition","insertWebAnimation","addPxToTranslate","existingTransform","newTransform","map","transformProp","newTransformProp","key","value","Object","entries","includes","addExistingTransform","newAnimationData","keyframeStepProperties","values","style","transform","Array","prototype","unshift","apply","createAnimationWithExistingTransform","animationName","layoutTransition","structuredClone","keyframeName","generateNextCustomKeyframeName","name","keyframe","customKeyframeCounter","TransitionGenerator","transitionType","transitionData","transitionKeyframeName","transitionObject","LINEAR","SEQUENCED","FADING","transitionKeyframe"],"sources":["createAnimation.ts"],"sourcesContent":["'use strict';\n\nimport { Animations, AnimationsData, TransitionType } from './config';\nimport { convertAnimationObjectToKeyframes } from './animationParser';\nimport type {\n AnimationData,\n ReanimatedWebTransformProperties,\n TransitionData,\n} from './animationParser';\nimport type { TransformsStyle } from 'react-native';\nimport { LinearTransition } from './transition/Linear.web';\nimport { SequencedTransition } from './transition/Sequenced.web';\nimport { FadingTransition } from './transition/Fading.web';\nimport { insertWebAnimation } from './domUtils';\n\n// Translate values are passed as numbers. However, if `translate` property receives number, it will not automatically\n// convert it to `px`. Therefore if we want to keep exisitng transform we have to add 'px' suffix to each of translate values\n// that are present inside transform.\nfunction addPxToTranslate(\n existingTransform: NonNullable<TransformsStyle['transform']>\n) {\n type RNTransformProp = (typeof existingTransform)[number];\n\n // @ts-ignore `existingTransform` cannot be string because in that case\n // we throw error in `extractTransformFromStyle`\n const newTransform = existingTransform.map(\n (transformProp: RNTransformProp) => {\n const newTransformProp: ReanimatedWebTransformProperties = {};\n for (const [key, value] of Object.entries(transformProp)) {\n if (key.includes('translate')) {\n // @ts-ignore After many trials we decided to ignore this error - it says that we cannot use 'key' to index this object.\n // Sadly it doesn't go away after using cast `key as keyof TransformProperties`.\n newTransformProp[key] = `${value}px`;\n } else {\n // @ts-ignore same as above.\n newTransformProp[key] = value;\n }\n }\n return newTransformProp;\n }\n );\n\n return newTransform;\n}\n\n// In order to keep exisitng transform throughout animation, we have to add it to each of keyframe step.\nfunction addExistingTransform(\n newAnimationData: AnimationData,\n newTransform: ReanimatedWebTransformProperties[]\n) {\n for (const keyframeStepProperties of Object.values(newAnimationData.style)) {\n if (!keyframeStepProperties.transform) {\n // If transform doesn't exist, we add only transform that already exists\n keyframeStepProperties.transform = newTransform;\n } else {\n // We insert existing transformations before ours.\n Array.prototype.unshift.apply(\n keyframeStepProperties.transform,\n newTransform\n );\n }\n }\n}\n\n/**\n * Modifies default animation by preserving transformations that given element already contains.\n *\n * @param animationName Name of the animation to be modified (e.g. `FadeIn`).\n * @param existingTransform Transform values that element already contains.\n * @returns Animation parsed to keyframe string.\n */\nexport function createAnimationWithExistingTransform(\n animationName: string,\n existingTransform: NonNullable<TransformsStyle['transform']>,\n layoutTransition?: AnimationData\n) {\n let newAnimationData;\n\n if (layoutTransition) {\n newAnimationData = layoutTransition;\n } else {\n if (!(animationName in Animations)) {\n return '';\n }\n newAnimationData = structuredClone(AnimationsData[animationName]);\n }\n\n const keyframeName = generateNextCustomKeyframeName();\n\n newAnimationData.name = keyframeName;\n\n const newTransform = addPxToTranslate(existingTransform);\n\n addExistingTransform(newAnimationData, newTransform);\n\n const keyframe = convertAnimationObjectToKeyframes(newAnimationData);\n\n insertWebAnimation(keyframeName, keyframe);\n\n return keyframeName;\n}\n\nlet customKeyframeCounter = 0;\n\nfunction generateNextCustomKeyframeName() {\n return `REA${customKeyframeCounter++}`;\n}\n\n/**\n * Creates transition of given type, appends it to stylesheet and returns keyframe name.\n *\n * @param transitionType Type of transition (e.g. LINEAR).\n * @param transitionData Object containing data for transforms (translateX, scaleX,...).\n * @returns Keyframe name that represents transition.\n */\nexport function TransitionGenerator(\n transitionType: TransitionType,\n transitionData: TransitionData,\n existingTransform: TransformsStyle['transform'] | undefined\n) {\n const transitionKeyframeName = generateNextCustomKeyframeName();\n let transitionObject;\n\n switch (transitionType) {\n case TransitionType.LINEAR:\n transitionObject = LinearTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n case TransitionType.SEQUENCED:\n transitionObject = SequencedTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n case TransitionType.FADING:\n transitionObject = FadingTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n }\n\n if (existingTransform) {\n return createAnimationWithExistingTransform(\n '',\n existingTransform,\n transitionObject\n );\n }\n\n const transitionKeyframe =\n convertAnimationObjectToKeyframes(transitionObject);\n\n insertWebAnimation(transitionKeyframeName, transitionKeyframe);\n\n return transitionKeyframeName;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,UAAU,EAAEC,cAAc,EAAEC,cAAc,QAAQ,UAAU;AACrE,SAASC,iCAAiC,QAAQ,mBAAmB;AAOrE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,kBAAkB,QAAQ,YAAY;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,iBAA4D,EAC5D;EAGA;EACA;EACA,MAAMC,YAAY,GAAGD,iBAAiB,CAACE,GAAG,CACvCC,aAA8B,IAAK;IAClC,MAAMC,gBAAkD,GAAG,CAAC,CAAC;IAC7D,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,aAAa,CAAC,EAAE;MACxD,IAAIE,GAAG,CAACI,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC7B;QACA;QACAL,gBAAgB,CAACC,GAAG,CAAC,GAAI,GAAEC,KAAM,IAAG;MACtC,CAAC,MAAM;QACL;QACAF,gBAAgB,CAACC,GAAG,CAAC,GAAGC,KAAK;MAC/B;IACF;IACA,OAAOF,gBAAgB;EACzB,CAAC,CACF;EAED,OAAOH,YAAY;AACrB;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AO,SAASC,mBAAmBA,CACjCC,cAA8B,EAC9BC,cAA8B,EAC9B/B,iBAA2D,EAC3D;EACA,MAAMgC,sBAAsB,GAAGP,8BAA8B,EAAE;EAC/D,IAAIQ,gBAAgB;EAEpB,QAAQH,cAAc;IACpB,KAAKrC,cAAc,CAACyC,MAAM;MACxBD,gBAAgB,GAAGtC,gBAAgB,CACjCqC,sBAAsB,EACtBD,cAAc,CACf;MACD;IACF,KAAKtC,cAAc,CAAC0C,SAAS;MAC3BF,gBAAgB,GAAGrC,mBAAmB,CACpCoC,sBAAsB,EACtBD,cAAc,CACf;MACD;IACF,KAAKtC,cAAc,CAAC2C,MAAM;MACxBH,gBAAgB,GAAGpC,gBAAgB,CACjCmC,sBAAsB,EACtBD,cAAc,CACf;MACD;EAAM;EAGV,IAAI/B,iBAAiB,EAAE;IACrB,OAAOoB,oCAAoC,CACzC,EAAE,EACFpB,iBAAiB,EACjBiC,gBAAgB,CACjB;EACH;EAEA,MAAMI,kBAAkB,GACtB3C,iCAAiC,CAACuC,gBAAgB,CAAC;EAErDnC,kBAAkB,CAACkC,sBAAsB,EAAEK,kBAAkB,CAAC;EAE9D,OAAOL,sBAAsB;AAC/B"}
1
+ {"version":3,"names":["Animations","AnimationsData","TransitionType","convertAnimationObjectToKeyframes","LinearTransition","SequencedTransition","FadingTransition","insertWebAnimation","addPxToTranslate","existingTransform","newTransform","map","transformProp","newTransformProp","key","value","Object","entries","includes","addExistingTransform","newAnimationData","keyframeStepProperties","values","style","transform","Array","prototype","unshift","apply","createAnimationWithExistingTransform","animationName","layoutTransition","structuredClone","keyframeName","generateNextCustomKeyframeName","name","keyframe","customKeyframeCounter","TransitionGenerator","transitionType","transitionData","transitionKeyframeName","transitionObject","LINEAR","SEQUENCED","FADING","transitionKeyframe"],"sources":["createAnimation.ts"],"sourcesContent":["'use strict';\n\nimport { Animations, AnimationsData, TransitionType } from './config';\nimport { convertAnimationObjectToKeyframes } from './animationParser';\nimport type {\n AnimationData,\n ReanimatedWebTransformProperties,\n TransitionData,\n} from './animationParser';\nimport type { TransformsStyle } from 'react-native';\nimport { LinearTransition } from './transition/Linear.web';\nimport { SequencedTransition } from './transition/Sequenced.web';\nimport { FadingTransition } from './transition/Fading.web';\nimport { insertWebAnimation } from './domUtils';\n\n// Translate values are passed as numbers. However, if `translate` property receives number, it will not automatically\n// convert it to `px`. Therefore if we want to keep exisitng transform we have to add 'px' suffix to each of translate values\n// that are present inside transform.\nfunction addPxToTranslate(\n existingTransform: NonNullable<TransformsStyle['transform']>\n) {\n type RNTransformProp = (typeof existingTransform)[number];\n\n // @ts-ignore `existingTransform` cannot be string because in that case\n // we throw error in `extractTransformFromStyle`\n const newTransform = existingTransform.map(\n (transformProp: RNTransformProp) => {\n const newTransformProp: ReanimatedWebTransformProperties = {};\n for (const [key, value] of Object.entries(transformProp)) {\n if (key.includes('translate')) {\n // @ts-ignore After many trials we decided to ignore this error - it says that we cannot use 'key' to index this object.\n // Sadly it doesn't go away after using cast `key as keyof TransformProperties`.\n newTransformProp[key] = `${value}px`;\n } else {\n // @ts-ignore same as above.\n newTransformProp[key] = value;\n }\n }\n return newTransformProp;\n }\n );\n\n return newTransform;\n}\n\n// In order to keep exisitng transform throughout animation, we have to add it to each of keyframe step.\nfunction addExistingTransform(\n newAnimationData: AnimationData,\n newTransform: ReanimatedWebTransformProperties[]\n) {\n for (const keyframeStepProperties of Object.values(newAnimationData.style)) {\n if (!keyframeStepProperties.transform) {\n // If transform doesn't exist, we add only transform that already exists\n keyframeStepProperties.transform = newTransform;\n } else {\n // We insert existing transformations before ours.\n Array.prototype.unshift.apply(\n keyframeStepProperties.transform,\n newTransform\n );\n }\n }\n}\n\n/**\n * Modifies default animation by preserving transformations that given element already contains.\n *\n * @param animationName - Name of the animation to be modified (e.g. `FadeIn`).\n * @param existingTransform - Transform values that element already contains.\n * @returns Animation parsed to keyframe string.\n */\nexport function createAnimationWithExistingTransform(\n animationName: string,\n existingTransform: NonNullable<TransformsStyle['transform']>,\n layoutTransition?: AnimationData\n) {\n let newAnimationData;\n\n if (layoutTransition) {\n newAnimationData = layoutTransition;\n } else {\n if (!(animationName in Animations)) {\n return '';\n }\n newAnimationData = structuredClone(AnimationsData[animationName]);\n }\n\n const keyframeName = generateNextCustomKeyframeName();\n\n newAnimationData.name = keyframeName;\n\n const newTransform = addPxToTranslate(existingTransform);\n\n addExistingTransform(newAnimationData, newTransform);\n\n const keyframe = convertAnimationObjectToKeyframes(newAnimationData);\n\n insertWebAnimation(keyframeName, keyframe);\n\n return keyframeName;\n}\n\nlet customKeyframeCounter = 0;\n\nfunction generateNextCustomKeyframeName() {\n return `REA${customKeyframeCounter++}`;\n}\n\n/**\n * Creates transition of given type, appends it to stylesheet and returns keyframe name.\n *\n * @param transitionType - Type of transition (e.g. LINEAR).\n * @param transitionData - Object containing data for transforms (translateX, scaleX,...).\n * @returns Keyframe name that represents transition.\n */\nexport function TransitionGenerator(\n transitionType: TransitionType,\n transitionData: TransitionData,\n existingTransform: TransformsStyle['transform'] | undefined\n) {\n const transitionKeyframeName = generateNextCustomKeyframeName();\n let transitionObject;\n\n switch (transitionType) {\n case TransitionType.LINEAR:\n transitionObject = LinearTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n case TransitionType.SEQUENCED:\n transitionObject = SequencedTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n case TransitionType.FADING:\n transitionObject = FadingTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n }\n\n if (existingTransform) {\n return createAnimationWithExistingTransform(\n '',\n existingTransform,\n transitionObject\n );\n }\n\n const transitionKeyframe =\n convertAnimationObjectToKeyframes(transitionObject);\n\n insertWebAnimation(transitionKeyframeName, transitionKeyframe);\n\n return transitionKeyframeName;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,UAAU,EAAEC,cAAc,EAAEC,cAAc,QAAQ,UAAU;AACrE,SAASC,iCAAiC,QAAQ,mBAAmB;AAOrE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1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,CACjB;EACH;EAEA,MAAMI,kBAAkB,GACtB3C,iCAAiC,CAACuC,gBAAgB,CAAC;EAErDnC,kBAAkB,CAACkC,sBAAsB,EAAEK,kBAAkB,CAAC;EAE9D,OAAOL,sBAAsB;AAC/B"}
@@ -4,8 +4,6 @@ import { jsVersion } from './jsVersion';
4
4
  export function checkCppVersion() {
5
5
  const cppVersion = global._REANIMATED_VERSION_CPP;
6
6
  if (cppVersion === undefined) {
7
- console.warn(`[Reanimated] Couldn't determine the version of the native part of Reanimated.
8
- See \`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#couldnt-determine-the-version-of-the-native-part-of-reanimated\` for more details.`);
9
7
  return;
10
8
  }
11
9
  const ok = matchVersion(jsVersion, cppVersion);
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion","checkCppVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","console","warn","ok","matchVersion","Error","version1","version2","match","major1","minor1","split","major2","minor2"],"sources":["checkCppVersion.ts"],"sourcesContent":["'use strict';\nimport { jsVersion } from './jsVersion';\n\nexport function checkCppVersion() {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n if (cppVersion === undefined) {\n console.warn(\n `[Reanimated] Couldn't determine the version of the native part of Reanimated.\n See \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#couldnt-determine-the-version-of-the-native-part-of-reanimated\\` for more details.`\n );\n return;\n }\n const ok = matchVersion(jsVersion, cppVersion);\n if (!ok) {\n throw new Error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs ${cppVersion}).\n See \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#mismatch-between-javascript-part-and-native-part-of-reanimated\\` for more details.`\n );\n }\n}\n\n// This is used only in test files, therefore it is reported by ts-prune (which is desired)\n// ts-prune-ignore-next\nexport function matchVersion(version1: string, version2: string) {\n if (version1.match(/^\\d+\\.\\d+\\.\\d+$/) && version2.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n // x.y.z, compare only major and minor, skip patch\n const [major1, minor1] = version1.split('.');\n const [major2, minor2] = version2.split('.');\n return major1 === major2 && minor1 === minor2;\n } else {\n // alpha, beta or rc, compare everything\n return version1 === version2;\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAAuB;EACjD,IAAIF,UAAU,KAAKG,SAAS,EAAE;IAC5BC,OAAO,CAACC,IAAI,CACT;AACP,4KAA4K,CACvK;IACD;EACF;EACA,MAAMC,EAAE,GAAGC,YAAY,CAACT,SAAS,EAAEE,UAAU,CAAC;EAC9C,IAAI,CAACM,EAAE,EAAE;IACP,MAAM,IAAIE,KAAK,CACZ,gFAA+EV,SAAU,OAAME,UAAW;AACjH,4KAA4K,CACvK;EACH;AACF;;AAEA;AACA;AACA,OAAO,SAASO,YAAYA,CAACE,QAAgB,EAAEC,QAAgB,EAAE;EAC/D,IAAID,QAAQ,CAACE,KAAK,CAAC,iBAAiB,CAAC,IAAID,QAAQ,CAACC,KAAK,CAAC,iBAAiB,CAAC,EAAE;IAC1E;IACA,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGJ,QAAQ,CAACK,KAAK,CAAC,GAAG,CAAC;IAC5C,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;IAC5C,OAAOF,MAAM,KAAKG,MAAM,IAAIF,MAAM,KAAKG,MAAM;EAC/C,CAAC,MAAM;IACL;IACA,OAAOP,QAAQ,KAAKC,QAAQ;EAC9B;AACF"}
1
+ {"version":3,"names":["jsVersion","checkCppVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","ok","matchVersion","Error","version1","version2","match","major1","minor1","split","major2","minor2"],"sources":["checkCppVersion.ts"],"sourcesContent":["'use strict';\nimport { jsVersion } from './jsVersion';\n\nexport function checkCppVersion() {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n if (cppVersion === undefined) {\n return;\n }\n const ok = matchVersion(jsVersion, cppVersion);\n if (!ok) {\n throw new Error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs ${cppVersion}).\n See \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#mismatch-between-javascript-part-and-native-part-of-reanimated\\` for more details.`\n );\n }\n}\n\n// This is used only in test files, therefore it is reported by ts-prune (which is desired)\n// ts-prune-ignore-next\nexport function matchVersion(version1: string, version2: string) {\n if (version1.match(/^\\d+\\.\\d+\\.\\d+$/) && version2.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n // x.y.z, compare only major and minor, skip patch\n const [major1, minor1] = version1.split('.');\n const [major2, minor2] = version2.split('.');\n return major1 === major2 && minor1 === minor2;\n } else {\n // alpha, beta or rc, compare everything\n return version1 === version2;\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAAuB;EACjD,IAAIF,UAAU,KAAKG,SAAS,EAAE;IAC5B;EACF;EACA,MAAMC,EAAE,GAAGC,YAAY,CAACP,SAAS,EAAEE,UAAU,CAAC;EAC9C,IAAI,CAACI,EAAE,EAAE;IACP,MAAM,IAAIE,KAAK,CACZ,gFAA+ER,SAAU,OAAME,UAAW;AACjH,4KAA4K,CACvK;EACH;AACF;;AAEA;AACA;AACA,OAAO,SAASK,YAAYA,CAACE,QAAgB,EAAEC,QAAgB,EAAE;EAC/D,IAAID,QAAQ,CAACE,KAAK,CAAC,iBAAiB,CAAC,IAAID,QAAQ,CAACC,KAAK,CAAC,iBAAiB,CAAC,EAAE;IAC1E;IACA,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGJ,QAAQ,CAACK,KAAK,CAAC,GAAG,CAAC;IAC5C,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;IAC5C,OAAOF,MAAM,KAAKG,MAAM,IAAIF,MAAM,KAAKG,MAAM;EAC/C,CAAC,MAAM;IACL;IACA,OAAOP,QAAQ,KAAKC,QAAQ;EAC9B;AACF"}
@@ -5,5 +5,5 @@
5
5
  * with the version used to build the native part of the library in runtime.
6
6
  * Remember to keep this in sync with the version declared in `package.json`
7
7
  */
8
- export const jsVersion = '3.6.0';
8
+ export const jsVersion = '3.6.2';
9
9
  //# sourceMappingURL=jsVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion"],"sources":["jsVersion.ts"],"sourcesContent":["'use strict';\n/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nexport const jsVersion = '3.6.0';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,OAAO"}
1
+ {"version":3,"names":["jsVersion"],"sources":["jsVersion.ts"],"sourcesContent":["'use strict';\n/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nexport const jsVersion = '3.6.2';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,OAAO"}
@@ -32,6 +32,15 @@ function dispatchCommandChromeDebugger() {
32
32
  function dispatchCommandDefault() {
33
33
  console.warn('[Reanimated] dispatchCommand() is not supported on this configuration.');
34
34
  }
35
+
36
+ /**
37
+ * Lets you synchronously call a command of a native component.
38
+ *
39
+ * @param animatedRef - An [animated ref](https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef#returns) connected to the component you'd want to call the command on.
40
+ * @param commandName - The name of the command to dispatch (e.g. `"focus"` or `"scrollToEnd"`).
41
+ * @param args - An optional array of arguments for the command.
42
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/dispatchCommand
43
+ */
35
44
  export let dispatchCommand;
36
45
  if (!shouldBeUseWeb()) {
37
46
  if (isFabric()) {
@@ -1 +1 @@
1
- {"version":3,"names":["isChromeDebugger","isFabric","isJest","shouldBeUseWeb","dispatchCommandFabric","animatedRef","commandName","args","arguments","length","undefined","_WORKLET","shadowNodeWrapper","_dispatchCommandFabric","dispatchCommandPaper","viewTag","_dispatchCommandPaper","dispatchCommandJest","console","warn","dispatchCommandChromeDebugger","dispatchCommandDefault","dispatchCommand"],"sources":["dispatchCommand.ts"],"sourcesContent":["'use strict';\nimport type { ShadowNodeWrapper } from '../commonTypes';\nimport {\n isChromeDebugger,\n isFabric,\n isJest,\n shouldBeUseWeb,\n} from '../PlatformChecker';\nimport type { AnimatedRef } from '../hook/commonTypes';\nimport type { Component } from 'react';\n\nfunction dispatchCommandFabric<T extends Component>(\n animatedRef: AnimatedRef<T>,\n commandName: string,\n args: Array<unknown> = []\n) {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n\n const shadowNodeWrapper = animatedRef() as ShadowNodeWrapper;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n _dispatchCommandFabric!(shadowNodeWrapper, commandName, args);\n}\n\nfunction dispatchCommandPaper<T extends Component>(\n animatedRef: AnimatedRef<T>,\n commandName: string,\n args: Array<unknown> = []\n) {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n\n const viewTag = animatedRef() as number;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n _dispatchCommandPaper!(viewTag, commandName, args);\n}\n\nfunction dispatchCommandJest() {\n console.warn('[Reanimated] dispatchCommand() is not supported with Jest.');\n}\n\nfunction dispatchCommandChromeDebugger() {\n console.warn(\n '[Reanimated] dispatchCommand() is not supported with Chrome Debugger.'\n );\n}\n\nfunction dispatchCommandDefault() {\n console.warn(\n '[Reanimated] dispatchCommand() is not supported on this configuration.'\n );\n}\n\nexport let dispatchCommand: <T extends Component>(\n animatedRef: AnimatedRef<T>,\n commandName: string,\n args?: Array<unknown>\n) => void;\nif (!shouldBeUseWeb()) {\n if (isFabric()) {\n dispatchCommand = dispatchCommandFabric;\n } else {\n dispatchCommand = dispatchCommandPaper;\n }\n} else if (isJest()) {\n dispatchCommand = dispatchCommandJest;\n} else if (isChromeDebugger()) {\n dispatchCommand = dispatchCommandChromeDebugger;\n} else {\n dispatchCommand = dispatchCommandDefault;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SACEA,gBAAgB,EAChBC,QAAQ,EACRC,MAAM,EACNC,cAAc,QACT,oBAAoB;AAI3B,SAASC,qBAAqBA,CAC5BC,WAA2B,EAC3BC,WAAmB,EAEnB;EACA,SAAS;;EAAC,IAFVC,IAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAGzB,IAAI,CAACG,QAAQ,EAAE;IACb;EACF;EAEA,MAAMC,iBAAiB,GAAGP,WAAW,EAAuB;EAC5D;EACAQ,sBAAsB,CAAED,iBAAiB,EAAEN,WAAW,EAAEC,IAAI,CAAC;AAC/D;AAEA,SAASO,oBAAoBA,CAC3BT,WAA2B,EAC3BC,WAAmB,EAEnB;EACA,SAAS;;EAAC,IAFVC,IAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAGzB,IAAI,CAACG,QAAQ,EAAE;IACb;EACF;EAEA,MAAMI,OAAO,GAAGV,WAAW,EAAY;EACvC;EACAW,qBAAqB,CAAED,OAAO,EAAET,WAAW,EAAEC,IAAI,CAAC;AACpD;AAEA,SAASU,mBAAmBA,CAAA,EAAG;EAC7BC,OAAO,CAACC,IAAI,CAAC,4DAA4D,CAAC;AAC5E;AAEA,SAASC,6BAA6BA,CAAA,EAAG;EACvCF,OAAO,CAACC,IAAI,CACV,uEAAuE,CACxE;AACH;AAEA,SAASE,sBAAsBA,CAAA,EAAG;EAChCH,OAAO,CAACC,IAAI,CACV,wEAAwE,CACzE;AACH;AAEA,OAAO,IAAIG,eAIF;AACT,IAAI,CAACnB,cAAc,EAAE,EAAE;EACrB,IAAIF,QAAQ,EAAE,EAAE;IACdqB,eAAe,GAAGlB,qBAAqB;EACzC,CAAC,MAAM;IACLkB,eAAe,GAAGR,oBAAoB;EACxC;AACF,CAAC,MAAM,IAAIZ,MAAM,EAAE,EAAE;EACnBoB,eAAe,GAAGL,mBAAmB;AACvC,CAAC,MAAM,IAAIjB,gBAAgB,EAAE,EAAE;EAC7BsB,eAAe,GAAGF,6BAA6B;AACjD,CAAC,MAAM;EACLE,eAAe,GAAGD,sBAAsB;AAC1C"}
1
+ {"version":3,"names":["isChromeDebugger","isFabric","isJest","shouldBeUseWeb","dispatchCommandFabric","animatedRef","commandName","args","arguments","length","undefined","_WORKLET","shadowNodeWrapper","_dispatchCommandFabric","dispatchCommandPaper","viewTag","_dispatchCommandPaper","dispatchCommandJest","console","warn","dispatchCommandChromeDebugger","dispatchCommandDefault","dispatchCommand"],"sources":["dispatchCommand.ts"],"sourcesContent":["'use strict';\nimport type { ShadowNodeWrapper } from '../commonTypes';\nimport {\n isChromeDebugger,\n isFabric,\n isJest,\n shouldBeUseWeb,\n} from '../PlatformChecker';\nimport type { AnimatedRef } from '../hook/commonTypes';\nimport type { Component } from 'react';\n\nfunction dispatchCommandFabric<T extends Component>(\n animatedRef: AnimatedRef<T>,\n commandName: string,\n args: Array<unknown> = []\n) {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n\n const shadowNodeWrapper = animatedRef() as ShadowNodeWrapper;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n _dispatchCommandFabric!(shadowNodeWrapper, commandName, args);\n}\n\nfunction dispatchCommandPaper<T extends Component>(\n animatedRef: AnimatedRef<T>,\n commandName: string,\n args: Array<unknown> = []\n) {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n\n const viewTag = animatedRef() as number;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n _dispatchCommandPaper!(viewTag, commandName, args);\n}\n\nfunction dispatchCommandJest() {\n console.warn('[Reanimated] dispatchCommand() is not supported with Jest.');\n}\n\nfunction dispatchCommandChromeDebugger() {\n console.warn(\n '[Reanimated] dispatchCommand() is not supported with Chrome Debugger.'\n );\n}\n\nfunction dispatchCommandDefault() {\n console.warn(\n '[Reanimated] dispatchCommand() is not supported on this configuration.'\n );\n}\n\n/**\n * Lets you synchronously call a command of a native component.\n *\n * @param animatedRef - An [animated ref](https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef#returns) connected to the component you'd want to call the command on.\n * @param commandName - The name of the command to dispatch (e.g. `\"focus\"` or `\"scrollToEnd\"`).\n * @param args - An optional array of arguments for the command.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/dispatchCommand\n */\nexport let dispatchCommand: <T extends Component>(\n animatedRef: AnimatedRef<T>,\n commandName: string,\n args?: Array<unknown>\n) => void;\nif (!shouldBeUseWeb()) {\n if (isFabric()) {\n dispatchCommand = dispatchCommandFabric;\n } else {\n dispatchCommand = dispatchCommandPaper;\n }\n} else if (isJest()) {\n dispatchCommand = dispatchCommandJest;\n} else if (isChromeDebugger()) {\n dispatchCommand = dispatchCommandChromeDebugger;\n} else {\n dispatchCommand = dispatchCommandDefault;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SACEA,gBAAgB,EAChBC,QAAQ,EACRC,MAAM,EACNC,cAAc,QACT,oBAAoB;AAI3B,SAASC,qBAAqBA,CAC5BC,WAA2B,EAC3BC,WAAmB,EAEnB;EACA,SAAS;;EAAC,IAFVC,IAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAGzB,IAAI,CAACG,QAAQ,EAAE;IACb;EACF;EAEA,MAAMC,iBAAiB,GAAGP,WAAW,EAAuB;EAC5D;EACAQ,sBAAsB,CAAED,iBAAiB,EAAEN,WAAW,EAAEC,IAAI,CAAC;AAC/D;AAEA,SAASO,oBAAoBA,CAC3BT,WAA2B,EAC3BC,WAAmB,EAEnB;EACA,SAAS;;EAAC,IAFVC,IAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAGzB,IAAI,CAACG,QAAQ,EAAE;IACb;EACF;EAEA,MAAMI,OAAO,GAAGV,WAAW,EAAY;EACvC;EACAW,qBAAqB,CAAED,OAAO,EAAET,WAAW,EAAEC,IAAI,CAAC;AACpD;AAEA,SAASU,mBAAmBA,CAAA,EAAG;EAC7BC,OAAO,CAACC,IAAI,CAAC,4DAA4D,CAAC;AAC5E;AAEA,SAASC,6BAA6BA,CAAA,EAAG;EACvCF,OAAO,CAACC,IAAI,CACV,uEAAuE,CACxE;AACH;AAEA,SAASE,sBAAsBA,CAAA,EAAG;EAChCH,OAAO,CAACC,IAAI,CACV,wEAAwE,CACzE;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAIG,eAIF;AACT,IAAI,CAACnB,cAAc,EAAE,EAAE;EACrB,IAAIF,QAAQ,EAAE,EAAE;IACdqB,eAAe,GAAGlB,qBAAqB;EACzC,CAAC,MAAM;IACLkB,eAAe,GAAGR,oBAAoB;EACxC;AACF,CAAC,MAAM,IAAIZ,MAAM,EAAE,EAAE;EACnBoB,eAAe,GAAGL,mBAAmB;AACvC,CAAC,MAAM,IAAIjB,gBAAgB,EAAE,EAAE;EAC7BsB,eAAe,GAAGF,6BAA6B;AACjD,CAAC,MAAM;EACLE,eAAe,GAAGD,sBAAsB;AAC1C"}
@@ -1,14 +1,24 @@
1
1
  'use strict';
2
2
 
3
3
  import { measure } from './measure';
4
+
5
+ /**
6
+ * An object which contains relative coordinates.
7
+ */
8
+
4
9
  /**
5
- * Given an absolute position and a component ref, returns the relative
6
- * position in the component's local coordinate space.
10
+ * Lets you determines the location on the screen, relative to the given view.
11
+ *
12
+ * @param animatedRef - An [animated ref](https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef#returns) connected to the component you'd want to get the coordinates from.
13
+ * @param absoluteX - A number which is an absolute x coordinate.
14
+ * @param absoluteY - A number which is an absolute y coordinate.
15
+ * @returns An object which contains relative coordinates - {@link ComponentCoords}.
16
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/utilities/getRelativeCoords
7
17
  */
8
- export function getRelativeCoords(parentAnimatedRef, absoluteX, absoluteY) {
18
+ export function getRelativeCoords(animatedRef, absoluteX, absoluteY) {
9
19
  'worklet';
10
20
 
11
- const parentCoords = measure(parentAnimatedRef);
21
+ const parentCoords = measure(animatedRef);
12
22
  if (parentCoords === null) {
13
23
  return null;
14
24
  }
@@ -1 +1 @@
1
- {"version":3,"names":["measure","getRelativeCoords","parentAnimatedRef","absoluteX","absoluteY","parentCoords","x","y"],"sources":["getRelativeCoords.ts"],"sourcesContent":["'use strict';\nimport type { Component } from 'react';\nimport { measure } from './measure';\nimport type { AnimatedRef } from '../hook/commonTypes';\n\nexport interface ComponentCoords {\n x: number;\n y: number;\n}\n\n/**\n * Given an absolute position and a component ref, returns the relative\n * position in the component's local coordinate space.\n */\nexport function getRelativeCoords(\n parentAnimatedRef: AnimatedRef<Component>,\n absoluteX: number,\n absoluteY: number\n): ComponentCoords | null {\n 'worklet';\n const parentCoords = measure(parentAnimatedRef);\n if (parentCoords === null) {\n return null;\n }\n return {\n x: absoluteX - parentCoords.x,\n y: absoluteY - parentCoords.y,\n };\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,OAAO,QAAQ,WAAW;AAQnC;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAC/BC,iBAAyC,EACzCC,SAAiB,EACjBC,SAAiB,EACO;EACxB,SAAS;;EACT,MAAMC,YAAY,GAAGL,OAAO,CAACE,iBAAiB,CAAC;EAC/C,IAAIG,YAAY,KAAK,IAAI,EAAE;IACzB,OAAO,IAAI;EACb;EACA,OAAO;IACLC,CAAC,EAAEH,SAAS,GAAGE,YAAY,CAACC,CAAC;IAC7BC,CAAC,EAAEH,SAAS,GAAGC,YAAY,CAACE;EAC9B,CAAC;AACH"}
1
+ {"version":3,"names":["measure","getRelativeCoords","animatedRef","absoluteX","absoluteY","parentCoords","x","y"],"sources":["getRelativeCoords.ts"],"sourcesContent":["'use strict';\nimport type { Component } from 'react';\nimport { measure } from './measure';\nimport type { AnimatedRef } from '../hook/commonTypes';\n\n/**\n * An object which contains relative coordinates.\n */\nexport interface ComponentCoords {\n x: number;\n y: number;\n}\n\n/**\n * Lets you determines the location on the screen, relative to the given view.\n *\n * @param animatedRef - An [animated ref](https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef#returns) connected to the component you'd want to get the coordinates from.\n * @param absoluteX - A number which is an absolute x coordinate.\n * @param absoluteY - A number which is an absolute y coordinate.\n * @returns An object which contains relative coordinates - {@link ComponentCoords}.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/utilities/getRelativeCoords\n */\nexport function getRelativeCoords(\n animatedRef: AnimatedRef<Component>,\n absoluteX: number,\n absoluteY: number\n): ComponentCoords | null {\n 'worklet';\n const parentCoords = measure(animatedRef);\n if (parentCoords === null) {\n return null;\n }\n return {\n x: absoluteX - parentCoords.x,\n y: absoluteY - parentCoords.y,\n };\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,OAAO,QAAQ,WAAW;;AAGnC;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAC/BC,WAAmC,EACnCC,SAAiB,EACjBC,SAAiB,EACO;EACxB,SAAS;;EACT,MAAMC,YAAY,GAAGL,OAAO,CAACE,WAAW,CAAC;EACzC,IAAIG,YAAY,KAAK,IAAI,EAAE;IACzB,OAAO,IAAI;EACb;EACA,OAAO;IACLC,CAAC,EAAEH,SAAS,GAAGE,YAAY,CAACC,CAAC;IAC7BC,CAAC,EAAEH,SAAS,GAAGC,YAAY,CAACE;EAC9B,CAAC;AACH"}
@@ -1,6 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  import { isChromeDebugger, isFabric, isJest, shouldBeUseWeb } from '../PlatformChecker';
4
+ /**
5
+ * Lets you synchronously get the dimensions and position of a view on the screen.
6
+ *
7
+ * @param animatedRef - An [animated ref](https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef#returns) connected to the component you'd want to get the measurements from.
8
+ * @returns An object containing component measurements or null when the measurement couldn't be performed- {@link MeasuredDimensions}.
9
+ * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/measure/
10
+ */
4
11
  export let measure;
5
12
  function measureFabric(animatedRef) {
6
13
  'worklet';