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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/Common/cpp/Fabric/ShadowTreeCloner.cpp +5 -2
  2. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +42 -32
  3. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +5 -7
  4. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +565 -0
  5. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +74 -0
  6. package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.h +140 -0
  7. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +216 -58
  8. package/Common/cpp/NativeModules/NativeReanimatedModule.h +32 -11
  9. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +2 -17
  10. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -8
  11. package/Common/cpp/ReanimatedRuntime/RNRuntimeDecorator.cpp +3 -0
  12. package/Common/cpp/ReanimatedRuntime/WorkletRuntime.cpp +3 -4
  13. package/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp +8 -3
  14. package/Common/cpp/SharedItems/Shareables.cpp +31 -5
  15. package/Common/cpp/SharedItems/Shareables.h +18 -2
  16. package/Common/cpp/Tools/JSScheduler.cpp +29 -5
  17. package/Common/cpp/Tools/JSScheduler.h +21 -4
  18. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -2
  19. package/Common/cpp/Tools/UIRuntimeDecorator.cpp +6 -0
  20. package/Common/cpp/Tools/UIRuntimeDecorator.h +1 -0
  21. package/android/CMakeLists.txt +3 -0
  22. package/android/build.gradle +17 -5
  23. package/android/src/main/cpp/NativeProxy.cpp +77 -12
  24. package/android/src/main/cpp/NativeProxy.h +35 -1
  25. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +58 -19
  26. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +7 -2
  27. package/android/src/{reactNativeVersionPatch/ReanimatedUIManager/latest → main/java}/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +5 -5
  28. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +10 -6
  29. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +18 -1
  30. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +105 -17
  31. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +2 -1
  32. package/android/src/paper/java/com/swmansion/reanimated/NativeReanimatedModuleSpec.java +37 -0
  33. package/android/src/{main/java/com/swmansion/reanimated → reactNativeVersionPatch/ReanimatedUIManager/73/com/swmansion}/ReanimatedModule.java +4 -3
  34. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/{70 → 73}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -22
  35. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedModule.java +176 -0
  36. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -26
  37. package/android/src/{fabric/java → reactNativeVersionPatch/RuntimeExecutor/73}/com/swmansion/reanimated/NativeProxy.java +16 -4
  38. package/android/src/reactNativeVersionPatch/RuntimeExecutor/latest/com/swmansion/reanimated/NativeProxy.java +143 -0
  39. package/apple/LayoutReanimation/REAAnimationsManager.h +3 -0
  40. package/apple/LayoutReanimation/REAAnimationsManager.m +11 -0
  41. package/apple/LayoutReanimation/REASharedTransitionManager.m +99 -23
  42. package/apple/LayoutReanimation/REASnapshot.h +1 -0
  43. package/apple/LayoutReanimation/REASnapshot.m +78 -37
  44. package/apple/REAModule.h +22 -2
  45. package/apple/REAModule.mm +97 -46
  46. package/apple/REANodesManager.h +3 -3
  47. package/apple/REANodesManager.mm +46 -22
  48. package/apple/native/NativeProxy.h +28 -2
  49. package/apple/native/NativeProxy.mm +65 -195
  50. package/apple/native/PlatformDepMethodsHolderImpl.h +59 -0
  51. package/apple/native/PlatformDepMethodsHolderImpl.mm +429 -0
  52. package/apple/sensor/ReanimatedSensor.m +5 -5
  53. package/lib/module/Animated.js.map +1 -1
  54. package/lib/module/ConfigHelper.js +1 -1
  55. package/lib/module/ConfigHelper.js.map +1 -1
  56. package/lib/module/animationBuilder.js +1 -0
  57. package/lib/module/animationBuilder.js.map +1 -1
  58. package/lib/module/createAnimatedComponent/InlinePropManager.js +4 -4
  59. package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
  60. package/lib/module/createAnimatedComponent/JSPropsUpdater.js +9 -6
  61. package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
  62. package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js +11 -0
  63. package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js.map +1 -0
  64. package/lib/module/createAnimatedComponent/PropsFilter.js +25 -9
  65. package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
  66. package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
  67. package/lib/module/createAnimatedComponent/createAnimatedComponent.js +83 -52
  68. package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
  69. package/lib/module/createAnimatedComponent/getViewInfo.js +37 -0
  70. package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -0
  71. package/lib/module/createAnimatedComponent/index.js.map +1 -1
  72. package/lib/module/createAnimatedComponent/setAndForwardRef.js +4 -5
  73. package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
  74. package/lib/module/createAnimatedComponent/utils.js.map +1 -1
  75. package/lib/module/index.js.map +1 -1
  76. package/lib/module/index.web.js +1 -2
  77. package/lib/module/index.web.js.map +1 -1
  78. package/lib/module/mock.js +12 -12
  79. package/lib/module/mock.js.map +1 -1
  80. package/lib/module/propsAllowlists.js.map +1 -1
  81. package/lib/module/reanimated2/Bezier.js.map +1 -1
  82. package/lib/module/reanimated2/Colors.js +4 -11
  83. package/lib/module/reanimated2/Colors.js.map +1 -1
  84. package/lib/module/reanimated2/Easing.js +3 -7
  85. package/lib/module/reanimated2/Easing.js.map +1 -1
  86. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -13
  87. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  88. package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
  89. package/lib/module/reanimated2/NativeReanimated/index.web.js.map +1 -1
  90. package/lib/module/reanimated2/PlatformChecker.js +2 -1
  91. package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
  92. package/lib/module/reanimated2/PropAdapters.js +1 -1
  93. package/lib/module/reanimated2/PropAdapters.js.map +1 -1
  94. package/lib/module/reanimated2/PropsRegistry.js +1 -2
  95. package/lib/module/reanimated2/PropsRegistry.js.map +1 -1
  96. package/lib/module/reanimated2/Sensor.js +2 -2
  97. package/lib/module/reanimated2/Sensor.js.map +1 -1
  98. package/lib/module/reanimated2/SensorContainer.js +2 -2
  99. package/lib/module/reanimated2/SensorContainer.js.map +1 -1
  100. package/lib/module/reanimated2/UpdateLayoutAnimations.js +30 -8
  101. package/lib/module/reanimated2/UpdateLayoutAnimations.js.map +1 -1
  102. package/lib/module/reanimated2/UpdateProps.js.map +1 -1
  103. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  104. package/lib/module/reanimated2/WorkletEventHandler.js +74 -31
  105. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  106. package/lib/module/reanimated2/animation/clamp.js.map +1 -1
  107. package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
  108. package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
  109. package/lib/module/reanimated2/animation/decay/index.js.map +1 -1
  110. package/lib/module/reanimated2/animation/decay/rigidDecay.js.map +1 -1
  111. package/lib/module/reanimated2/animation/decay/rubberBandDecay.js.map +1 -1
  112. package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
  113. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  114. package/lib/module/reanimated2/animation/index.js.map +1 -1
  115. package/lib/module/reanimated2/animation/repeat.js +1 -6
  116. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  117. package/lib/module/reanimated2/animation/sequence.js +1 -5
  118. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  119. package/lib/module/reanimated2/animation/spring.js.map +1 -1
  120. package/lib/module/reanimated2/animation/springUtils.js +8 -10
  121. package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
  122. package/lib/module/reanimated2/animation/styleAnimation.js +5 -4
  123. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  124. package/lib/module/reanimated2/animation/timing.js +4 -1
  125. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  126. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +1 -2
  127. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
  128. package/lib/module/reanimated2/animation/util.js +22 -2
  129. package/lib/module/reanimated2/animation/util.js.map +1 -1
  130. package/lib/module/reanimated2/commonTypes.js +3 -1
  131. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  132. package/lib/module/reanimated2/component/FlatList.js +1 -0
  133. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  134. package/lib/module/reanimated2/component/Image.js +1 -0
  135. package/lib/module/reanimated2/component/Image.js.map +1 -1
  136. package/lib/module/reanimated2/component/LayoutAnimationConfig.js +1 -0
  137. package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
  138. package/lib/module/reanimated2/component/PerformanceMonitor.js +169 -0
  139. package/lib/module/reanimated2/component/PerformanceMonitor.js.map +1 -0
  140. package/lib/module/reanimated2/component/ScrollView.js +1 -0
  141. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  142. package/lib/module/reanimated2/component/Text.js +1 -0
  143. package/lib/module/reanimated2/component/Text.js.map +1 -1
  144. package/lib/module/reanimated2/component/View.js +1 -0
  145. package/lib/module/reanimated2/component/View.js.map +1 -1
  146. package/lib/module/reanimated2/core.js +6 -15
  147. package/lib/module/reanimated2/core.js.map +1 -1
  148. package/lib/module/reanimated2/errors.js +8 -8
  149. package/lib/module/reanimated2/errors.js.map +1 -1
  150. package/lib/module/reanimated2/fabricUtils.js +33 -8
  151. package/lib/module/reanimated2/fabricUtils.js.map +1 -1
  152. package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
  153. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +2 -2
  154. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  155. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  156. package/lib/module/reanimated2/frameCallback/index.js.map +1 -1
  157. package/lib/module/reanimated2/globals.d.js.map +1 -1
  158. package/lib/module/reanimated2/helperTypes.js.map +1 -1
  159. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
  160. package/lib/module/reanimated2/hook/index.js.map +1 -1
  161. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -0
  162. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  163. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +3 -4
  164. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  165. package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
  166. package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -0
  167. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  168. package/lib/module/reanimated2/hook/useAnimatedRef.js +12 -7
  169. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  170. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +3 -1
  171. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  172. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  173. package/lib/module/reanimated2/hook/useAnimatedStyle.js +3 -6
  174. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  175. package/lib/module/reanimated2/hook/useDerivedValue.js +3 -1
  176. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  177. package/lib/module/reanimated2/hook/useEvent.js +4 -5
  178. package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
  179. package/lib/module/reanimated2/hook/useFrameCallback.js +1 -2
  180. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  181. package/lib/module/reanimated2/hook/useHandler.js +3 -1
  182. package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
  183. package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
  184. package/lib/module/reanimated2/hook/useScrollViewOffset.js +60 -16
  185. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  186. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  187. package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
  188. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  189. package/lib/module/reanimated2/index.js +2 -0
  190. package/lib/module/reanimated2/index.js.map +1 -1
  191. package/lib/module/reanimated2/initializers.js +1 -5
  192. package/lib/module/reanimated2/initializers.js.map +1 -1
  193. package/lib/module/reanimated2/interpolateColor.js +2 -6
  194. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  195. package/lib/module/reanimated2/interpolation.js +1 -1
  196. package/lib/module/reanimated2/interpolation.js.map +1 -1
  197. package/lib/module/reanimated2/isSharedValue.js.map +1 -1
  198. package/lib/module/reanimated2/jestUtils.js +3 -6
  199. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  200. package/lib/module/reanimated2/jestUtils.web.js.map +1 -1
  201. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +5 -9
  202. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  203. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -1
  204. package/lib/module/reanimated2/js-reanimated/index.js +2 -2
  205. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  206. package/lib/module/reanimated2/js-reanimated/react-native-web.d.js.map +1 -1
  207. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +4 -2
  208. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  209. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +12 -11
  210. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  211. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +12 -10
  212. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  213. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  214. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  215. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +11 -4
  216. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  217. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +22 -22
  218. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  219. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +22 -22
  220. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  221. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +26 -26
  222. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  223. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +10 -10
  224. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  225. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -6
  226. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  227. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +10 -10
  228. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  229. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +18 -18
  230. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  231. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +18 -18
  232. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  233. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +10 -10
  234. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  235. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +34 -34
  236. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  237. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  238. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +17 -4
  239. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  240. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +4 -4
  241. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  242. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +4 -4
  243. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  244. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +4 -4
  245. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  246. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +4 -4
  247. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  248. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +4 -4
  249. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  250. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  251. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  252. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js +16 -12
  253. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js.map +1 -1
  254. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +13 -7
  255. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
  256. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.web.js.map +1 -1
  257. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  258. package/lib/module/reanimated2/layoutReanimation/web/animation/Bounce.web.js.map +1 -1
  259. package/lib/module/reanimated2/layoutReanimation/web/animation/Fade.web.js.map +1 -1
  260. package/lib/module/reanimated2/layoutReanimation/web/animation/Flip.web.js.map +1 -1
  261. package/lib/module/reanimated2/layoutReanimation/web/animation/Lightspeed.web.js.map +1 -1
  262. package/lib/module/reanimated2/layoutReanimation/web/animation/Pinwheel.web.js.map +1 -1
  263. package/lib/module/reanimated2/layoutReanimation/web/animation/Roll.web.js.map +1 -1
  264. package/lib/module/reanimated2/layoutReanimation/web/animation/Rotate.web.js.map +1 -1
  265. package/lib/module/reanimated2/layoutReanimation/web/animation/Slide.web.js.map +1 -1
  266. package/lib/module/reanimated2/layoutReanimation/web/animation/Stretch.web.js.map +1 -1
  267. package/lib/module/reanimated2/layoutReanimation/web/animation/Zoom.web.js.map +1 -1
  268. package/lib/module/reanimated2/layoutReanimation/web/animationParser.js +0 -2
  269. package/lib/module/reanimated2/layoutReanimation/web/animationParser.js.map +1 -1
  270. package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js +1 -2
  271. package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js.map +1 -1
  272. package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js +3 -1
  273. package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js.map +1 -1
  274. package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js +6 -7
  275. package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js.map +1 -1
  276. package/lib/module/reanimated2/layoutReanimation/web/config.js.map +1 -1
  277. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +2 -2
  278. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
  279. package/lib/module/reanimated2/layoutReanimation/web/domUtils.js +4 -4
  280. package/lib/module/reanimated2/layoutReanimation/web/domUtils.js.map +1 -1
  281. package/lib/module/reanimated2/layoutReanimation/web/index.js.map +1 -1
  282. package/lib/module/reanimated2/layoutReanimation/web/transition/Fading.web.js.map +1 -1
  283. package/lib/module/reanimated2/layoutReanimation/web/transition/Linear.web.js.map +1 -1
  284. package/lib/module/reanimated2/layoutReanimation/web/transition/Sequenced.web.js.map +1 -1
  285. package/lib/module/reanimated2/mappers.js +2 -4
  286. package/lib/module/reanimated2/mappers.js.map +1 -1
  287. package/lib/module/reanimated2/mockedRequestAnimationFrame.js.map +1 -1
  288. package/lib/module/reanimated2/mutables.js +2 -4
  289. package/lib/module/reanimated2/mutables.js.map +1 -1
  290. package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  291. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  292. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
  293. package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
  294. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
  295. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +2 -4
  296. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
  297. package/lib/module/reanimated2/platformFunctions/dispatchCommand.web.js.map +1 -1
  298. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +2 -2
  299. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
  300. package/lib/module/reanimated2/platformFunctions/index.js.map +1 -1
  301. package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
  302. package/lib/module/reanimated2/platformFunctions/measure.web.js.map +1 -1
  303. package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
  304. package/lib/module/reanimated2/platformFunctions/scrollTo.web.js +1 -1
  305. package/lib/module/reanimated2/platformFunctions/scrollTo.web.js.map +1 -1
  306. package/lib/module/reanimated2/platformFunctions/setGestureState.js.map +1 -1
  307. package/lib/module/reanimated2/platformFunctions/setGestureState.web.js.map +1 -1
  308. package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
  309. package/lib/module/reanimated2/platformFunctions/setNativeProps.web.js.map +1 -1
  310. package/lib/module/reanimated2/pluginUtils.js.map +1 -1
  311. package/lib/module/reanimated2/publicGlobals.js.map +1 -1
  312. package/lib/module/reanimated2/runtimes.js +11 -19
  313. package/lib/module/reanimated2/runtimes.js.map +1 -1
  314. package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js +20 -0
  315. package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js.map +1 -0
  316. package/lib/module/reanimated2/screenTransition/animationManager.js +41 -0
  317. package/lib/module/reanimated2/screenTransition/animationManager.js.map +1 -0
  318. package/lib/module/reanimated2/screenTransition/commonTypes.js +4 -0
  319. package/lib/module/reanimated2/screenTransition/commonTypes.js.map +1 -0
  320. package/lib/module/reanimated2/screenTransition/index.js +5 -0
  321. package/lib/module/reanimated2/screenTransition/index.js.map +1 -0
  322. package/lib/module/reanimated2/screenTransition/presets.js +157 -0
  323. package/lib/module/reanimated2/screenTransition/presets.js.map +1 -0
  324. package/lib/module/reanimated2/screenTransition/styleUpdater.js +62 -0
  325. package/lib/module/reanimated2/screenTransition/styleUpdater.js.map +1 -0
  326. package/lib/module/reanimated2/screenTransition/swipeSimulator.js +190 -0
  327. package/lib/module/reanimated2/screenTransition/swipeSimulator.js.map +1 -0
  328. package/lib/module/reanimated2/shareableMappingCache.js.map +1 -1
  329. package/lib/module/reanimated2/shareables.js +27 -10
  330. package/lib/module/reanimated2/shareables.js.map +1 -1
  331. package/lib/module/reanimated2/threads.js +9 -34
  332. package/lib/module/reanimated2/threads.js.map +1 -1
  333. package/lib/module/reanimated2/valueSetter.js +1 -2
  334. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  335. package/lib/module/reanimated2/valueUnpacker.js +4 -3
  336. package/lib/module/reanimated2/valueUnpacker.js.map +1 -1
  337. package/lib/module/specs/NativeReanimatedModule.js +5 -0
  338. package/lib/module/specs/NativeReanimatedModule.js.map +1 -0
  339. package/lib/typescript/ConfigHelper.d.ts +1 -0
  340. package/lib/typescript/createAnimatedComponent/InlinePropManager.d.ts +1 -1
  341. package/lib/typescript/createAnimatedComponent/JSPropsUpdater.web.d.ts +6 -0
  342. package/lib/typescript/createAnimatedComponent/PropsFilter.d.ts +3 -0
  343. package/lib/typescript/createAnimatedComponent/getViewInfo.d.ts +9 -0
  344. package/lib/typescript/reanimated2/NativeReanimated/NativeReanimated.d.ts +8 -13
  345. package/lib/typescript/reanimated2/UpdateLayoutAnimations.d.ts +12 -1
  346. package/lib/typescript/reanimated2/WorkletEventHandler.d.ts +16 -9
  347. package/lib/typescript/reanimated2/animation/util.d.ts +2 -0
  348. package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +1 -1
  349. package/lib/typescript/reanimated2/component/PerformanceMonitor.d.ts +2 -0
  350. package/lib/typescript/reanimated2/core.d.ts +3 -4
  351. package/lib/typescript/reanimated2/hook/commonTypes.d.ts +6 -0
  352. package/lib/typescript/reanimated2/hook/useEvent.d.ts +2 -3
  353. package/lib/typescript/reanimated2/hook/useScrollViewOffset.d.ts +3 -1
  354. package/lib/typescript/reanimated2/index.d.ts +3 -0
  355. package/lib/typescript/reanimated2/js-reanimated/JSReanimated.d.ts +2 -2
  356. package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +2 -1
  357. package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.d.ts +2 -2
  358. package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.d.ts +2 -2
  359. package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
  360. package/lib/typescript/reanimated2/screenTransition/RNScreensTurboModule.d.ts +2 -0
  361. package/lib/typescript/reanimated2/screenTransition/animationManager.d.ts +3 -0
  362. package/lib/typescript/reanimated2/screenTransition/commonTypes.d.ts +38 -0
  363. package/lib/typescript/reanimated2/screenTransition/index.d.ts +3 -0
  364. package/lib/typescript/reanimated2/screenTransition/presets.d.ts +11 -0
  365. package/lib/typescript/reanimated2/screenTransition/styleUpdater.d.ts +3 -0
  366. package/lib/typescript/reanimated2/screenTransition/swipeSimulator.d.ts +2 -0
  367. package/lib/typescript/specs/NativeReanimatedModule.d.ts +6 -0
  368. package/package.json +29 -17
  369. package/plugin/build/plugin.js +7 -2
  370. package/src/ConfigHelper.ts +1 -1
  371. package/src/animationBuilder.tsx +2 -0
  372. package/src/createAnimatedComponent/InlinePropManager.ts +2 -2
  373. package/src/createAnimatedComponent/JSPropsUpdater.ts +7 -6
  374. package/src/createAnimatedComponent/JSPropsUpdater.web.ts +26 -0
  375. package/src/createAnimatedComponent/PropsFilter.tsx +31 -6
  376. package/src/createAnimatedComponent/createAnimatedComponent.tsx +108 -60
  377. package/src/createAnimatedComponent/getViewInfo.ts +39 -0
  378. package/src/mock.ts +13 -1
  379. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +33 -35
  380. package/src/reanimated2/PlatformChecker.ts +3 -2
  381. package/src/reanimated2/PropsRegistry.ts +1 -3
  382. package/src/reanimated2/UpdateLayoutAnimations.ts +53 -13
  383. package/src/reanimated2/WorkletEventHandler.ts +98 -39
  384. package/src/reanimated2/animation/styleAnimation.ts +8 -6
  385. package/src/reanimated2/animation/timing.ts +9 -1
  386. package/src/reanimated2/animation/util.ts +28 -3
  387. package/src/reanimated2/commonTypes.ts +4 -1
  388. package/src/reanimated2/component/PerformanceMonitor.tsx +216 -0
  389. package/src/reanimated2/core.ts +9 -31
  390. package/src/reanimated2/errors.ts +1 -0
  391. package/src/reanimated2/fabricUtils.ts +43 -18
  392. package/src/reanimated2/globals.d.ts +11 -1
  393. package/src/reanimated2/hook/commonTypes.ts +10 -0
  394. package/src/reanimated2/hook/useAnimatedRef.ts +20 -11
  395. package/src/reanimated2/hook/useEvent.ts +4 -4
  396. package/src/reanimated2/hook/useScrollViewOffset.ts +94 -23
  397. package/src/reanimated2/index.ts +11 -0
  398. package/src/reanimated2/js-reanimated/JSReanimated.ts +7 -7
  399. package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +4 -0
  400. package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +9 -1
  401. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +9 -1
  402. package/src/reanimated2/layoutReanimation/animationsManager.ts +10 -2
  403. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +13 -0
  404. package/src/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts +17 -8
  405. package/src/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.ts +26 -7
  406. package/src/reanimated2/layoutReanimation/web/animationsManager.ts +1 -1
  407. package/src/reanimated2/layoutReanimation/web/componentStyle.ts +3 -1
  408. package/src/reanimated2/layoutReanimation/web/componentUtils.ts +1 -1
  409. package/src/reanimated2/layoutReanimation/web/createAnimation.ts +2 -2
  410. package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
  411. package/src/reanimated2/platformFunctions/getRelativeCoords.ts +2 -2
  412. package/src/reanimated2/screenTransition/RNScreensTurboModule.ts +29 -0
  413. package/src/reanimated2/screenTransition/animationManager.ts +45 -0
  414. package/src/reanimated2/screenTransition/commonTypes.ts +63 -0
  415. package/src/reanimated2/screenTransition/index.ts +12 -0
  416. package/src/reanimated2/screenTransition/presets.ts +137 -0
  417. package/src/reanimated2/screenTransition/styleUpdater.ts +73 -0
  418. package/src/reanimated2/screenTransition/swipeSimulator.ts +238 -0
  419. package/src/reanimated2/shareables.ts +29 -6
  420. package/src/reanimated2/valueUnpacker.ts +10 -3
  421. package/src/specs/NativeReanimatedModule.ts +9 -0
  422. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +0 -16
  423. package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +0 -12
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ function noopFactory(defaultReturnValue) {
4
+ return () => {
5
+ 'worklet';
6
+
7
+ console.warn('[Reanimated] RNScreensTurboModule has not been found. Check that you have installed `react-native-screens@3.30.0` or newer in your project and rebuilt your app.');
8
+ return defaultReturnValue;
9
+ };
10
+ }
11
+ export const RNScreensTurboModule = global.RNScreensTurboModule || {
12
+ startTransition: noopFactory({
13
+ topScreenId: -1,
14
+ belowTopScreenId: -1,
15
+ canStartTransition: false
16
+ }),
17
+ updateTransition: noopFactory(),
18
+ finishTransition: noopFactory()
19
+ };
20
+ //# sourceMappingURL=RNScreensTurboModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["noopFactory","defaultReturnValue","console","warn","RNScreensTurboModule","global","startTransition","topScreenId","belowTopScreenId","canStartTransition","updateTransition","finishTransition"],"sources":["RNScreensTurboModule.ts"],"sourcesContent":["'use strict';\nimport type { RNScreensTurboModuleType } from './commonTypes';\n\nfunction noopFactory<T>(defaultReturnValue?: T): () => T {\n return () => {\n 'worklet';\n console.warn(\n '[Reanimated] RNScreensTurboModule has not been found. Check that you have installed `react-native-screens@3.30.0` or newer in your project and rebuilt your app.'\n );\n return defaultReturnValue as T;\n };\n}\n\ntype TransactionConfig = {\n topScreenId: number;\n belowTopScreenId: number;\n canStartTransition: boolean;\n};\n\nexport const RNScreensTurboModule: RNScreensTurboModuleType =\n global.RNScreensTurboModule || {\n startTransition: noopFactory<TransactionConfig>({\n topScreenId: -1,\n belowTopScreenId: -1,\n canStartTransition: false,\n }),\n updateTransition: noopFactory(),\n finishTransition: noopFactory(),\n };\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,WAAWA,CAAIC,kBAAsB,EAAW;EACvD,OAAO,MAAM;IACX,SAAS;;IACTC,OAAO,CAACC,IAAI,CACV,kKACF,CAAC;IACD,OAAOF,kBAAkB;EAC3B,CAAC;AACH;AAQA,OAAO,MAAMG,oBAA8C,GACzDC,MAAM,CAACD,oBAAoB,IAAI;EAC7BE,eAAe,EAAEN,WAAW,CAAoB;IAC9CO,WAAW,EAAE,CAAC,CAAC;IACfC,gBAAgB,EAAE,CAAC,CAAC;IACpBC,kBAAkB,EAAE;EACtB,CAAC,CAAC;EACFC,gBAAgB,EAAEV,WAAW,CAAC,CAAC;EAC/BW,gBAAgB,EAAEX,WAAW,CAAC;AAChC,CAAC","ignoreList":[]}
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ import { configureProps } from '../../ConfigHelper';
4
+ import { applyStyle } from './styleUpdater';
5
+ import { getSwipeSimulator } from './swipeSimulator';
6
+ configureProps();
7
+ export function startScreenTransition(screenTransitionConfig) {
8
+ 'worklet';
9
+
10
+ const {
11
+ stackTag,
12
+ sharedEvent
13
+ } = screenTransitionConfig;
14
+ sharedEvent.addListener(stackTag, () => {
15
+ applyStyle(screenTransitionConfig, sharedEvent.value);
16
+ });
17
+ }
18
+ function getLockAxis(goBackGesture) {
19
+ 'worklet';
20
+
21
+ if (['swipeRight', 'swipeLeft', 'horizontalSwipe'].includes(goBackGesture)) {
22
+ return 'x';
23
+ } else if (['swipeUp', 'swipeDown', 'verticalSwipe'].includes(goBackGesture)) {
24
+ return 'y';
25
+ }
26
+ return undefined;
27
+ }
28
+ export function finishScreenTransition(screenTransitionConfig) {
29
+ 'worklet';
30
+
31
+ const {
32
+ stackTag,
33
+ sharedEvent,
34
+ goBackGesture
35
+ } = screenTransitionConfig;
36
+ sharedEvent.removeListener(stackTag);
37
+ const lockAxis = getLockAxis(goBackGesture);
38
+ const step = getSwipeSimulator(sharedEvent.value, screenTransitionConfig, lockAxis);
39
+ step();
40
+ }
41
+ //# sourceMappingURL=animationManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["configureProps","applyStyle","getSwipeSimulator","startScreenTransition","screenTransitionConfig","stackTag","sharedEvent","addListener","value","getLockAxis","goBackGesture","includes","undefined","finishScreenTransition","removeListener","lockAxis","step"],"sources":["animationManager.ts"],"sourcesContent":["'use strict';\n\nimport type { LockAxis, ScreenTransitionConfig } from './commonTypes';\nimport { configureProps } from '../../ConfigHelper';\nimport { applyStyle } from './styleUpdater';\nimport { getSwipeSimulator } from './swipeSimulator';\n\nconfigureProps();\n\nexport function startScreenTransition(\n screenTransitionConfig: ScreenTransitionConfig\n) {\n 'worklet';\n const { stackTag, sharedEvent } = screenTransitionConfig;\n sharedEvent.addListener(stackTag, () => {\n applyStyle(screenTransitionConfig, sharedEvent.value);\n });\n}\n\nfunction getLockAxis(goBackGesture: string): LockAxis {\n 'worklet';\n if (['swipeRight', 'swipeLeft', 'horizontalSwipe'].includes(goBackGesture)) {\n return 'x';\n } else if (\n ['swipeUp', 'swipeDown', 'verticalSwipe'].includes(goBackGesture)\n ) {\n return 'y';\n }\n return undefined;\n}\n\nexport function finishScreenTransition(\n screenTransitionConfig: ScreenTransitionConfig\n) {\n 'worklet';\n const { stackTag, sharedEvent, goBackGesture } = screenTransitionConfig;\n sharedEvent.removeListener(stackTag);\n const lockAxis = getLockAxis(goBackGesture);\n const step = getSwipeSimulator(\n sharedEvent.value,\n screenTransitionConfig,\n lockAxis\n );\n step();\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,cAAc,QAAQ,oBAAoB;AACnD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,iBAAiB,QAAQ,kBAAkB;AAEpDF,cAAc,CAAC,CAAC;AAEhB,OAAO,SAASG,qBAAqBA,CACnCC,sBAA8C,EAC9C;EACA,SAAS;;EACT,MAAM;IAAEC,QAAQ;IAAEC;EAAY,CAAC,GAAGF,sBAAsB;EACxDE,WAAW,CAACC,WAAW,CAACF,QAAQ,EAAE,MAAM;IACtCJ,UAAU,CAACG,sBAAsB,EAAEE,WAAW,CAACE,KAAK,CAAC;EACvD,CAAC,CAAC;AACJ;AAEA,SAASC,WAAWA,CAACC,aAAqB,EAAY;EACpD,SAAS;;EACT,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAACC,QAAQ,CAACD,aAAa,CAAC,EAAE;IAC1E,OAAO,GAAG;EACZ,CAAC,MAAM,IACL,CAAC,SAAS,EAAE,WAAW,EAAE,eAAe,CAAC,CAACC,QAAQ,CAACD,aAAa,CAAC,EACjE;IACA,OAAO,GAAG;EACZ;EACA,OAAOE,SAAS;AAClB;AAEA,OAAO,SAASC,sBAAsBA,CACpCT,sBAA8C,EAC9C;EACA,SAAS;;EACT,MAAM;IAAEC,QAAQ;IAAEC,WAAW;IAAEI;EAAc,CAAC,GAAGN,sBAAsB;EACvEE,WAAW,CAACQ,cAAc,CAACT,QAAQ,CAAC;EACpC,MAAMU,QAAQ,GAAGN,WAAW,CAACC,aAAa,CAAC;EAC3C,MAAMM,IAAI,GAAGd,iBAAiB,CAC5BI,WAAW,CAACE,KAAK,EACjBJ,sBAAsB,EACtBW,QACF,CAAC;EACDC,IAAI,CAAC,CAAC;AACR","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ export {};
4
+ //# sourceMappingURL=commonTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\n\nimport type {\n MeasuredDimensions,\n ShadowNodeWrapper,\n SharedValue,\n} from '../commonTypes';\n\nexport type PanGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n translationX: number;\n translationY: number;\n velocityX: number;\n velocityY: number;\n};\n\nexport type AnimatedScreenTransition = {\n topScreenStyle: (\n event: PanGestureHandlerEventPayload,\n screenDimensions: MeasuredDimensions\n ) => Record<string, unknown>;\n belowTopScreenStyle: (\n event: PanGestureHandlerEventPayload,\n screenDimensions: MeasuredDimensions\n ) => Record<string, unknown>;\n};\n\nexport type GoBackGesture =\n | 'swipeRight'\n | 'swipeLeft'\n | 'swipeUp'\n | 'swipeDown'\n | 'verticalSwipe'\n | 'horizontalSwipe'\n | 'twoDimensionalSwipe';\n\nexport type ScreenTransitionConfig = {\n stackTag: number;\n belowTopScreenId: number | ShadowNodeWrapper;\n topScreenId: number | ShadowNodeWrapper;\n screenTransition: AnimatedScreenTransition;\n sharedEvent: SharedValue<PanGestureHandlerEventPayload>;\n startingGesturePosition: SharedValue<PanGestureHandlerEventPayload>;\n onFinishAnimation?: () => void;\n isTransitionCanceled: boolean;\n goBackGesture: GoBackGesture;\n screenDimensions: MeasuredDimensions;\n};\n\nexport type RNScreensTurboModuleType = {\n startTransition: (stackTag: number) => {\n topScreenId: number | ShadowNodeWrapper;\n belowTopScreenId: number | ShadowNodeWrapper;\n canStartTransition: boolean;\n };\n updateTransition: (stackTag: number, progress: number) => void;\n finishTransition: (stackTag: number, isCanceled: boolean) => void;\n};\n\nexport type LockAxis = 'x' | 'y' | undefined;\n"],"mappings":"AAAA,YAAY;;AAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ export { startScreenTransition, finishScreenTransition } from './animationManager';
4
+ export { ScreenTransition } from './presets';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["startScreenTransition","finishScreenTransition","ScreenTransition"],"sources":["index.ts"],"sourcesContent":["'use strict';\n\nexport {\n startScreenTransition,\n finishScreenTransition,\n} from './animationManager';\nexport { ScreenTransition } from './presets';\nexport type {\n AnimatedScreenTransition,\n GoBackGesture,\n ScreenTransitionConfig,\n} from './commonTypes';\n"],"mappings":"AAAA,YAAY;;AAEZ,SACEA,qBAAqB,EACrBC,sBAAsB,QACjB,oBAAoB;AAC3B,SAASC,gBAAgB,QAAQ,WAAW","ignoreList":[]}
@@ -0,0 +1,157 @@
1
+ 'use strict';
2
+
3
+ const SwipeRight = {
4
+ topScreenStyle: event => {
5
+ 'worklet';
6
+
7
+ return {
8
+ transform: [{
9
+ translateX: event.translationX
10
+ }]
11
+ };
12
+ },
13
+ belowTopScreenStyle: (event, screenSize) => {
14
+ 'worklet';
15
+
16
+ return {
17
+ transform: [{
18
+ translateX: (event.translationX - screenSize.width) * 0.3
19
+ }]
20
+ };
21
+ }
22
+ };
23
+ const SwipeLeft = {
24
+ topScreenStyle: event => {
25
+ 'worklet';
26
+
27
+ return {
28
+ transform: [{
29
+ translateX: event.translationX
30
+ }]
31
+ };
32
+ },
33
+ belowTopScreenStyle: (event, screenSize) => {
34
+ 'worklet';
35
+
36
+ return {
37
+ transform: [{
38
+ translateX: (event.translationX + screenSize.width) * 0.3
39
+ }]
40
+ };
41
+ }
42
+ };
43
+ const SwipeDown = {
44
+ topScreenStyle: event => {
45
+ 'worklet';
46
+
47
+ return {
48
+ transform: [{
49
+ translateY: event.translationY
50
+ }]
51
+ };
52
+ },
53
+ belowTopScreenStyle: (event, screenSize) => {
54
+ 'worklet';
55
+
56
+ return {
57
+ transform: [{
58
+ translateY: (event.translationY - screenSize.height) * 0.3
59
+ }]
60
+ };
61
+ }
62
+ };
63
+ const SwipeUp = {
64
+ topScreenStyle: event => {
65
+ 'worklet';
66
+
67
+ return {
68
+ transform: [{
69
+ translateY: event.translationY
70
+ }]
71
+ };
72
+ },
73
+ belowTopScreenStyle: (event, screenSize) => {
74
+ 'worklet';
75
+
76
+ return {
77
+ transform: [{
78
+ translateY: (event.translationY + screenSize.height) * 0.3
79
+ }]
80
+ };
81
+ }
82
+ };
83
+ const TwoDimensional = {
84
+ topScreenStyle: (event, _screenSize) => {
85
+ 'worklet';
86
+
87
+ return {
88
+ transform: [{
89
+ translateX: event.translationX
90
+ }, {
91
+ translateY: event.translationY
92
+ }]
93
+ };
94
+ },
95
+ belowTopScreenStyle: (_event, _screenSize) => {
96
+ 'worklet';
97
+
98
+ return {};
99
+ }
100
+ };
101
+ const Horizontal = {
102
+ topScreenStyle: (event, _screenSize) => {
103
+ 'worklet';
104
+
105
+ return {
106
+ transform: [{
107
+ translateX: event.translationX
108
+ }]
109
+ };
110
+ },
111
+ belowTopScreenStyle: (_event, _screenSize) => {
112
+ 'worklet';
113
+
114
+ return {};
115
+ }
116
+ };
117
+ const Vertical = {
118
+ topScreenStyle: (event, _screenSize) => {
119
+ 'worklet';
120
+
121
+ return {
122
+ transform: [{
123
+ translateY: event.translationY
124
+ }]
125
+ };
126
+ },
127
+ belowTopScreenStyle: (_event, _screenSize) => {
128
+ 'worklet';
129
+
130
+ return {};
131
+ }
132
+ };
133
+ const SwipeRightFade = {
134
+ topScreenStyle: (event, screenSize) => {
135
+ 'worklet';
136
+
137
+ return {
138
+ opacity: 1 - Math.abs(event.translationX / screenSize.width)
139
+ };
140
+ },
141
+ belowTopScreenStyle: (_event, _screenSize) => {
142
+ 'worklet';
143
+
144
+ return {};
145
+ }
146
+ };
147
+ export const ScreenTransition = {
148
+ SwipeRight,
149
+ SwipeLeft,
150
+ SwipeDown,
151
+ SwipeUp,
152
+ Horizontal,
153
+ Vertical,
154
+ TwoDimensional,
155
+ SwipeRightFade
156
+ };
157
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SwipeRight","topScreenStyle","event","transform","translateX","translationX","belowTopScreenStyle","screenSize","width","SwipeLeft","SwipeDown","translateY","translationY","height","SwipeUp","TwoDimensional","_screenSize","_event","Horizontal","Vertical","SwipeRightFade","opacity","Math","abs","ScreenTransition"],"sources":["presets.ts"],"sourcesContent":["'use strict';\n\nimport type { AnimatedScreenTransition } from './commonTypes';\n\nconst SwipeRight: AnimatedScreenTransition = {\n topScreenStyle: (event) => {\n 'worklet';\n return {\n transform: [{ translateX: event.translationX }],\n };\n },\n belowTopScreenStyle: (event, screenSize) => {\n 'worklet';\n return {\n transform: [\n { translateX: (event.translationX - screenSize.width) * 0.3 },\n ],\n };\n },\n};\n\nconst SwipeLeft: AnimatedScreenTransition = {\n topScreenStyle: (event) => {\n 'worklet';\n return {\n transform: [{ translateX: event.translationX }],\n };\n },\n belowTopScreenStyle: (event, screenSize) => {\n 'worklet';\n return {\n transform: [\n { translateX: (event.translationX + screenSize.width) * 0.3 },\n ],\n };\n },\n};\n\nconst SwipeDown: AnimatedScreenTransition = {\n topScreenStyle: (event) => {\n 'worklet';\n return {\n transform: [{ translateY: event.translationY }],\n };\n },\n belowTopScreenStyle: (event, screenSize) => {\n 'worklet';\n return {\n transform: [\n { translateY: (event.translationY - screenSize.height) * 0.3 },\n ],\n };\n },\n};\n\nconst SwipeUp: AnimatedScreenTransition = {\n topScreenStyle: (event) => {\n 'worklet';\n return {\n transform: [{ translateY: event.translationY }],\n };\n },\n belowTopScreenStyle: (event, screenSize) => {\n 'worklet';\n return {\n transform: [\n { translateY: (event.translationY + screenSize.height) * 0.3 },\n ],\n };\n },\n};\n\nconst TwoDimensional: AnimatedScreenTransition = {\n topScreenStyle: (event, _screenSize) => {\n 'worklet';\n return {\n transform: [\n { translateX: event.translationX },\n { translateY: event.translationY },\n ],\n };\n },\n belowTopScreenStyle: (_event, _screenSize) => {\n 'worklet';\n return {};\n },\n};\n\nconst Horizontal: AnimatedScreenTransition = {\n topScreenStyle: (event, _screenSize) => {\n 'worklet';\n return {\n transform: [{ translateX: event.translationX }],\n };\n },\n belowTopScreenStyle: (_event, _screenSize) => {\n 'worklet';\n return {};\n },\n};\n\nconst Vertical: AnimatedScreenTransition = {\n topScreenStyle: (event, _screenSize) => {\n 'worklet';\n return {\n transform: [{ translateY: event.translationY }],\n };\n },\n belowTopScreenStyle: (_event, _screenSize) => {\n 'worklet';\n return {};\n },\n};\n\nconst SwipeRightFade: AnimatedScreenTransition = {\n topScreenStyle: (event, screenSize) => {\n 'worklet';\n return {\n opacity: 1 - Math.abs(event.translationX / screenSize.width),\n };\n },\n belowTopScreenStyle: (_event, _screenSize) => {\n 'worklet';\n return {};\n },\n};\n\nexport const ScreenTransition = {\n SwipeRight,\n SwipeLeft,\n SwipeDown,\n SwipeUp,\n Horizontal,\n Vertical,\n TwoDimensional,\n SwipeRightFade,\n};\n"],"mappings":"AAAA,YAAY;;AAIZ,MAAMA,UAAoC,GAAG;EAC3CC,cAAc,EAAGC,KAAK,IAAK;IACzB,SAAS;;IACT,OAAO;MACLC,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAEF,KAAK,CAACG;MAAa,CAAC;IAChD,CAAC;EACH,CAAC;EACDC,mBAAmB,EAAEA,CAACJ,KAAK,EAAEK,UAAU,KAAK;IAC1C,SAAS;;IACT,OAAO;MACLJ,SAAS,EAAE,CACT;QAAEC,UAAU,EAAE,CAACF,KAAK,CAACG,YAAY,GAAGE,UAAU,CAACC,KAAK,IAAI;MAAI,CAAC;IAEjE,CAAC;EACH;AACF,CAAC;AAED,MAAMC,SAAmC,GAAG;EAC1CR,cAAc,EAAGC,KAAK,IAAK;IACzB,SAAS;;IACT,OAAO;MACLC,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAEF,KAAK,CAACG;MAAa,CAAC;IAChD,CAAC;EACH,CAAC;EACDC,mBAAmB,EAAEA,CAACJ,KAAK,EAAEK,UAAU,KAAK;IAC1C,SAAS;;IACT,OAAO;MACLJ,SAAS,EAAE,CACT;QAAEC,UAAU,EAAE,CAACF,KAAK,CAACG,YAAY,GAAGE,UAAU,CAACC,KAAK,IAAI;MAAI,CAAC;IAEjE,CAAC;EACH;AACF,CAAC;AAED,MAAME,SAAmC,GAAG;EAC1CT,cAAc,EAAGC,KAAK,IAAK;IACzB,SAAS;;IACT,OAAO;MACLC,SAAS,EAAE,CAAC;QAAEQ,UAAU,EAAET,KAAK,CAACU;MAAa,CAAC;IAChD,CAAC;EACH,CAAC;EACDN,mBAAmB,EA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F,CAAC;AAED,MAAMG,QAAkC,GAAG;EACzClB,cAAc,EAAEA,CAACC,KAAK,EAAEc,WAAW,KAAK;IACtC,SAAS;;IACT,OAAO;MACLb,SAAS,EAAE,CAAC;QAAEQ,UAAU,EAAET,KAAK,CAACU;MAAa,CAAC;IAChD,CAAC;EACH,CAAC;EACDN,mBAAmB,EAAEA,CAACW,MAAM,EAAED,WAAW,KAAK;IAC5C,SAAS;;IACT,OAAO,CAAC,CAAC;EACX;AACF,CAAC;AAED,MAAMI,cAAwC,GAAG;EAC/CnB,cAAc,EAAEA,CAACC,KAAK,EAAEK,UAAU,KAAK;IACrC,SAAS;;IACT,OAAO;MACLc,OAAO,EAAE,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACrB,KAAK,CAACG,YAAY,GAAGE,UAAU,CAACC,KAAK;IAC7D,CAAC;EACH,CAAC;EACDF,mBAAmB,EAAEA,CAACW,MAAM,EAAED,WAAW,KAAK;IAC5C,SAAS;;IACT,OAAO,CAAC,CAAC;EACX;AACF,CAAC;AAED,OAAO,MAAMQ,gBAAgB,GAAG;EAC9BxB,UAAU;EACVS,SAAS;EACTC,SAAS;EACTI,OAAO;EACPI,UAAU;EACVC,QAAQ;EACRJ,cAAc;EACdK;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ import { isFabric } from '../PlatformChecker';
4
+ import updateProps from '../UpdateProps';
5
+ const IS_FABRIC = isFabric();
6
+ function createViewDescriptorPaper(screenId) {
7
+ 'worklet';
8
+
9
+ return {
10
+ tag: screenId,
11
+ name: 'RCTView'
12
+ };
13
+ }
14
+ function createViewDescriptorFabric(screenId) {
15
+ 'worklet';
16
+
17
+ return {
18
+ shadowNodeWrapper: screenId
19
+ };
20
+ }
21
+ const createViewDescriptor = IS_FABRIC ? createViewDescriptorFabric : createViewDescriptorPaper;
22
+ function applyStyleForTopScreen(screenTransitionConfig, event) {
23
+ 'worklet';
24
+
25
+ const {
26
+ screenDimensions,
27
+ topScreenId,
28
+ screenTransition
29
+ } = screenTransitionConfig;
30
+ const {
31
+ topScreenStyle: computeTopScreenStyle
32
+ } = screenTransition;
33
+ const topScreenStyle = computeTopScreenStyle(event, screenDimensions);
34
+ const topScreenDescriptor = {
35
+ value: [createViewDescriptor(topScreenId)]
36
+ };
37
+ updateProps(topScreenDescriptor, topScreenStyle, undefined);
38
+ }
39
+ export function applyStyleForBelowTopScreen(screenTransitionConfig, event) {
40
+ 'worklet';
41
+
42
+ const {
43
+ screenDimensions,
44
+ belowTopScreenId,
45
+ screenTransition
46
+ } = screenTransitionConfig;
47
+ const {
48
+ belowTopScreenStyle: computeBelowTopScreenStyle
49
+ } = screenTransition;
50
+ const belowTopScreenStyle = computeBelowTopScreenStyle(event, screenDimensions);
51
+ const belowTopScreenDescriptor = {
52
+ value: [createViewDescriptor(belowTopScreenId)]
53
+ };
54
+ updateProps(belowTopScreenDescriptor, belowTopScreenStyle, undefined);
55
+ }
56
+ export function applyStyle(screenTransitionConfig, event) {
57
+ 'worklet';
58
+
59
+ applyStyleForTopScreen(screenTransitionConfig, event);
60
+ applyStyleForBelowTopScreen(screenTransitionConfig, event);
61
+ }
62
+ //# sourceMappingURL=styleUpdater.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isFabric","updateProps","IS_FABRIC","createViewDescriptorPaper","screenId","tag","name","createViewDescriptorFabric","shadowNodeWrapper","createViewDescriptor","applyStyleForTopScreen","screenTransitionConfig","event","screenDimensions","topScreenId","screenTransition","topScreenStyle","computeTopScreenStyle","topScreenDescriptor","value","undefined","applyStyleForBelowTopScreen","belowTopScreenId","belowTopScreenStyle","computeBelowTopScreenStyle","belowTopScreenDescriptor","applyStyle"],"sources":["styleUpdater.ts"],"sourcesContent":["'use strict';\nimport { isFabric } from '../PlatformChecker';\nimport updateProps from '../UpdateProps';\nimport type { ShadowNodeWrapper, SharedValue } from '../commonTypes';\nimport type { Descriptor } from '../hook/commonTypes';\nimport type {\n PanGestureHandlerEventPayload,\n ScreenTransitionConfig,\n} from './commonTypes';\n\nconst IS_FABRIC = isFabric();\n\nfunction createViewDescriptorPaper(screenId: number | ShadowNodeWrapper) {\n 'worklet';\n return { tag: screenId, name: 'RCTView' };\n}\nfunction createViewDescriptorFabric(screenId: number | ShadowNodeWrapper) {\n 'worklet';\n return { shadowNodeWrapper: screenId };\n}\nconst createViewDescriptor = IS_FABRIC\n ? createViewDescriptorFabric\n : createViewDescriptorPaper;\n\nfunction applyStyleForTopScreen(\n screenTransitionConfig: ScreenTransitionConfig,\n event: PanGestureHandlerEventPayload\n) {\n 'worklet';\n const { screenDimensions, topScreenId, screenTransition } =\n screenTransitionConfig;\n const { topScreenStyle: computeTopScreenStyle } = screenTransition;\n const topScreenStyle = computeTopScreenStyle(event, screenDimensions);\n const topScreenDescriptor = {\n value: [createViewDescriptor(topScreenId)],\n };\n updateProps(\n topScreenDescriptor as SharedValue<Descriptor[]>,\n topScreenStyle,\n undefined\n );\n}\n\nexport function applyStyleForBelowTopScreen(\n screenTransitionConfig: ScreenTransitionConfig,\n event: PanGestureHandlerEventPayload\n) {\n 'worklet';\n const { screenDimensions, belowTopScreenId, screenTransition } =\n screenTransitionConfig;\n const { belowTopScreenStyle: computeBelowTopScreenStyle } = screenTransition;\n const belowTopScreenStyle = computeBelowTopScreenStyle(\n event,\n screenDimensions\n );\n const belowTopScreenDescriptor = {\n value: [createViewDescriptor(belowTopScreenId)],\n };\n updateProps(\n belowTopScreenDescriptor as SharedValue<Descriptor[]>,\n belowTopScreenStyle,\n undefined\n );\n}\n\nexport function applyStyle(\n screenTransitionConfig: ScreenTransitionConfig,\n event: PanGestureHandlerEventPayload\n) {\n 'worklet';\n applyStyleForTopScreen(screenTransitionConfig, event);\n applyStyleForBelowTopScreen(screenTransitionConfig, event);\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,WAAW,MAAM,gBAAgB;AAQxC,MAAMC,SAAS,GAAGF,Q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AAUA,CACxBf,sBAA8C,EAC9CC,KAAoC,EACpC;EACA,SAAS;;EACTF,sBAAsB,CAACC,sBAAsB,EAAEC,KAAK,CAAC;EACrDS,2BAA2B,CAACV,sBAAsB,EAAEC,KAAK,CAAC;AAC5D","ignoreList":[]}
@@ -0,0 +1,190 @@
1
+ 'use strict';
2
+
3
+ import { applyStyle, applyStyleForBelowTopScreen } from './styleUpdater';
4
+ import { RNScreensTurboModule } from './RNScreensTurboModule';
5
+ const BASE_VELOCITY = 400;
6
+ const ADDITIONAL_VELOCITY_FACTOR_X = 400;
7
+ const ADDITIONAL_VELOCITY_FACTOR_Y = 500;
8
+ const ADDITIONAL_VELOCITY_FACTOR_XY = 600;
9
+ function computeEasingProgress(startingTimestamp, distance, velocity) {
10
+ 'worklet';
11
+
12
+ if (Math.abs(distance) < 1) {
13
+ return 1;
14
+ }
15
+ const elapsedTime = (_getAnimationTimestamp() - startingTimestamp) / 1000;
16
+ const currentPosition = velocity * elapsedTime;
17
+ const progress = currentPosition / distance;
18
+ return progress;
19
+ }
20
+ function easing(x) {
21
+ 'worklet';
22
+
23
+ // based on https://easings.net/#easeOutQuart
24
+ return 1 - Math.pow(1 - x, 5);
25
+ }
26
+ function computeProgress(screenTransitionConfig, event, isTransitionCanceled) {
27
+ 'worklet';
28
+
29
+ const screenDimensions = screenTransitionConfig.screenDimensions;
30
+ const progressX = Math.abs(event.translationX / screenDimensions.width);
31
+ const progressY = Math.abs(event.translationY / screenDimensions.height);
32
+ const maxProgress = Math.max(progressX, progressY);
33
+ const progress = isTransitionCanceled ? maxProgress / 2 : maxProgress;
34
+ return progress;
35
+ }
36
+ function maybeScheduleNextFrame(step, didScreenReachDestination, screenTransitionConfig, event, isTransitionCanceled) {
37
+ 'worklet';
38
+
39
+ if (!didScreenReachDestination) {
40
+ const stackTag = screenTransitionConfig.stackTag;
41
+ const progress = computeProgress(screenTransitionConfig, event, isTransitionCanceled);
42
+ RNScreensTurboModule.updateTransition(stackTag, progress);
43
+ requestAnimationFrame(step);
44
+ } else {
45
+ var _screenTransitionConf;
46
+ (_screenTransitionConf = screenTransitionConfig.onFinishAnimation) === null || _screenTransitionConf === void 0 || _screenTransitionConf.call(screenTransitionConfig);
47
+ }
48
+ }
49
+ export function getSwipeSimulator(event, screenTransitionConfig, lockAxis) {
50
+ 'worklet';
51
+
52
+ const screenDimensions = screenTransitionConfig.screenDimensions;
53
+ const startTimestamp = _getAnimationTimestamp();
54
+ const {
55
+ isTransitionCanceled
56
+ } = screenTransitionConfig;
57
+ const startingPosition = {
58
+ x: event.translationX,
59
+ y: event.translationY
60
+ };
61
+ const direction = {
62
+ x: Math.sign(event.translationX),
63
+ y: Math.sign(event.translationY)
64
+ };
65
+ const finalPosition = isTransitionCanceled ? {
66
+ x: 0,
67
+ y: 0
68
+ } : {
69
+ x: direction.x * screenDimensions.width,
70
+ y: direction.y * screenDimensions.height
71
+ };
72
+ const distance = {
73
+ x: Math.abs(finalPosition.x - startingPosition.x),
74
+ y: Math.abs(finalPosition.y - startingPosition.y)
75
+ };
76
+ const didScreenReachDestination = {
77
+ x: false,
78
+ y: false
79
+ };
80
+ const velocity = {
81
+ x: BASE_VELOCITY,
82
+ y: BASE_VELOCITY
83
+ };
84
+ if (lockAxis === 'x') {
85
+ velocity.y = 0;
86
+ velocity.x += ADDITIONAL_VELOCITY_FACTOR_X * distance.x / screenDimensions.width;
87
+ } else if (lockAxis === 'y') {
88
+ velocity.x = 0;
89
+ velocity.y += ADDITIONAL_VELOCITY_FACTOR_Y * distance.y / screenDimensions.height;
90
+ } else {
91
+ const euclideanDistance = Math.sqrt(distance.x ** 2 + distance.y ** 2);
92
+ const screenDiagonal = Math.sqrt(screenDimensions.width ** 2 + screenDimensions.height ** 2);
93
+ const velocityVectorLength = BASE_VELOCITY + ADDITIONAL_VELOCITY_FACTOR_XY * euclideanDistance / screenDiagonal;
94
+ if (Math.abs(startingPosition.x) > Math.abs(startingPosition.y)) {
95
+ velocity.x = velocityVectorLength;
96
+ velocity.y = velocityVectorLength * Math.abs(startingPosition.y / startingPosition.x);
97
+ } else {
98
+ velocity.x = velocityVectorLength * Math.abs(startingPosition.x / startingPosition.y);
99
+ velocity.y = velocityVectorLength;
100
+ }
101
+ }
102
+ if (isTransitionCanceled) {
103
+ function didScreenReachDestinationCheck() {
104
+ if (lockAxis === 'x') {
105
+ return didScreenReachDestination.x;
106
+ } else if (lockAxis === 'y') {
107
+ return didScreenReachDestination.y;
108
+ } else {
109
+ return didScreenReachDestination.x && didScreenReachDestination.y;
110
+ }
111
+ }
112
+ function restoreOriginalStyleForBelowTopScreen() {
113
+ event.translationX = direction.x * screenDimensions.width;
114
+ event.translationY = direction.y * screenDimensions.height;
115
+ applyStyleForBelowTopScreen(screenTransitionConfig, event);
116
+ }
117
+ const computeFrame = () => {
118
+ const progress = {
119
+ x: computeEasingProgress(startTimestamp, distance.x, velocity.x),
120
+ y: computeEasingProgress(startTimestamp, distance.y, velocity.y)
121
+ };
122
+ event.translationX = startingPosition.x - direction.x * distance.x * easing(progress.x);
123
+ event.translationY = startingPosition.y - direction.y * distance.y * easing(progress.y);
124
+ if (direction.x > 0) {
125
+ if (event.translationX <= 0) {
126
+ didScreenReachDestination.x = true;
127
+ event.translationX = 0;
128
+ }
129
+ } else {
130
+ if (event.translationX >= 0) {
131
+ didScreenReachDestination.x = true;
132
+ event.translationX = 0;
133
+ }
134
+ }
135
+ if (direction.y > 0) {
136
+ if (event.translationY <= 0) {
137
+ didScreenReachDestination.y = true;
138
+ event.translationY = 0;
139
+ }
140
+ } else {
141
+ if (event.translationY >= 0) {
142
+ didScreenReachDestination.y = true;
143
+ event.translationY = 0;
144
+ }
145
+ }
146
+ applyStyle(screenTransitionConfig, event);
147
+ const finished = didScreenReachDestinationCheck();
148
+ if (finished) {
149
+ restoreOriginalStyleForBelowTopScreen();
150
+ }
151
+ maybeScheduleNextFrame(computeFrame, finished, screenTransitionConfig, event, isTransitionCanceled);
152
+ };
153
+ return computeFrame;
154
+ } else {
155
+ const computeFrame = () => {
156
+ const progress = {
157
+ x: computeEasingProgress(startTimestamp, distance.x, velocity.x),
158
+ y: computeEasingProgress(startTimestamp, distance.y, velocity.y)
159
+ };
160
+ event.translationX = startingPosition.x + direction.x * distance.x * easing(progress.x);
161
+ event.translationY = startingPosition.y + direction.y * distance.y * easing(progress.y);
162
+ if (direction.x > 0) {
163
+ if (event.translationX >= screenDimensions.width) {
164
+ didScreenReachDestination.x = true;
165
+ event.translationX = screenDimensions.width;
166
+ }
167
+ } else {
168
+ if (event.translationX <= -screenDimensions.width) {
169
+ didScreenReachDestination.x = true;
170
+ event.translationX = -screenDimensions.width;
171
+ }
172
+ }
173
+ if (direction.y > 0) {
174
+ if (event.translationY >= screenDimensions.height) {
175
+ didScreenReachDestination.y = true;
176
+ event.translationY = screenDimensions.height;
177
+ }
178
+ } else {
179
+ if (event.translationY <= -screenDimensions.height) {
180
+ didScreenReachDestination.y = true;
181
+ event.translationY = -screenDimensions.height;
182
+ }
183
+ }
184
+ applyStyle(screenTransitionConfig, event);
185
+ maybeScheduleNextFrame(computeFrame, didScreenReachDestination.x || didScreenReachDestination.y, screenTransitionConfig, event, isTransitionCanceled);
186
+ };
187
+ return computeFrame;
188
+ }
189
+ }
190
+ //# sourceMappingURL=swipeSimulator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["applyStyle","applyStyleForBelowTopScreen","RNScreensTurboModule","BASE_VELOCITY","ADDITIONAL_VELOCITY_FACTOR_X","ADDITIONAL_VELOCITY_FACTOR_Y","ADDITIONAL_VELOCITY_FACTOR_XY","computeEasingProgress","startingTimestamp","distance","velocity","Math","abs","elapsedTime","_getAnimationTimestamp","currentPosition","progress","easing","x","pow","computeProgress","screenTransitionConfig","event","isTransitionCanceled","screenDimensions","progressX","translationX","width","progressY","translationY","height","maxProgress","max","maybeScheduleNextFrame","step","didScreenReachDestination","stackTag","updateTransition","requestAnimationFrame","_screenTransitionConf","onFinishAnimation","call","getSwipeSimulator","lockAxis","startTimestamp","startingPosition","y","direction","sign","finalPosition","euclideanDistance","sqrt","screenDiagonal","velocityVectorLength","didScreenReachDestinationCheck","restoreOriginalStyleForBelowTopScreen","computeFrame","finished"],"sources":["swipeSimulator.ts"],"sourcesContent":["'use strict';\nimport type {\n PanGestureHandlerEventPayload,\n ScreenTransitionConfig,\n LockAxis,\n} from './commonTypes';\nimport { applyStyle, applyStyleForBelowTopScreen } from './styleUpdater';\nimport { RNScreensTurboModule } from './RNScreensTurboModule';\n\nconst BASE_VELOCITY = 400;\nconst ADDITIONAL_VELOCITY_FACTOR_X = 400;\nconst ADDITIONAL_VELOCITY_FACTOR_Y = 500;\nconst ADDITIONAL_VELOCITY_FACTOR_XY = 600;\n\nfunction computeEasingProgress(\n startingTimestamp: number,\n distance: number,\n velocity: number\n) {\n 'worklet';\n if (Math.abs(distance) < 1) {\n return 1;\n }\n const elapsedTime = (_getAnimationTimestamp() - startingTimestamp) / 1000;\n const currentPosition = velocity * elapsedTime;\n const progress = currentPosition / distance;\n return progress;\n}\n\nfunction easing(x: number): number {\n 'worklet';\n // based on https://easings.net/#easeOutQuart\n return 1 - Math.pow(1 - x, 5);\n}\n\nfunction computeProgress(\n screenTransitionConfig: ScreenTransitionConfig,\n event: PanGestureHandlerEventPayload,\n isTransitionCanceled: boolean\n) {\n 'worklet';\n const screenDimensions = screenTransitionConfig.screenDimensions;\n const progressX = Math.abs(event.translationX / screenDimensions.width);\n const progressY = Math.abs(event.translationY / screenDimensions.height);\n const maxProgress = Math.max(progressX, progressY);\n const progress = isTransitionCanceled ? maxProgress / 2 : maxProgress;\n return progress;\n}\n\nfunction maybeScheduleNextFrame(\n step: () => void,\n didScreenReachDestination: boolean,\n screenTransitionConfig: ScreenTransitionConfig,\n event: PanGestureHandlerEventPayload,\n isTransitionCanceled: boolean\n) {\n 'worklet';\n if (!didScreenReachDestination) {\n const stackTag = screenTransitionConfig.stackTag;\n const progress = computeProgress(\n screenTransitionConfig,\n event,\n isTransitionCanceled\n );\n RNScreensTurboModule.updateTransition(stackTag, progress);\n requestAnimationFrame(step);\n } else {\n screenTransitionConfig.onFinishAnimation?.();\n }\n}\n\nexport function getSwipeSimulator(\n event: PanGestureHandlerEventPayload,\n screenTransitionConfig: ScreenTransitionConfig,\n lockAxis?: LockAxis\n) {\n 'worklet';\n const screenDimensions = screenTransitionConfig.screenDimensions;\n const startTimestamp = _getAnimationTimestamp();\n const { isTransitionCanceled } = screenTransitionConfig;\n const startingPosition = {\n x: event.translationX,\n y: event.translationY,\n };\n const direction = {\n x: Math.sign(event.translationX),\n y: Math.sign(event.translationY),\n };\n const finalPosition = isTransitionCanceled\n ? { x: 0, y: 0 }\n : {\n x: direction.x * screenDimensions.width,\n y: direction.y * screenDimensions.height,\n };\n const distance = {\n x: Math.abs(finalPosition.x - startingPosition.x),\n y: Math.abs(finalPosition.y - startingPosition.y),\n };\n const didScreenReachDestination = {\n x: false,\n y: false,\n };\n const velocity = { x: BASE_VELOCITY, y: BASE_VELOCITY };\n if (lockAxis === 'x') {\n velocity.y = 0;\n velocity.x +=\n (ADDITIONAL_VELOCITY_FACTOR_X * distance.x) / screenDimensions.width;\n } else if (lockAxis === 'y') {\n velocity.x = 0;\n velocity.y +=\n (ADDITIONAL_VELOCITY_FACTOR_Y * distance.y) / screenDimensions.height;\n } else {\n const euclideanDistance = Math.sqrt(distance.x ** 2 + distance.y ** 2);\n const screenDiagonal = Math.sqrt(\n screenDimensions.width ** 2 + screenDimensions.height ** 2\n );\n const velocityVectorLength =\n BASE_VELOCITY +\n (ADDITIONAL_VELOCITY_FACTOR_XY * euclideanDistance) / screenDiagonal;\n if (Math.abs(startingPosition.x) > Math.abs(startingPosition.y)) {\n velocity.x = velocityVectorLength;\n velocity.y =\n velocityVectorLength *\n Math.abs(startingPosition.y / startingPosition.x);\n } else {\n velocity.x =\n velocityVectorLength *\n Math.abs(startingPosition.x / startingPosition.y);\n velocity.y = velocityVectorLength;\n }\n }\n\n if (isTransitionCanceled) {\n function didScreenReachDestinationCheck() {\n if (lockAxis === 'x') {\n return didScreenReachDestination.x;\n } else if (lockAxis === 'y') {\n return didScreenReachDestination.y;\n } else {\n return didScreenReachDestination.x && didScreenReachDestination.y;\n }\n }\n\n function restoreOriginalStyleForBelowTopScreen() {\n event.translationX = direction.x * screenDimensions.width;\n event.translationY = direction.y * screenDimensions.height;\n applyStyleForBelowTopScreen(screenTransitionConfig, event);\n }\n\n const computeFrame = () => {\n const progress = {\n x: computeEasingProgress(startTimestamp, distance.x, velocity.x),\n y: computeEasingProgress(startTimestamp, distance.y, velocity.y),\n };\n event.translationX =\n startingPosition.x - direction.x * distance.x * easing(progress.x);\n event.translationY =\n startingPosition.y - direction.y * distance.y * easing(progress.y);\n if (direction.x > 0) {\n if (event.translationX <= 0) {\n didScreenReachDestination.x = true;\n event.translationX = 0;\n }\n } else {\n if (event.translationX >= 0) {\n didScreenReachDestination.x = true;\n event.translationX = 0;\n }\n }\n if (direction.y > 0) {\n if (event.translationY <= 0) {\n didScreenReachDestination.y = true;\n event.translationY = 0;\n }\n } else {\n if (event.translationY >= 0) {\n didScreenReachDestination.y = true;\n event.translationY = 0;\n }\n }\n applyStyle(screenTransitionConfig, event);\n const finished = didScreenReachDestinationCheck();\n if (finished) {\n restoreOriginalStyleForBelowTopScreen();\n }\n maybeScheduleNextFrame(\n computeFrame,\n finished,\n screenTransitionConfig,\n event,\n isTransitionCanceled\n );\n };\n return computeFrame;\n } else {\n const computeFrame = () => {\n const progress = {\n x: computeEasingProgress(startTimestamp, distance.x, velocity.x),\n y: computeEasingProgress(startTimestamp, distance.y, velocity.y),\n };\n event.translationX =\n startingPosition.x + direction.x * distance.x * easing(progress.x);\n event.translationY =\n startingPosition.y + direction.y * distance.y * easing(progress.y);\n if (direction.x > 0) {\n if (event.translationX >= screenDimensions.width) {\n didScreenReachDestination.x = true;\n event.translationX = screenDimensions.width;\n }\n } else {\n if (event.translationX <= -screenDimensions.width) {\n didScreenReachDestination.x = true;\n event.translationX = -screenDimensions.width;\n }\n }\n if (direction.y > 0) {\n if (event.translationY >= screenDimensions.height) {\n didScreenReachDestination.y = true;\n event.translationY = screenDimensions.height;\n }\n } else {\n if (event.translationY <= -screenDimensions.height) {\n didScreenReachDestination.y = true;\n event.translationY = -screenDimensions.height;\n }\n }\n applyStyle(screenTransitionConfig, event);\n maybeScheduleNextFrame(\n computeFrame,\n didScreenReachDestination.x || didScreenReachDestination.y,\n screenTransitionConfig,\n event,\n isTransitionCanceled\n );\n };\n return computeFrame;\n }\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,UAAU,EAAEC,2BAA2B,QAAQ,gBAAgB;AACxE,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAMC,aAAa,GAAG,GAAG;AACzB,MAAMC,4BAA4B,GAAG,GAAG;AACxC,MAAMC,4BAA4B,GAAG,GAAG;AACxC,MAAMC,6BAA6B,GAAG,GAAG;AAEzC,SAASC,qBAAqBA,CAC5BC,iBAAyB,EACzBC,QAAgB,EAChBC,QAAgB,EAChB;EACA,SAAS;;EACT,IAAIC,IAAI,CAACC,GAAG,CAACH,QAAQ,CAAC,GAAG,CAAC,EAAE;IAC1B,OAAO,CAAC;EACV;EACA,MAAMI,WAAW,GAAG,CAACC,sBAAsB,CAAC,CAAC,GAAGN,iBAAiB,IAAI,IAAI;EACzE,MAAMO,eAAe,GAAGL,QAAQ,GAAGG,WAAW;EAC9C,MAAMG,QAAQ,GAAGD,eAAe,GAAGN,QAAQ;EAC3C,OAAOO,QAAQ;AACjB;AAEA,SAASC,MAAMA,CAACC,CAAS,EAAU;EACjC,SAAS;;EACT;EACA,OAAO,CAAC,GAAGP,IAAI,CAACQ,GAAG,CAAC,CAAC,GAAGD,CAAC,EAAE,CAAC,CAAC;AAC/B;AAEA,SAASE,eAAeA,CACtBC,sBAA8C,EAC9CC,KAAoC,EACpCC,oBAA6B,EAC7B;EACA,SAAS;;EACT,MAAMC,gBAAgB,GAAGH,sBAAsB,CAACG,gBAAgB;EAChE,MAAMC,SAAS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AC,EAAE;QACnB,IAAII,KAAK,CAACI,YAAY,IAAIF,gBAAgB,CAACG,KAAK,EAAE;UAChDQ,yBAAyB,CAACjB,CAAC,GAAG,IAAI;UAClCI,KAAK,CAACI,YAAY,GAAGF,gBAAgB,CAACG,KAAK;QAC7C;MACF,CAAC,MAAM;QACL,IAAIL,KAAK,CAACI,YAAY,IAAI,CAACF,gBAAgB,CAACG,KAAK,EAAE;UACjDQ,yBAAyB,CAACjB,CAAC,GAAG,IAAI;UAClCI,KAAK,CAACI,YAAY,GAAG,CAACF,gBAAgB,CAACG,KAAK;QAC9C;MACF;MACA,IAAIoB,SAAS,CAACD,CAAC,GAAG,CAAC,EAAE;QACnB,IAAIxB,KAAK,CAACO,YAAY,IAAIL,gBAAgB,CAACM,MAAM,EAAE;UACjDK,yBAAyB,CAACW,CAAC,GAAG,IAAI;UAClCxB,KAAK,CAACO,YAAY,GAAGL,gBAAgB,CAACM,MAAM;QAC9C;MACF,CAAC,MAAM;QACL,IAAIR,KAAK,CAACO,YAAY,IAAI,CAACL,gBAAgB,CAACM,MAAM,EAAE;UAClDK,yBAAyB,CAACW,CAAC,GAAG,IAAI;UAClCxB,KAAK,CAACO,YAAY,GAAG,CAACL,gBAAgB,CAACM,MAAM;QAC/C;MACF;MACA9B,UAAU,CAACqB,sBAAsB,EAAEC,KAAK,CAAC;MACzCW,sBAAsB,CACpBuB,YAAY,EACZrB,yBAAyB,CAACjB,CAAC,IAAIiB,yBAAyB,CAACW,CAAC,EAC1DzB,sBAAsB,EACtBC,KAAK,EACLC,oBACF,CAAC;IACH,CAAC;IACD,OAAOiC,YAAY;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["shouldBeUseWeb","SHOULD_BE_USE_WEB","shareableMappingFlag","Symbol","cache","WeakMap","shareableMappingCache","set","get","shareable","shareableRef","bind"],"sources":["shareableMappingCache.ts"],"sourcesContent":["'use strict';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport type { ShareableRef } from './commonTypes';\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\n/**\n * This symbol is used to represent a mapping from the value to itself.\n *\n * It's used to prevent converting a shareable that's already converted -\n * for example a Shared Value that's in worklet's closure.\n **/\nexport const shareableMappingFlag = Symbol('shareable flag');\n\n/*\nDuring a fast refresh, React holds the same instance of a Mutable\n(that's guaranteed by `useRef`) but `shareableCache` gets regenerated and thus\nbecoming empty. This happens when editing the file that contains the definition of this cache.\n\nBecause of it, `makeShareableCloneRecursive` can't find given mapping\nin `shareableCache` for the Mutable and tries to clone it as if it was a regular JS object.\nDuring cloning we use `Object.entries` to iterate over the keys which throws an error on accessing `_value`.\nFor convenience we moved this cache to a separate file so it doesn't scare us with red squiggles.\n*/\n\nconst cache = SHOULD_BE_USE_WEB\n ? null\n : new WeakMap<object, ShareableRef | symbol>();\n\nexport const shareableMappingCache = SHOULD_BE_USE_WEB\n ? {\n set() {\n // NOOP\n },\n get() {\n return null;\n },\n }\n : {\n set(shareable: object, shareableRef?: ShareableRef): void {\n cache!.set(shareable, shareableRef || shareableMappingFlag);\n },\n get: cache!.get.bind(cache),\n };\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,cAAc,QAAQ,mBAAmB;AAGlD,MAAMC,iBAAiB,GAAGD,cAAc,EAAE;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,oBAAoB,GAAGC,MAAM,CAAC,gBAAgB,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,KAAK,GAAGH,iBAAiB,GAC3B,IAAI,GACJ,IAAII,OAAO,EAAiC;AAEhD,OAAO,MAAMC,qBAAqB,GAAGL,iBAAiB,GAClD;EACEM,GAAGA,CAAA,EAAG;IACJ;EAAA,CACD;EACDC,GAAGA,CAAA,EAAG;IACJ,OAAO,IAAI;EACb;AACF,CAAC,GACD;EACED,GAAGA,CAACE,SAAiB,EAAEC,YAA2B,EAAQ;IACxDN,KAAK,CAAEG,GAAG,CAACE,SAAS,EAAEC,YAAY,IAAIR,oBAAoB,CAAC;EAC7D,CAAC;EACDM,GAAG,EAAEJ,KAAK,CAAEI,GAAG,CAACG,IAAI,CAACP,KAAK;AAC5B,CAAC"}
1
+ {"version":3,"names":["shouldBeUseWeb","SHOULD_BE_USE_WEB","shareableMappingFlag","Symbol","cache","WeakMap","shareableMappingCache","set","get","shareable","shareableRef","bind"],"sources":["shareableMappingCache.ts"],"sourcesContent":["'use strict';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport type { ShareableRef } from './commonTypes';\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\n/**\n * This symbol is used to represent a mapping from the value to itself.\n *\n * It's used to prevent converting a shareable that's already converted -\n * for example a Shared Value that's in worklet's closure.\n **/\nexport const shareableMappingFlag = Symbol('shareable flag');\n\n/*\nDuring a fast refresh, React holds the same instance of a Mutable\n(that's guaranteed by `useRef`) but `shareableCache` gets regenerated and thus\nbecoming empty. This happens when editing the file that contains the definition of this cache.\n\nBecause of it, `makeShareableCloneRecursive` can't find given mapping\nin `shareableCache` for the Mutable and tries to clone it as if it was a regular JS object.\nDuring cloning we use `Object.entries` to iterate over the keys which throws an error on accessing `_value`.\nFor convenience we moved this cache to a separate file so it doesn't scare us with red squiggles.\n*/\n\nconst cache = SHOULD_BE_USE_WEB\n ? null\n : new WeakMap<object, ShareableRef | symbol>();\n\nexport const shareableMappingCache = SHOULD_BE_USE_WEB\n ? {\n set() {\n // NOOP\n },\n get() {\n return null;\n },\n }\n : {\n set(shareable: object, shareableRef?: ShareableRef): void {\n cache!.set(shareable, shareableRef || shareableMappingFlag);\n },\n get: cache!.get.bind(cache),\n };\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,cAAc,QAAQ,mBAAmB;AAGlD,MAAMC,iBAAiB,GAAGD,cAAc,CAAC,CAAC;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,oBAAoB,GAAGC,MAAM,CAAC,gBAAgB,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,KAAK,GAAGH,iBAAiB,GAC3B,IAAI,GACJ,IAAII,OAAO,CAAgC,CAAC;AAEhD,OAAO,MAAMC,qBAAqB,GAAGL,iBAAiB,GAClD;EACEM,GAAGA,CAAA,EAAG;IACJ;EAAA,CACD;EACDC,GAAGA,CAAA,EAAG;IACJ,OAAO,IAAI;EACb;AACF,CAAC,GACD;EACED,GAAGA,CAACE,SAAiB,EAAEC,YAA2B,EAAQ;IACxDN,KAAK,CAAEG,GAAG,CAACE,SAAS,EAAEC,YAAY,IAAIR,oBAAoB,CAAC;EAC7D,CAAC;EACDM,GAAG,EAAEJ,KAAK,CAAEI,GAAG,CAACG,IAAI,CAACP,KAAK;AAC5B,CAAC","ignoreList":[]}