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,143 @@
1
+ package com.swmansion.reanimated;
2
+
3
+ import androidx.annotation.OptIn;
4
+
5
+ import com.facebook.jni.HybridData;
6
+ import com.facebook.proguard.annotations.DoNotStrip;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.bridge.RuntimeExecutor;
9
+ import com.facebook.react.bridge.queue.MessageQueueThread;
10
+ import com.facebook.react.common.annotations.FrameworkAPI;
11
+ import com.facebook.react.fabric.FabricUIManager;
12
+ import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
13
+ import com.facebook.react.uimanager.UIManagerHelper;
14
+ import com.facebook.react.uimanager.common.UIManagerType;
15
+ import com.swmansion.reanimated.layoutReanimation.LayoutAnimations;
16
+ import com.swmansion.reanimated.layoutReanimation.NativeMethodsHolder;
17
+ import com.swmansion.reanimated.nativeProxy.NativeProxyCommon;
18
+
19
+ import java.util.HashMap;
20
+ import java.util.Objects;
21
+
22
+ public class NativeProxy extends NativeProxyCommon {
23
+ @DoNotStrip
24
+ @SuppressWarnings("unused")
25
+ private final HybridData mHybridData;
26
+
27
+ public @OptIn(markerClass = FrameworkAPI.class) NativeProxy(ReactApplicationContext context, String valueUnpackerCode) {
28
+ super(context);
29
+ ReactFeatureFlagsWrapper.enableMountHooks();
30
+
31
+ FabricUIManager fabricUIManager =
32
+ (FabricUIManager) UIManagerHelper.getUIManager(context, UIManagerType.FABRIC);
33
+
34
+ LayoutAnimations LayoutAnimations = new LayoutAnimations(context);
35
+
36
+ ReanimatedMessageQueueThread messageQueueThread = new ReanimatedMessageQueueThread();
37
+
38
+
39
+ if (context.isBridgeless()) {
40
+ RuntimeExecutor runtimeExecutor = context.getRuntimeExecutor();
41
+ mHybridData = initHybridBridgeless(
42
+ Objects.requireNonNull(context.getJavaScriptContextHolder()).get(),
43
+ runtimeExecutor,
44
+ mAndroidUIScheduler,
45
+ LayoutAnimations,
46
+ messageQueueThread,
47
+ fabricUIManager,
48
+ valueUnpackerCode
49
+ );
50
+ } else {
51
+ CallInvokerHolderImpl callInvokerHolder = (CallInvokerHolderImpl) context.getCatalystInstance().getJSCallInvokerHolder();
52
+ mHybridData =
53
+ initHybrid(
54
+ Objects.requireNonNull(context.getJavaScriptContextHolder()).get(),
55
+ callInvokerHolder,
56
+ mAndroidUIScheduler,
57
+ LayoutAnimations,
58
+ messageQueueThread,
59
+ fabricUIManager,
60
+ valueUnpackerCode);
61
+ }
62
+ prepareLayoutAnimations(LayoutAnimations);
63
+ installJSIBindings();
64
+ if (BuildConfig.DEBUG) {
65
+ checkCppVersion();
66
+ }
67
+ }
68
+
69
+ private native HybridData initHybrid(
70
+ long jsContext,
71
+ CallInvokerHolderImpl jsCallInvokerHolder,
72
+ AndroidUIScheduler androidUIScheduler,
73
+ LayoutAnimations LayoutAnimations,
74
+ MessageQueueThread messageQueueThread,
75
+ FabricUIManager fabricUIManager,
76
+ String valueUnpackerCode);
77
+
78
+ private native HybridData initHybridBridgeless(
79
+ long jsContext,
80
+ RuntimeExecutor runtimeExecutor,
81
+ AndroidUIScheduler androidUIScheduler,
82
+ LayoutAnimations LayoutAnimations,
83
+ MessageQueueThread messageQueueThread,
84
+ FabricUIManager fabricUIManager,
85
+ String valueUnpackerCode);
86
+
87
+ public native boolean isAnyHandlerWaitingForEvent(String eventName, int emitterReactTag);
88
+
89
+ public native void performOperations();
90
+
91
+ @Override
92
+ protected HybridData getHybridData() {
93
+ return mHybridData;
94
+ }
95
+
96
+ public static NativeMethodsHolder createNativeMethodsHolder(LayoutAnimations layoutAnimations) {
97
+ return new NativeMethodsHolder() {
98
+ @Override
99
+ public void startAnimation(int tag, int type, HashMap<String, Object> values) {
100
+ // NOT IMPLEMENTED
101
+ }
102
+
103
+ @Override
104
+ public boolean isLayoutAnimationEnabled() {
105
+ // NOT IMPLEMENTED
106
+ return false;
107
+ }
108
+
109
+ @Override
110
+ public int findPrecedingViewTagForTransition(int tag) {
111
+ // NOT IMPLEMENTED
112
+ return -1;
113
+ }
114
+
115
+ @Override
116
+ public boolean shouldAnimateExiting(int tag, boolean shouldAnimate) {
117
+ // NOT IMPLEMENTED
118
+ return false;
119
+ }
120
+
121
+ @Override
122
+ public boolean hasAnimation(int tag, int type) {
123
+ // NOT IMPLEMENTED
124
+ return false;
125
+ }
126
+
127
+ @Override
128
+ public void clearAnimationConfig(int tag) {
129
+ // NOT IMPLEMENTED
130
+ }
131
+
132
+ @Override
133
+ public void cancelAnimation(int tag) {
134
+ // NOT IMPLEMENTED
135
+ }
136
+
137
+ @Override
138
+ public void checkDuplicateSharedTag(int viewTag, int screenTag) {
139
+ // NOT IMPLEMENTED
140
+ }
141
+ };
142
+ }
143
+ }
@@ -20,6 +20,7 @@ typedef BOOL (^REAShouldAnimateExitingBlock)(NSNumber *_Nonnull tag, BOOL should
20
20
  typedef void (
21
21
  ^REAAnimationStartingBlock)(NSNumber *_Nonnull tag, LayoutAnimationType type, NSDictionary *_Nonnull yogaValues);
22
22
  typedef void (^REAAnimationRemovingBlock)(NSNumber *_Nonnull tag);
23
+ typedef void (^REASharedTransitionRemovingBlock)(NSNumber *_Nonnull tag);
23
24
  #ifndef NDEBUG
24
25
  typedef void (^REACheckDuplicateSharedTagBlock)(REAUIView *view, NSNumber *_Nonnull viewTag);
25
26
  #endif
@@ -35,6 +36,7 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>));
35
36
  - (void)setHasAnimationBlock:(REAHasAnimationBlock)hasAnimation;
36
37
  - (void)setShouldAnimateExitingBlock:(REAShouldAnimateExitingBlock)shouldAnimateExiting;
37
38
  - (void)setAnimationRemovingBlock:(REAAnimationRemovingBlock)clearAnimation;
39
+ - (void)setSharedTransitionRemovingBlock:(REASharedTransitionRemovingBlock)clearSharedTransition;
38
40
  #ifndef NDEBUG
39
41
  - (void)setCheckDuplicateSharedTagBlock:(REACheckDuplicateSharedTagBlock)checkDuplicateSharedTag;
40
42
  #endif
@@ -61,6 +63,7 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>));
61
63
  - (REAUIView *)viewForTag:(NSNumber *)tag;
62
64
  - (BOOL)hasAnimationForTag:(NSNumber *)tag type:(LayoutAnimationType)type;
63
65
  - (void)clearAnimationConfigForTag:(NSNumber *)tag;
66
+ - (void)clearSharedTransitionConfigForTag:(NSNumber *)tag;
64
67
  - (void)startAnimationForTag:(NSNumber *)tag type:(LayoutAnimationType)type yogaValues:(NSDictionary *)yogaValues;
65
68
  - (void)onScreenRemoval:(REAUIView *)screen stack:(REAUIView *)stack;
66
69
 
@@ -43,6 +43,7 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>))
43
43
  REAHasAnimationBlock _hasAnimationForTag;
44
44
  REAShouldAnimateExitingBlock _shouldAnimateExiting;
45
45
  REAAnimationRemovingBlock _clearAnimationConfigForTag;
46
+ REASharedTransitionRemovingBlock _clearSharedTransitionConfigForTag;
46
47
  REASharedTransitionManager *_sharedTransitionManager;
47
48
  #ifndef NDEBUG
48
49
  REACheckDuplicateSharedTagBlock _checkDuplicateSharedTag;
@@ -132,6 +133,11 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>))
132
133
  _clearAnimationConfigForTag = clearAnimation;
133
134
  }
134
135
 
136
+ - (void)setSharedTransitionRemovingBlock:(REASharedTransitionRemovingBlock)clearSharedTransition
137
+ {
138
+ _clearSharedTransitionConfigForTag = clearSharedTransition;
139
+ }
140
+
135
141
  #ifndef NDEBUG
136
142
  - (void)setCheckDuplicateSharedTagBlock:(REACheckDuplicateSharedTagBlock)checkDuplicateSharedTag
137
143
  {
@@ -611,6 +617,11 @@ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>))
611
617
  _clearAnimationConfigForTag(tag);
612
618
  }
613
619
 
620
+ - (void)clearSharedTransitionConfigForTag:(NSNumber *)tag
621
+ {
622
+ _clearSharedTransitionConfigForTag(tag);
623
+ }
624
+
614
625
  - (void)startAnimationForTag:(NSNumber *)tag type:(LayoutAnimationType)type yogaValues:(NSDictionary *)yogaValues
615
626
  {
616
627
  _startAnimationForTag(tag, type, yogaValues);
@@ -29,6 +29,8 @@
29
29
  BOOL _isAsyncSharedTransitionConfigured;
30
30
  BOOL _isConfigured;
31
31
  BOOL _clearScreen;
32
+ BOOL _isInteractive;
33
+ REAUIView *_disappearingScreen;
32
34
  }
33
35
 
34
36
  /*
@@ -121,7 +123,10 @@ static REASharedTransitionManager *_sharedTransitionManager;
121
123
  {
122
124
  if ([views count] > 0) {
123
125
  NSArray *sharedViews = [self sortViewsByTags:views];
124
- _sharedElements = [self getSharedElementForCurrentTransition:sharedViews withNewElements:YES];
126
+ _sharedElements = [self getSharedElementForCurrentTransition:sharedViews
127
+ withNewElements:YES
128
+ withOffsetX:0
129
+ withOffsetY:0];
125
130
  [self resolveAnimationType:_sharedElements isInteractive:NO];
126
131
  _isAsyncSharedTransitionConfigured = YES;
127
132
  }
@@ -169,11 +174,16 @@ static REASharedTransitionManager *_sharedTransitionManager;
169
174
  [self startSharedTransition:sharedElementToRestart];
170
175
  }
171
176
 
172
- - (BOOL)configureAndStartSharedTransitionForViews:(NSArray<REAUIView *> *)views isInteractive:(BOOL)isInteractive
177
+ - (BOOL)configureAndStartSharedTransitionForViews:(NSArray<REAUIView *> *)views
178
+ isInteractive:(BOOL)isInteractive
179
+ withOffsetX:(double)offsetX
180
+ withOffsetY:(double)offsetY
173
181
  {
174
182
  NSArray *sharedViews = [self sortViewsByTags:views];
175
183
  NSArray<REASharedElement *> *sharedElements = [self getSharedElementForCurrentTransition:sharedViews
176
- withNewElements:NO];
184
+ withNewElements:NO
185
+ withOffsetX:offsetX
186
+ withOffsetY:offsetY];
177
187
  if ([sharedElements count] == 0) {
178
188
  return NO;
179
189
  }
@@ -198,6 +208,8 @@ static REASharedTransitionManager *_sharedTransitionManager;
198
208
 
199
209
  - (NSMutableArray<REASharedElement *> *)getSharedElementForCurrentTransition:(NSArray *)sharedViews
200
210
  withNewElements:(BOOL)addedNewScreen
211
+ withOffsetX:(double)offsetX
212
+ withOffsetY:(double)offsetY
201
213
  {
202
214
  NSMutableArray<REAUIView *> *newTransitionViews = [NSMutableArray new];
203
215
  NSMutableArray<REASharedElement *> *newSharedElements = [NSMutableArray new];
@@ -266,7 +278,7 @@ static REASharedTransitionManager *_sharedTransitionManager;
266
278
  if (![screenUnderStackTop.reactTag isEqual:viewSourceParentScreen.reactTag] && !isInCurrentTransition) {
267
279
  continue;
268
280
  }
269
- } else if (!addedNewScreen) {
281
+ } else if (!addedNewScreen && !isModal) {
270
282
  // is on top
271
283
  REAUIView *viewTargetParentScreen = [REAScreensHelper getScreenForView:viewTarget];
272
284
  // TODO macOS navigationController isn't available on macOS
@@ -282,7 +294,12 @@ static REASharedTransitionManager *_sharedTransitionManager;
282
294
  [_viewsToHide addObject:viewSource.reactTag];
283
295
  }
284
296
 
285
- REASnapshot *sourceViewSnapshot = [[REASnapshot alloc] initWithAbsolutePosition:viewSource];
297
+ REASnapshot *sourceViewSnapshot;
298
+ if (!addedNewScreen) {
299
+ sourceViewSnapshot = _snapshotRegistry[viewSource.reactTag];
300
+ } else {
301
+ sourceViewSnapshot = [[REASnapshot alloc] initWithAbsolutePosition:viewSource];
302
+ }
286
303
  if (addedNewScreen && !_currentSharedTransitionViews[viewSource.reactTag]) {
287
304
  _snapshotRegistry[viewSource.reactTag] = sourceViewSnapshot;
288
305
  }
@@ -292,10 +309,9 @@ static REASharedTransitionManager *_sharedTransitionManager;
292
309
  targetViewSnapshot = [[REASnapshot alloc] initWithAbsolutePosition:viewTarget];
293
310
  _snapshotRegistry[viewTarget.reactTag] = targetViewSnapshot;
294
311
  } else {
295
- targetViewSnapshot = _snapshotRegistry[viewTarget.reactTag];
296
- if (targetViewSnapshot == nil) {
297
- targetViewSnapshot = [[REASnapshot alloc] initWithAbsolutePosition:viewTarget];
298
- }
312
+ targetViewSnapshot = [[REASnapshot alloc] initWithAbsolutePosition:viewTarget
313
+ withOffsetX:offsetX
314
+ withOffsetY:offsetY];
299
315
  }
300
316
 
301
317
  [newTransitionViews addObject:viewSource];
@@ -346,10 +362,12 @@ static REASharedTransitionManager *_sharedTransitionManager;
346
362
  dispatch_once(&onceToken, ^{
347
363
  SEL viewDidLayoutSubviewsSelector = @selector(viewDidLayoutSubviews);
348
364
  SEL notifyWillDisappearSelector = @selector(notifyWillDisappear);
365
+ SEL viewIsAppearingSelector = @selector(viewIsAppearing:);
349
366
  Class screenClass = [RNSScreen class];
350
367
  Class screenViewClass = [RNSScreenView class];
351
368
  BOOL allSelectorsAreAvailable = [RNSScreen instancesRespondToSelector:viewDidLayoutSubviewsSelector] &&
352
369
  [RNSScreenView instancesRespondToSelector:notifyWillDisappearSelector] &&
370
+ [RNSScreen instancesRespondToSelector:viewIsAppearingSelector] &&
353
371
  [RNSScreenView instancesRespondToSelector:@selector(isModal)]; // used by REAScreenHelper
354
372
 
355
373
  if (allSelectorsAreAvailable) {
@@ -361,12 +379,37 @@ static REASharedTransitionManager *_sharedTransitionManager;
361
379
  forClass:screenViewClass
362
380
  with:@selector(reanimated_notifyWillDisappear)
363
381
  fromClass:[self class]];
382
+ [REAUtils swizzleMethod:viewIsAppearingSelector
383
+ forClass:screenClass
384
+ with:@selector(reanimated_viewIsAppearing:)
385
+ fromClass:[self class]];
364
386
  _isConfigured = YES;
365
387
  }
366
388
  });
367
389
  #endif
368
390
  }
369
391
 
392
+ - (void)setDisappearingScreen:(REAUIView *)view
393
+ {
394
+ _disappearingScreen = view;
395
+ _isInteractive = [_sharedTransitionManager isInteractiveScreenChange:view];
396
+ }
397
+
398
+ - (REAUIView *)getDisappearingScreen
399
+ {
400
+ return _disappearingScreen;
401
+ }
402
+
403
+ - (void)setIsInteractive:(BOOL)isInteractive
404
+ {
405
+ _isInteractive = isInteractive;
406
+ }
407
+
408
+ - (BOOL)getIsInteractive
409
+ {
410
+ return _isInteractive;
411
+ }
412
+
370
413
  - (void)reanimated_viewDidLayoutSubviews
371
414
  {
372
415
  // call original method from react-native-screens, self == RNScreen
@@ -379,7 +422,28 @@ static REASharedTransitionManager *_sharedTransitionManager;
379
422
  {
380
423
  // call original method from react-native-screens, self == RNSScreenView
381
424
  [self reanimated_notifyWillDisappear];
382
- [_sharedTransitionManager screenRemovedFromStack:(REAUIView *)self];
425
+ [_sharedTransitionManager makeSnapshotForScreenViews:(REAUIView *)self];
426
+ bool isModal = [REAScreensHelper isScreenModal:(REAUIView *)self];
427
+ if (isModal) {
428
+ [_sharedTransitionManager setIsInteractive:[_sharedTransitionManager isInteractiveScreenChange:(REAUIView *)self]];
429
+ [_sharedTransitionManager screenRemovedFromStack:(REAUIView *)self withOffsetX:0 withOffsetY:0];
430
+ } else {
431
+ [_sharedTransitionManager setDisappearingScreen:(REAUIView *)self];
432
+ }
433
+ }
434
+
435
+ - (void)reanimated_viewIsAppearing:(BOOL)animated
436
+ {
437
+ // call original method from react-native-screens, self == RNSScreen
438
+ [self reanimated_viewIsAppearing:animated];
439
+ REAUIView *disappearingScreen = [_sharedTransitionManager getDisappearingScreen];
440
+ REAUIView *targetScreen = [self valueForKey:@"screenView"];
441
+ if (disappearingScreen != NULL) {
442
+ [_sharedTransitionManager screenRemovedFromStack:disappearingScreen
443
+ withOffsetX:-targetScreen.superview.frame.origin.x
444
+ withOffsetY:-targetScreen.superview.frame.origin.y];
445
+ }
446
+ [_sharedTransitionManager setDisappearingScreen:NULL];
383
447
  }
384
448
 
385
449
  - (void)screenAddedToStack:(REAUIView *)screen
@@ -389,14 +453,14 @@ static REASharedTransitionManager *_sharedTransitionManager;
389
453
  }
390
454
  }
391
455
 
392
- - (void)screenRemovedFromStack:(REAUIView *)screen
456
+ - (void)screenRemovedFromStack:(REAUIView *)screen withOffsetX:(double)offsetX withOffsetY:(double)offsetY
393
457
  {
394
458
  _isStackDropped = NO;
395
459
  REAUIView *stack = [REAScreensHelper getStackForView:screen];
396
460
  bool isModal = [REAScreensHelper isScreenModal:screen];
397
461
  bool isRemovedInParentStack = [self isRemovedFromHigherStack:screen];
462
+ bool isInteractive = [self getIsInteractive];
398
463
  if ((stack != nil || isModal) && !isRemovedInParentStack) {
399
- bool isInteractive = [self isInteractiveScreenChange:screen];
400
464
  // screen is removed from React tree (navigation.navigate(<screenName>))
401
465
  bool isScreenRemovedFromReactTree = [self isScreen:screen outsideStack:stack];
402
466
  // click on button goBack on native header
@@ -404,13 +468,16 @@ static REASharedTransitionManager *_sharedTransitionManager;
404
468
  bool shouldRunTransition = (isScreenRemovedFromReactTree || isTriggeredByGoBackButton) &&
405
469
  !(isInteractive && [_currentSharedTransitionViews count] > 0);
406
470
  if (shouldRunTransition) {
407
- [self runSharedTransitionForSharedViewsOnScreen:screen isInteractive:isInteractive];
471
+ [self runSharedTransitionForSharedViewsOnScreen:screen
472
+ isInteractive:isInteractive
473
+ withOffsetX:offsetX
474
+ withOffsetY:offsetY];
408
475
  } else {
409
476
  [self makeSnapshotForScreenViews:screen];
410
477
  }
411
478
  } else {
412
479
  // removed stack
413
- if (![self isInteractiveScreenChange:screen]) {
480
+ if (!isInteractive) {
414
481
  [self clearConfigForStackNow:stack];
415
482
  } else {
416
483
  _isStackDropped = YES;
@@ -436,7 +503,9 @@ static REASharedTransitionManager *_sharedTransitionManager;
436
503
  return false;
437
504
  }
438
505
  if ([self->_animationManager hasAnimationForTag:viewTag type:SHARED_ELEMENT_TRANSITION]) {
439
- REASnapshot *snapshot = [[REASnapshot alloc] initWithAbsolutePosition:(REAUIView *)view];
506
+ REASnapshot *snapshot = [[REASnapshot alloc] initWithAbsolutePosition:(REAUIView *)view
507
+ withOffsetX:0
508
+ withOffsetY:0];
440
509
  self->_snapshotRegistry[viewTag] = snapshot;
441
510
  }
442
511
  return false;
@@ -487,7 +556,10 @@ static REASharedTransitionManager *_sharedTransitionManager;
487
556
  return NO;
488
557
  }
489
558
 
490
- - (void)runSharedTransitionForSharedViewsOnScreen:(REAUIView *)screen isInteractive:(BOOL)isInteractive
559
+ - (void)runSharedTransitionForSharedViewsOnScreen:(REAUIView *)screen
560
+ isInteractive:(BOOL)isInteractive
561
+ withOffsetX:(double)offsetX
562
+ withOffsetY:(double)offsetY
491
563
  {
492
564
  NSMutableArray<REAUIView *> *removedViews = [NSMutableArray new];
493
565
  REANodeFind(screen, ^int(id<RCTComponent> view) {
@@ -496,7 +568,10 @@ static REASharedTransitionManager *_sharedTransitionManager;
496
568
  }
497
569
  return false;
498
570
  });
499
- BOOL startedAnimation = [self configureAndStartSharedTransitionForViews:removedViews isInteractive:isInteractive];
571
+ BOOL startedAnimation = [self configureAndStartSharedTransitionForViews:removedViews
572
+ isInteractive:isInteractive
573
+ withOffsetX:offsetX
574
+ withOffsetY:offsetY];
500
575
  if (startedAnimation) {
501
576
  _removedViews = removedViews;
502
577
  } else if (![self isInteractiveScreenChange:screen]) {
@@ -616,8 +691,9 @@ static REASharedTransitionManager *_sharedTransitionManager;
616
691
  isSharedTransition:YES];
617
692
  float originXByParent = [viewSourcePreviousSnapshot.values[@"originXByParent"] floatValue];
618
693
  float originYByParent = [viewSourcePreviousSnapshot.values[@"originYByParent"] floatValue];
619
- CGRect frame = CGRectMake(originXByParent, originYByParent, view.frame.size.width, view.frame.size.height);
620
- [view setFrame:frame];
694
+ float height = [viewSourcePreviousSnapshot.values[@"height"] floatValue];
695
+ float width = [viewSourcePreviousSnapshot.values[@"width"] floatValue];
696
+ [view setCenter:CGPointMake(originXByParent + width / 2.0, originYByParent + height / 2.0)];
621
697
  }
622
698
  [_sharedTransitionParent removeObjectForKey:viewTag];
623
699
  [_sharedTransitionInParentIndex removeObjectForKey:viewTag];
@@ -632,7 +708,7 @@ static REASharedTransitionManager *_sharedTransitionManager;
632
708
  [_removedViews removeObject:view];
633
709
  }
634
710
  if ([_removedViews containsObject:view]) {
635
- [_animationManager clearAnimationConfigForTag:viewTag];
711
+ [_animationManager clearSharedTransitionConfigForTag:viewTag];
636
712
  }
637
713
  if (_removedViewRegistry[view.reactTag]) {
638
714
  return;
@@ -664,7 +740,7 @@ static REASharedTransitionManager *_sharedTransitionManager;
664
740
  {
665
741
  if (viewTag != nil) {
666
742
  [_snapshotRegistry removeObjectForKey:viewTag];
667
- [_animationManager clearAnimationConfigForTag:viewTag];
743
+ [_animationManager clearSharedTransitionConfigForTag:viewTag];
668
744
  }
669
745
  }
670
746
 
@@ -716,8 +792,8 @@ static REASharedTransitionManager *_sharedTransitionManager;
716
792
  {
717
793
  NSMutableDictionary *workletValues = [_animationManager prepareDataForLayoutAnimatingWorklet:currentValues
718
794
  targetValues:targetValues];
719
- workletValues[@"currentTransformMatrix"] = currentValues[@"transformMatrix"];
720
- workletValues[@"targetTransformMatrix"] = targetValues[@"transformMatrix"];
795
+ workletValues[@"currentTransformMatrix"] = currentValues[@"combinedTransformMatrix"];
796
+ workletValues[@"targetTransformMatrix"] = targetValues[@"combinedTransformMatrix"];
721
797
  workletValues[@"currentBorderRadius"] = currentValues[@"borderRadius"];
722
798
  workletValues[@"targetBorderRadius"] = targetValues[@"borderRadius"];
723
799
  return workletValues;
@@ -9,6 +9,7 @@ NS_ASSUME_NONNULL_BEGIN
9
9
 
10
10
  - (instancetype)init:(REAUIView *)view;
11
11
  - (instancetype)initWithAbsolutePosition:(REAUIView *)view;
12
+ - (instancetype)initWithAbsolutePosition:(REAUIView *)view withOffsetX:(double)offsetX withOffsetY:(double)offsetY;
12
13
 
13
14
  @end
14
15
 
@@ -15,25 +15,35 @@ const int DEFAULT_MODAL_TOP_OFFSET = 69; // Default iOS modal is shifted from sc
15
15
  - (instancetype)init:(REAUIView *)view
16
16
  {
17
17
  self = [super init];
18
- [self makeSnapshotForView:view useAbsolutePositionOnly:NO];
18
+ [self makeSnapshotForView:view useAbsolutePositionOnly:NO withOffsetX:0 withOffsetY:0];
19
+ return self;
20
+ }
21
+
22
+ - (instancetype)initWithAbsolutePosition:(REAUIView *)view withOffsetX:(double)offsetX withOffsetY:(double)offsetY
23
+ {
24
+ self = [super init];
25
+ [self makeSnapshotForView:view useAbsolutePositionOnly:YES withOffsetX:offsetX withOffsetY:offsetY];
19
26
  return self;
20
27
  }
21
28
 
22
29
  - (instancetype)initWithAbsolutePosition:(REAUIView *)view
23
30
  {
24
31
  self = [super init];
25
- [self makeSnapshotForView:view useAbsolutePositionOnly:YES];
32
+ [self makeSnapshotForView:view useAbsolutePositionOnly:YES withOffsetX:0 withOffsetY:0];
26
33
  return self;
27
34
  }
28
35
 
29
- - (void)makeSnapshotForView:(REAUIView *)view useAbsolutePositionOnly:(BOOL)useAbsolutePositionOnly
36
+ - (void)makeSnapshotForView:(REAUIView *)view
37
+ useAbsolutePositionOnly:(BOOL)useAbsolutePositionOnly
38
+ withOffsetX:(double)offsetX
39
+ withOffsetY:(double)offsetY
30
40
  {
31
41
  #if TARGET_OS_OSX
32
42
  REAUIView *mainWindow = UIApplication.sharedApplication.keyWindow;
33
43
  #else
34
44
  REAUIView *mainWindow = RCTKeyWindow();
35
45
  #endif
36
- CGPoint absolutePosition = [[view superview] convertPoint:view.center toView:nil];
46
+ CGPoint absolutePosition = [[view superview] convertPoint:view.center toView:mainWindow];
37
47
  _values = [NSMutableDictionary new];
38
48
  #if TARGET_OS_OSX
39
49
  _values[@"windowWidth"] = [NSNumber numberWithDouble:mainWindow.frame.size.width];
@@ -44,8 +54,8 @@ const int DEFAULT_MODAL_TOP_OFFSET = 69; // Default iOS modal is shifted from sc
44
54
  #endif
45
55
  _values[@"width"] = [NSNumber numberWithDouble:(double)(view.bounds.size.width)];
46
56
  _values[@"height"] = [NSNumber numberWithDouble:(double)(view.bounds.size.height)];
47
- _values[@"globalOriginX"] = [NSNumber numberWithDouble:absolutePosition.x - view.bounds.size.width / 2.0];
48
- _values[@"globalOriginY"] = [NSNumber numberWithDouble:absolutePosition.y - view.bounds.size.height / 2.0];
57
+ _values[@"globalOriginX"] = [NSNumber numberWithDouble:offsetX + absolutePosition.x - view.bounds.size.width / 2.0];
58
+ _values[@"globalOriginY"] = [NSNumber numberWithDouble:offsetY + absolutePosition.y - view.bounds.size.height / 2.0];
49
59
  if (useAbsolutePositionOnly) {
50
60
  _values[@"originX"] = _values[@"globalOriginX"];
51
61
  _values[@"originY"] = _values[@"globalOriginY"];
@@ -77,22 +87,48 @@ const int DEFAULT_MODAL_TOP_OFFSET = 69; // Default iOS modal is shifted from sc
77
87
  _values[@"headerHeight"] = @(0);
78
88
  }
79
89
 
80
- REAUIView *transformedView = [self findTransformedView:view];
90
+ // store the transofrmMatrix of this view, so that we can reestablish it later
91
+ CGAffineTransform transform = view.transform;
92
+ _values[@"transformMatrix"] = @[
93
+ @(transform.a),
94
+ @(transform.b),
95
+ @(0),
96
+ @(transform.c),
97
+ @(transform.d),
98
+ @(0),
99
+ @(transform.tx),
100
+ @(transform.ty),
101
+ @(1)
102
+ ];
103
+
104
+ transform = [self findCombinedTransform:view];
105
+ _values[@"combinedTransformMatrix"] = @[
106
+ @(transform.a),
107
+ @(transform.b),
108
+ @(0),
109
+ @(transform.c),
110
+ @(transform.d),
111
+ @(0),
112
+ @(transform.tx),
113
+ @(transform.ty),
114
+ @(1)
115
+ ];
116
+
117
+ REAUIView *transformedView = [self maybeFindTransitionView:view];
81
118
  if (transformedView != nil) {
82
119
  // iOS affine matrix: https://developer.apple.com/documentation/corefoundation/cgaffinetransform
83
- CGAffineTransform transform = transformedView.transform;
84
- NSNumber *a = @(transform.a);
85
- NSNumber *b = @(transform.b);
86
- NSNumber *c = @(transform.c);
87
- NSNumber *d = @(transform.d);
88
- NSNumber *tx = @(transform.tx);
89
- NSNumber *ty = @(transform.tx);
90
- _values[@"transformMatrix"] = @[ a, b, @(0), c, d, @(0), tx, ty, @(1) ];
91
- _values[@"originX"] = @([_values[@"originX"] doubleValue] - [tx doubleValue]);
92
- _values[@"originY"] = @([_values[@"originY"] doubleValue] - [ty doubleValue]);
93
- } else {
94
- // Identity matrix is an default value
95
- _values[@"transformMatrix"] = @[ @(1), @(0), @(0), @(0), @(1), @(0), @(0), @(0), @(1) ];
120
+ transform = transformedView.transform;
121
+ // revert the transformation that was applied to the view when transition started, since we are intereseted only
122
+ // in the final result of the transition
123
+ CGPoint center = [[view superview] convertPoint:view.center toView:transformedView.superview];
124
+ CGPoint parentCenter = transformedView.center;
125
+ CGFloat x = center.x, y = center.y, a = transform.a, b = transform.b, c = transform.c, d = transform.d,
126
+ tx = transform.tx, ty = transform.ty, parentX = parentCenter.x, parentY = parentCenter.y;
127
+ center.x = (b - a) * (x - parentX - tx) / (b * c - a * d) + parentX;
128
+ center.y = (d - c) * (y - parentY - ty) / (a * d - b * c) + parentY;
129
+ CGPoint absolute = [[transformedView superview] convertPoint:center toView:nil];
130
+ _values[@"originX"] = [NSNumber numberWithDouble:offsetX + absolute.x - view.bounds.size.width / 2.0];
131
+ _values[@"originY"] = [NSNumber numberWithDouble:offsetY + absolute.y - view.bounds.size.height / 2.0];
96
132
  }
97
133
  #if defined(RCT_NEW_ARCH_ENABLED) || TARGET_OS_TV
98
134
  _values[@"borderRadius"] = @(0);
@@ -110,26 +146,31 @@ const int DEFAULT_MODAL_TOP_OFFSET = 69; // Default iOS modal is shifted from sc
110
146
  }
111
147
  }
112
148
 
113
- - (REAUIView *)findTransformedView:(REAUIView *)view
149
+ - (CGAffineTransform)findCombinedTransform:(REAUIView *)view
114
150
  {
115
- REAUIView *transformedView;
116
- bool isTransformed = false;
117
- do {
118
- if (transformedView == nil) {
119
- transformedView = view;
120
- } else {
121
- transformedView = transformedView.superview;
151
+ CGAffineTransform transform = view.transform;
152
+ view = view.superview;
153
+ while (view != nil && ![REAScreensHelper isRNSScreenType:view]) {
154
+ // ignore transforms that are caused by transitions
155
+ if (![view.superview isKindOfClass:NSClassFromString(@"UITransitionView")]) {
156
+ CGAffineTransform t = view.transform;
157
+ // we are ignoring translations in superviews, since the positioning obtained by converting the center point (and
158
+ // applying it's view transforms) to the main window is already correct, here we only care about scale, shear and
159
+ // rotation
160
+ transform = CGAffineTransformConcat(transform, CGAffineTransformMake(t.a, t.b, t.c, t.d, 0, 0));
122
161
  }
123
- CGAffineTransform transform = transformedView.transform;
124
- isTransformed = transform.a != 1 || transform.b != 0 || transform.c != 0 || transform.d != 1 || transform.tx != 0 ||
125
- transform.ty != 0;
126
- } while (!isTransformed &&
127
- transformedView != nil
128
- // Ignore views above screen
129
- && ![REAScreensHelper isRNSScreenType:transformedView]);
162
+ view = view.superview;
163
+ }
164
+ return transform;
165
+ }
130
166
 
131
- if (isTransformed && transformedView != nil) {
132
- return transformedView;
167
+ - (REAUIView *)maybeFindTransitionView:(REAUIView *)view
168
+ {
169
+ while (view != nil && ![REAScreensHelper isRNSScreenType:view]) {
170
+ if ([view.superview isKindOfClass:NSClassFromString(@"UITransitionView")]) {
171
+ return view;
172
+ }
173
+ view = view.superview;
133
174
  }
134
175
  return nil;
135
176
  }