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
@@ -18,6 +18,7 @@ import type { ProgressTransitionRegister } from './layoutReanimation/sharedTrans
18
18
  import type { UpdatePropsManager } from './UpdateProps';
19
19
  import type { callGuardDEV } from './initializers';
20
20
  import type { WorkletRuntime } from './runtimes';
21
+ import type { RNScreensTurboModuleType } from './screenTransition/commonTypes';
21
22
 
22
23
  declare global {
23
24
  var _REANIMATED_IS_REDUCED_MOTION: boolean | undefined;
@@ -39,7 +40,10 @@ declare global {
39
40
  ) => void;
40
41
  var _notifyAboutEnd: (tag: number, removeView: boolean) => void;
41
42
  var _setGestureState: (handlerTag: number, newState: number) => void;
42
- var _makeShareableClone: <T>(value: T) => FlatShareableRef<T>;
43
+ var _makeShareableClone: <T>(
44
+ value: T,
45
+ nativeStateSource?: object
46
+ ) => FlatShareableRef<T>;
43
47
  var _scheduleOnJS: (fun: (...args: A) => R, args?: A) => void;
44
48
  var _scheduleOnRuntime: (
45
49
  runtime: WorkletRuntime,
@@ -102,4 +106,10 @@ declare global {
102
106
  var UpdatePropsManager: UpdatePropsManager;
103
107
  var ProgressTransitionRegister: ProgressTransitionRegister;
104
108
  var updateJSProps: (viewTag: number, props: Record<string, unknown>) => void;
109
+ var RNScreensTurboModule: RNScreensTurboModuleType | undefined;
110
+ var _obtainPropPaper: (viewTag: number, propName: string) => string;
111
+ var _obtainPropFabric: (
112
+ shadowNodeWrapper: ShadowNodeWrapper,
113
+ propName: string
114
+ ) => string;
105
115
  }
@@ -30,6 +30,7 @@ export interface AnimatedRef<T extends Component> {
30
30
  | ShadowNodeWrapper // Fabric
31
31
  | HTMLElement; // web
32
32
  current: T | null;
33
+ getTag: () => number;
33
34
  }
34
35
 
35
36
  // Might make that type generic if it's ever needed.
@@ -78,6 +79,15 @@ export type RNNativeScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
78
79
 
79
80
  export type ReanimatedScrollEvent = ReanimatedEvent<RNNativeScrollEvent>;
80
81
 
82
+ export interface IWorkletEventHandler<Event extends object> {
83
+ updateEventHandler: (
84
+ newWorklet: (event: ReanimatedEvent<Event>) => void,
85
+ newEvents: string[]
86
+ ) => void;
87
+ registerForEvents: (viewTag: number, fallbackEventName?: string) => void;
88
+ unregisterFromEvents: (viewTag: number) => void;
89
+ }
90
+
81
91
  export interface AnimatedStyleHandle<
82
92
  Style extends DefaultStyle = DefaultStyle
83
93
  > {
@@ -11,7 +11,6 @@ import { Platform, findNodeHandle } from 'react-native';
11
11
  import type { ScrollView, FlatList } from 'react-native';
12
12
  import { isFabric, isWeb } from '../PlatformChecker';
13
13
 
14
- const IS_FABRIC = isFabric();
15
14
  const IS_WEB = isWeb();
16
15
 
17
16
  interface MaybeScrollableComponent extends Component {
@@ -25,18 +24,14 @@ interface MaybeScrollableComponent extends Component {
25
24
  }
26
25
 
27
26
  function getComponentOrScrollable(component: MaybeScrollableComponent) {
28
- if (IS_FABRIC && component.getNativeScrollRef) {
27
+ if (isFabric() && component.getNativeScrollRef) {
29
28
  return component.getNativeScrollRef();
30
- } else if (!IS_FABRIC && component.getScrollableNode) {
29
+ } else if (!isFabric() && component.getScrollableNode) {
31
30
  return component.getScrollableNode();
32
31
  }
33
32
  return component;
34
33
  }
35
34
 
36
- const getTagValueFunction = IS_FABRIC
37
- ? getShadowNodeWrapperFromRef
38
- : findNodeHandle;
39
-
40
35
  /**
41
36
  * Lets you get a reference of a view that you can use inside a worklet.
42
37
  *
@@ -57,12 +52,26 @@ export function useAnimatedRef<
57
52
  ) => {
58
53
  // enters when ref is set by attaching to a component
59
54
  if (component) {
60
- tag.value = IS_WEB
61
- ? getComponentOrScrollable(component)
62
- : getTagValueFunction(getComponentOrScrollable(component));
55
+ const getTagValueFunction = isFabric()
56
+ ? getShadowNodeWrapperFromRef
57
+ : findNodeHandle;
58
+
59
+ const getTagOrShadowNodeWrapper = () => {
60
+ return IS_WEB
61
+ ? getComponentOrScrollable(component)
62
+ : getTagValueFunction(getComponentOrScrollable(component));
63
+ };
64
+
65
+ tag.value = getTagOrShadowNodeWrapper();
66
+
67
+ // On Fabric we have to unwrap the tag from the shadow node wrapper
68
+ fun.getTag = isFabric()
69
+ ? () => findNodeHandle(getComponentOrScrollable(component))
70
+ : getTagOrShadowNodeWrapper;
71
+
63
72
  fun.current = component;
64
73
  // viewName is required only on iOS with Paper
65
- if (Platform.OS === 'ios' && !IS_FABRIC) {
74
+ if (Platform.OS === 'ios' && !isFabric()) {
66
75
  viewName.value =
67
76
  (component as MaybeScrollableComponent)?.viewConfig
68
77
  ?.uiViewClassName || 'RCTView';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  import { useRef } from 'react';
3
- import WorkletEventHandler from '../WorkletEventHandler';
4
- import type { ReanimatedEvent } from './commonTypes';
3
+ import { WorkletEventHandler } from '../WorkletEventHandler';
4
+ import type { IWorkletEventHandler, ReanimatedEvent } from './commonTypes';
5
5
 
6
6
  /**
7
7
  * Worklet to provide as an argument to `useEvent` hook.
@@ -17,7 +17,7 @@ export type EventHandlerProcessed<
17
17
  > = (event: Event, context?: Context) => void;
18
18
 
19
19
  export type EventHandlerInternal<Event extends object> = {
20
- workletEventHandler: WorkletEventHandler<Event>;
20
+ workletEventHandler: IWorkletEventHandler<Event>;
21
21
  };
22
22
 
23
23
  /**
@@ -57,7 +57,7 @@ export function useEvent<Event extends object, Context = never>(
57
57
  initRef.current = { workletEventHandler };
58
58
  } else if (rebuild) {
59
59
  const workletEventHandler = initRef.current.workletEventHandler;
60
- workletEventHandler.updateWorklet(handler);
60
+ workletEventHandler.updateEventHandler(handler, eventNames);
61
61
  initRef.current = { workletEventHandler };
62
62
  }
63
63
 
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
- import { useEffect, useRef } from 'react';
2
+ import { useEffect, useRef, useCallback } from 'react';
3
3
  import type { SharedValue } from '../commonTypes';
4
- import { findNodeHandle } from 'react-native';
5
4
  import type { EventHandlerInternal } from './useEvent';
6
5
  import { useEvent } from './useEvent';
7
6
  import { useSharedValue } from './useSharedValue';
@@ -15,14 +14,6 @@ import { isWeb } from '../PlatformChecker';
15
14
 
16
15
  const IS_WEB = isWeb();
17
16
 
18
- const scrollEventNames = [
19
- 'onScroll',
20
- 'onScrollBeginDrag',
21
- 'onScrollEndDrag',
22
- 'onMomentumScrollBegin',
23
- 'onMomentumScrollEnd',
24
- ];
25
-
26
17
  /**
27
18
  * Lets you synchronously get the current offset of a `ScrollView`.
28
19
  *
@@ -30,36 +21,99 @@ const scrollEventNames = [
30
21
  * @returns A shared value which holds the current offset of the `ScrollView`.
31
22
  * @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useScrollViewOffset
32
23
  */
33
- export function useScrollViewOffset(
24
+ export const useScrollViewOffset = IS_WEB
25
+ ? useScrollViewOffsetWeb
26
+ : useScrollViewOffsetNative;
27
+
28
+ function useScrollViewOffsetWeb(
34
29
  animatedRef: AnimatedRef<AnimatedScrollView>,
35
- initialRef?: SharedValue<number>
30
+ providedOffset?: SharedValue<number>
36
31
  ): SharedValue<number> {
37
- const offsetRef = useRef(
38
- // eslint-disable-next-line react-hooks/rules-of-hooks
39
- initialRef !== undefined ? initialRef : useSharedValue(0)
40
- );
32
+ const internalOffset = useSharedValue(0);
33
+ const offset = useRef(providedOffset ?? internalOffset).current;
34
+ const scrollRef = useRef<AnimatedScrollView | null>(null);
35
+
36
+ const eventHandler = useCallback(() => {
37
+ 'worklet';
38
+ const element = getWebScrollableElement(animatedRef.current);
39
+ // scrollLeft is the X axis scrolled offset, works properly also with RTL layout
40
+ offset.value =
41
+ element.scrollLeft === 0 ? element.scrollTop : element.scrollLeft;
42
+ // eslint-disable-next-line react-hooks/exhaustive-deps
43
+ }, [animatedRef, animatedRef.current]);
44
+
45
+ useEffect(() => {
46
+ // We need to make sure that listener for old animatedRef value is removed
47
+ if (scrollRef.current !== null) {
48
+ getWebScrollableElement(scrollRef.current).removeEventListener(
49
+ 'scroll',
50
+ eventHandler
51
+ );
52
+ }
53
+ scrollRef.current = animatedRef.current;
54
+
55
+ const element = getWebScrollableElement(animatedRef.current);
56
+ element.addEventListener('scroll', eventHandler);
57
+ return () => {
58
+ element.removeEventListener('scroll', eventHandler);
59
+ };
60
+ // React here has a problem with `animatedRef.current` since a Ref .current
61
+ // field shouldn't be used as a dependency. However, in this case we have
62
+ // to do it this way.
63
+ // eslint-disable-next-line react-hooks/exhaustive-deps
64
+ }, [animatedRef, animatedRef.current, eventHandler]);
65
+
66
+ return offset;
67
+ }
68
+
69
+ function useScrollViewOffsetNative(
70
+ animatedRef: AnimatedRef<AnimatedScrollView>,
71
+ providedOffset?: SharedValue<number>
72
+ ): SharedValue<number> {
73
+ const internalOffset = useSharedValue(0);
74
+ const offset = useRef(providedOffset ?? internalOffset).current;
75
+ const scrollRef = useRef<AnimatedScrollView | null>(null);
76
+ const scrollRefTag = useRef<number | null>(null);
41
77
 
42
78
  const eventHandler = useEvent<RNNativeScrollEvent>(
43
79
  (event: ReanimatedScrollEvent) => {
44
80
  'worklet';
45
- offsetRef.current.value =
81
+ offset.value =
46
82
  event.contentOffset.x === 0
47
83
  ? event.contentOffset.y
48
84
  : event.contentOffset.x;
49
85
  },
50
- scrollEventNames
86
+ scrollNativeEventNames
51
87
  // Read https://github.com/software-mansion/react-native-reanimated/pull/5056
52
88
  // for more information about this cast.
53
89
  ) as unknown as EventHandlerInternal<ReanimatedScrollEvent>;
54
90
 
55
91
  useEffect(() => {
56
- const component = animatedRef.current;
57
- const viewTag = IS_WEB ? component : findNodeHandle(component);
92
+ // We need to make sure that listener for old animatedRef value is removed
93
+ if (scrollRef.current !== null && scrollRefTag.current !== null) {
94
+ eventHandler.workletEventHandler.unregisterFromEvents(
95
+ scrollRefTag.current
96
+ );
97
+ }
58
98
 
59
- eventHandler.workletEventHandler.registerForEvents(viewTag as number);
99
+ // Store the ref and viewTag for future cleanup
100
+ scrollRef.current = animatedRef.current;
101
+ scrollRefTag.current = animatedRef.getTag();
102
+
103
+ if (scrollRefTag === null) {
104
+ console.warn(
105
+ '[Reanimated] ScrollViewOffset failed to resolve the view tag from animated ref. Did you forget to attach the ref to a component?'
106
+ );
107
+ } else {
108
+ eventHandler.workletEventHandler.registerForEvents(scrollRefTag.current);
109
+ }
60
110
 
61
111
  return () => {
62
- eventHandler.workletEventHandler?.unregisterFromEvents();
112
+ if (scrollRefTag.current !== null) {
113
+ eventHandler.workletEventHandler.unregisterFromEvents(
114
+ scrollRefTag.current
115
+ );
116
+ }
63
117
  };
64
118
  // React here has a problem with `animatedRef.current` since a Ref .current
65
119
  // field shouldn't be used as a dependency. However, in this case we have
@@ -67,5 +121,22 @@ export function useScrollViewOffset(
67
121
  // eslint-disable-next-line react-hooks/exhaustive-deps
68
122
  }, [animatedRef, animatedRef.current, eventHandler]);
69
123
 
70
- return offsetRef.current;
124
+ return offset;
125
+ }
126
+
127
+ function getWebScrollableElement(
128
+ scrollComponent: AnimatedScrollView | null
129
+ ): HTMLElement {
130
+ return (
131
+ (scrollComponent?.getScrollableNode() as unknown as HTMLElement) ??
132
+ scrollComponent
133
+ );
71
134
  }
135
+
136
+ const scrollNativeEventNames = [
137
+ 'onScroll',
138
+ 'onScrollBeginDrag',
139
+ 'onScrollEndDrag',
140
+ 'onMomentumScrollBegin',
141
+ 'onMomentumScrollEnd',
142
+ ];
@@ -257,6 +257,7 @@ export {
257
257
  getAnimatedStyle,
258
258
  } from './jestUtils';
259
259
  export { LayoutAnimationConfig } from './component/LayoutAnimationConfig';
260
+ export { PerformanceMonitor } from './component/PerformanceMonitor';
260
261
  export type {
261
262
  Adaptable,
262
263
  AdaptTransforms,
@@ -273,3 +274,13 @@ export type {
273
274
  export type { AnimatedScrollViewProps } from './component/ScrollView';
274
275
  export type { FlatListPropsWithLayout } from './component/FlatList';
275
276
  export { startMapper, stopMapper } from './mappers';
277
+ export {
278
+ startScreenTransition,
279
+ finishScreenTransition,
280
+ ScreenTransition,
281
+ } from './screenTransition';
282
+ export type {
283
+ AnimatedScreenTransition,
284
+ GoBackGesture,
285
+ ScreenTransitionConfig,
286
+ } from './screenTransition';
@@ -55,12 +55,15 @@ export default class JSReanimated {
55
55
  _eventName: string,
56
56
  _emitterReactTag: number
57
57
  ): number {
58
- // noop
59
- return -1;
58
+ throw new Error(
59
+ '[Reanimated] registerEventHandler is not available in JSReanimated.'
60
+ );
60
61
  }
61
62
 
62
63
  unregisterEventHandler(_: number): void {
63
- // noop
64
+ throw new Error(
65
+ '[Reanimated] unregisterEventHandler is not available in JSReanimated.'
66
+ );
64
67
  }
65
68
 
66
69
  enableLayoutAnimations() {
@@ -83,10 +86,6 @@ export default class JSReanimated {
83
86
  }
84
87
  }
85
88
 
86
- configureLayoutAnimation() {
87
- // no-op
88
- }
89
-
90
89
  configureLayoutAnimationBatch() {
91
90
  // no-op
92
91
  }
@@ -282,6 +281,7 @@ export default class JSReanimated {
282
281
  getViewProp<T>(
283
282
  _viewTag: number,
284
283
  _propName: string,
284
+ _component?: React.Component,
285
285
  _callback?: (result: T) => void
286
286
  ): Promise<T> {
287
287
  throw new Error(
@@ -8,6 +8,7 @@ import type {
8
8
  import type { EasingFunction } from '../../Easing';
9
9
  import { BaseAnimationBuilder } from './BaseAnimationBuilder';
10
10
  import type { StyleProps } from '../../commonTypes';
11
+ import { assertEasingIsWorklet } from '../../animation/util';
11
12
 
12
13
  export class ComplexAnimationBuilder extends BaseAnimationBuilder {
13
14
  easingV?: EasingFunction;
@@ -40,6 +41,9 @@ export class ComplexAnimationBuilder extends BaseAnimationBuilder {
40
41
  }
41
42
 
42
43
  easing(easingFunction: EasingFunction): this {
44
+ if (__DEV__) {
45
+ assertEasingIsWorklet(easingFunction);
46
+ }
43
47
  this.easingV = easingFunction;
44
48
  return this;
45
49
  }
@@ -12,7 +12,10 @@ import type {
12
12
  import type { StyleProps } from '../../commonTypes';
13
13
  import type { TransformArrayItem } from '../../helperTypes';
14
14
  import { ReduceMotion } from '../../commonTypes';
15
- import { getReduceMotionFromConfig } from '../../animation/util';
15
+ import {
16
+ assertEasingIsWorklet,
17
+ getReduceMotionFromConfig,
18
+ } from '../../animation/util';
16
19
 
17
20
  interface KeyframePoint {
18
21
  duration: number;
@@ -129,6 +132,11 @@ class InnerKeyframe implements IEntryExitAnimationBuilder {
129
132
  "[Reanimated] Keyframe can contain only that set of properties that were provide with initial values (keyframe 0 or 'from')"
130
133
  );
131
134
  }
135
+
136
+ if (__DEV__ && easing) {
137
+ assertEasingIsWorklet(easing);
138
+ }
139
+
132
140
  parsedKeyframes[key].push({
133
141
  duration: getAnimationDuration(key, currentKeyPoint),
134
142
  value,
@@ -157,5 +157,13 @@ export type StylePropsWithArrayTransform = StyleProps & {
157
157
  export interface LayoutAnimationBatchItem {
158
158
  viewTag: number;
159
159
  type: LayoutAnimationType;
160
- config: ShareableRef<Keyframe | LayoutAnimationFunction> | undefined;
160
+ config:
161
+ | ShareableRef<
162
+ | Keyframe
163
+ | LayoutAnimationFunction
164
+ | SharedTransitionAnimationsFunction
165
+ | ProgressAnimationCallback
166
+ >
167
+ | undefined;
168
+ sharedTransitionTag?: string;
161
169
  }
@@ -8,9 +8,12 @@ import type {
8
8
  SharedTransitionAnimationsValues,
9
9
  LayoutAnimation,
10
10
  } from './animationBuilder/commonTypes';
11
+ import { isFabric } from '../PlatformChecker';
11
12
 
12
13
  const TAG_OFFSET = 1e9;
13
14
 
15
+ const IS_FABRIC = isFabric();
16
+
14
17
  function startObservingProgress(
15
18
  tag: number,
16
19
  sharedValue: SharedValue<Record<string, unknown>>,
@@ -55,8 +58,10 @@ function createLayoutAnimationManager() {
55
58
  global.ProgressTransitionRegister.onTransitionStart(tag, yogaValues);
56
59
  return;
57
60
  }
61
+ // console.log('start', tag, type, yogaValues, config);
58
62
 
59
63
  const style = config(yogaValues);
64
+ // console.log(style);
60
65
  let currentAnimation = style.animations;
61
66
 
62
67
  // When layout animation is requested, but a previous one is still running, we merge
@@ -72,7 +77,9 @@ function createLayoutAnimationManager() {
72
77
  value = makeUIMutable(style.initialValues);
73
78
  mutableValuesForTag.set(tag, value);
74
79
  } else {
75
- stopObservingProgress(tag, value);
80
+ if (!IS_FABRIC) {
81
+ stopObservingProgress(tag, value);
82
+ }
76
83
  value._value = style.initialValues;
77
84
  }
78
85
 
@@ -98,7 +105,8 @@ function createLayoutAnimationManager() {
98
105
  if (!value) {
99
106
  return;
100
107
  }
101
- stopObservingProgress(tag, value);
108
+ value.removeListener(tag + TAG_OFFSET);
109
+ // stopObservingProgress(tag, value);
102
110
  },
103
111
  };
104
112
  }
@@ -7,6 +7,7 @@ import { BaseAnimationBuilder } from '../animationBuilder';
7
7
  import type { EasingFunction } from '../../Easing';
8
8
  import { Easing } from '../../Easing';
9
9
  import { withTiming } from '../../animation';
10
+ import { assertEasingIsWorklet } from '../../animation/util';
10
11
 
11
12
  /**
12
13
  * Layout transitions with a curved animation. You can modify the behavior by chaining methods like `.duration(500)` or `.delay(500)`.
@@ -36,6 +37,9 @@ export class CurvedTransition
36
37
  }
37
38
 
38
39
  easingX(easing: EasingFunction): CurvedTransition {
40
+ if (__DEV__) {
41
+ assertEasingIsWorklet(easing);
42
+ }
39
43
  this.easingXV = easing;
40
44
  return this;
41
45
  }
@@ -46,6 +50,9 @@ export class CurvedTransition
46
50
  }
47
51
 
48
52
  easingY(easing: EasingFunction): CurvedTransition {
53
+ if (__DEV__) {
54
+ assertEasingIsWorklet(easing);
55
+ }
49
56
  this.easingYV = easing;
50
57
  return this;
51
58
  }
@@ -56,6 +63,9 @@ export class CurvedTransition
56
63
  }
57
64
 
58
65
  easingWidth(easing: EasingFunction): CurvedTransition {
66
+ if (__DEV__) {
67
+ assertEasingIsWorklet(easing);
68
+ }
59
69
  this.easingWidthV = easing;
60
70
  return this;
61
71
  }
@@ -66,6 +76,9 @@ export class CurvedTransition
66
76
  }
67
77
 
68
78
  easingHeight(easing: EasingFunction): CurvedTransition {
79
+ if (__DEV__) {
80
+ assertEasingIsWorklet(easing);
81
+ }
69
82
  this.easingHeightV = easing;
70
83
  return this;
71
84
  }
@@ -39,14 +39,18 @@ export class ProgressTransitionManager {
39
39
  progressAnimation
40
40
  );
41
41
  })();
42
+
42
43
  this.registerEventHandlers();
43
44
  }
44
45
 
45
- public removeProgressAnimation(viewTag: number) {
46
+ public removeProgressAnimation(viewTag: number, isUnmounting = true) {
46
47
  this.unregisterEventHandlers();
47
48
  runOnUIImmediately(() => {
48
49
  'worklet';
49
- global.ProgressTransitionRegister.removeProgressAnimation(viewTag);
50
+ global.ProgressTransitionRegister.removeProgressAnimation(
51
+ viewTag,
52
+ isUnmounting
53
+ );
50
54
  })();
51
55
  }
52
56
 
@@ -141,19 +145,24 @@ function createProgressTransitionRegister() {
141
145
  viewTag: number,
142
146
  progressAnimation: ProgressAnimation
143
147
  ) => {
144
- if (currentTransitions.size > 0) {
148
+ if (currentTransitions.size > 0 && !progressAnimations.has(viewTag)) {
145
149
  // there is no need to prevent cleaning on android
146
150
  isTransitionRestart = !IS_ANDROID;
147
151
  }
148
152
  progressAnimations.set(viewTag, progressAnimation);
149
153
  },
150
- removeProgressAnimation: (viewTag: number) => {
154
+ removeProgressAnimation: (viewTag: number, isUnmounting: boolean) => {
151
155
  if (currentTransitions.size > 0) {
152
156
  // there is no need to prevent cleaning on android
153
157
  isTransitionRestart = !IS_ANDROID;
154
158
  }
155
- // Remove the animation config after the transition is finished
156
- toRemove.add(viewTag);
159
+ if (isUnmounting) {
160
+ // Remove the animation config after the transition is finished
161
+ toRemove.add(viewTag);
162
+ } else {
163
+ // if the animation is removed, without ever being started, it can be removed immediately
164
+ progressAnimations.delete(viewTag);
165
+ }
157
166
  },
158
167
  onTransitionStart: (
159
168
  viewTag: number,
@@ -194,7 +203,7 @@ function createProgressTransitionRegister() {
194
203
  return;
195
204
  }
196
205
  for (const viewTag of currentTransitions) {
197
- global._notifyAboutEnd(viewTag, removeViews);
206
+ // global._notifyAboutEnd(viewTag, removeViews);
198
207
  }
199
208
  currentTransitions.clear();
200
209
  if (isTransitionRestart) {
@@ -206,7 +215,7 @@ function createProgressTransitionRegister() {
206
215
  if (toRemove.size > 0) {
207
216
  for (const viewTag of toRemove) {
208
217
  progressAnimations.delete(viewTag);
209
- global._notifyAboutEnd(viewTag, removeViews);
218
+ // global._notifyAboutEnd(viewTag, removeViews);
210
219
  }
211
220
  toRemove.clear();
212
221
  }
@@ -13,8 +13,9 @@ import {
13
13
  } from '../animationBuilder/commonTypes';
14
14
  import type { StyleProps } from '../../commonTypes';
15
15
  import { ReduceMotion } from '../../commonTypes';
16
- import { configureLayoutAnimations } from '../../core';
17
16
  import { ProgressTransitionManager } from './ProgressTransitionManager';
17
+ import { updateLayoutAnimations } from '../../UpdateLayoutAnimations';
18
+ import { getReduceMotionFromConfig } from '../../animation/util';
18
19
 
19
20
  const SUPPORTED_PROPS = [
20
21
  'width',
@@ -80,8 +81,13 @@ export class SharedTransition {
80
81
 
81
82
  public registerTransition(
82
83
  viewTag: number,
83
- sharedTransitionTag: string
84
- ): void {
84
+ sharedTransitionTag: string,
85
+ isUnmounting = false
86
+ ) {
87
+ if (getReduceMotionFromConfig(this.getReduceMotion())) {
88
+ return;
89
+ }
90
+
85
91
  const transitionAnimation = this.getTransitionAnimation();
86
92
  const progressAnimation = this.getProgressAnimation();
87
93
  if (!this._defaultTransitionType) {
@@ -95,11 +101,12 @@ export class SharedTransition {
95
101
  this._defaultTransitionType === SharedTransitionType.ANIMATION
96
102
  ? LayoutAnimationType.SHARED_ELEMENT_TRANSITION
97
103
  : LayoutAnimationType.SHARED_ELEMENT_TRANSITION_PROGRESS;
98
- configureLayoutAnimations(
104
+ updateLayoutAnimations(
99
105
  viewTag,
100
106
  layoutAnimationType,
101
107
  transitionAnimation,
102
- sharedTransitionTag
108
+ sharedTransitionTag,
109
+ isUnmounting
103
110
  );
104
111
  SharedTransition._progressTransitionManager.addProgressAnimation(
105
112
  viewTag,
@@ -107,9 +114,21 @@ export class SharedTransition {
107
114
  );
108
115
  }
109
116
 
110
- public unregisterTransition(viewTag: number): void {
117
+ public unregisterTransition(viewTag: number, isUnmounting = false): void {
118
+ const layoutAnimationType =
119
+ this._defaultTransitionType === SharedTransitionType.ANIMATION
120
+ ? LayoutAnimationType.SHARED_ELEMENT_TRANSITION
121
+ : LayoutAnimationType.SHARED_ELEMENT_TRANSITION_PROGRESS;
122
+ updateLayoutAnimations(
123
+ viewTag,
124
+ layoutAnimationType,
125
+ undefined,
126
+ undefined,
127
+ isUnmounting
128
+ );
111
129
  SharedTransition._progressTransitionManager.removeProgressAnimation(
112
- viewTag
130
+ viewTag,
131
+ isUnmounting
113
132
  );
114
133
  }
115
134
 
@@ -48,7 +48,7 @@ function checkUndefinedAnimationFail(
48
48
  }
49
49
 
50
50
  console.warn(
51
- "[Reanimated] Couldn't load entering/exiting animation. Current version supports only predefined animations with modifiers: duration, delay, easing, randomizeDelay, wtihCallback, reducedMotion."
51
+ "[Reanimated] Couldn't load entering/exiting animation. Current version supports only predefined animations with modifiers: duration, delay, easing, randomizeDelay, withCallback, reducedMotion."
52
52
  );
53
53
 
54
54
  return true;
@@ -78,5 +78,7 @@ export function setDummyPosition(
78
78
  dummy.style.height = `${snapshot.height}px`;
79
79
  dummy.style.margin = '0px'; // tmpElement has absolute position, so margin is not necessary
80
80
 
81
- fixElementPosition(dummy, dummy.parentElement!, snapshot);
81
+ if (dummy.parentElement) {
82
+ fixElementPosition(dummy, dummy.parentElement, snapshot);
83
+ }
82
84
  }
@@ -276,7 +276,7 @@ export function handleExitingAnimation(
276
276
 
277
277
  const scrollOffsets = getElementScrollValue(element);
278
278
 
279
- // Scroll does not trigger snapshoting, therefore if we start exiting animation after
279
+ // Scroll does not trigger snapshotting, therefore if we start exiting animation after
280
280
  // scrolling through parent component, dummy will end up in wrong place. In order to fix that
281
281
  // we keep last known scroll position in snapshot and then adjust dummy position based on
282
282
  // last known scroll offset and current scroll offset