react-native-reanimated 3.0.0-rc.8 → 3.0.0

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 (339) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +30 -12
  2. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +2 -0
  3. package/Common/cpp/Fabric/FabricUtils.cpp +3 -107
  4. package/Common/cpp/Fabric/FabricUtils.h +3 -24
  5. package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +54 -37
  6. package/Common/cpp/LayoutAnimations/LayoutAnimationType.h +8 -0
  7. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +81 -26
  8. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +20 -3
  9. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +122 -121
  10. package/Common/cpp/NativeModules/NativeReanimatedModule.h +21 -14
  11. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
  12. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +8 -4
  13. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +50 -1
  14. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +10 -1
  15. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +5 -1
  16. package/Common/cpp/Registries/EventHandlerRegistry.cpp +8 -34
  17. package/Common/cpp/Registries/EventHandlerRegistry.h +7 -13
  18. package/Common/cpp/SharedItems/Shareables.cpp +11 -63
  19. package/Common/cpp/SharedItems/Shareables.h +113 -93
  20. package/Common/cpp/Tools/CollectionUtils.h +14 -0
  21. package/Common/cpp/Tools/JsiUtils.cpp +26 -0
  22. package/Common/cpp/Tools/JsiUtils.h +176 -0
  23. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +5 -5
  24. package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
  25. package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
  26. package/Common/cpp/Tools/RuntimeDecorator.cpp +67 -247
  27. package/Common/cpp/Tools/RuntimeDecorator.h +2 -3
  28. package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
  29. package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
  30. package/RNReanimated.podspec +2 -1
  31. package/android/CMakeLists.txt +188 -181
  32. package/android/build.gradle +362 -311
  33. package/android/proguard-rules.pro +2 -0
  34. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
  35. package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
  36. package/android/src/main/cpp/LayoutAnimations.h +23 -6
  37. package/android/src/main/cpp/NativeProxy.cpp +143 -98
  38. package/android/src/main/cpp/NativeProxy.h +22 -28
  39. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
  40. package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
  41. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
  42. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
  43. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
  44. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
  45. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
  46. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
  47. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
  48. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
  49. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
  50. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
  51. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
  52. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
  53. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
  54. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
  55. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
  56. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
  57. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
  58. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
  59. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
  60. package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
  61. package/ios/LayoutReanimation/REAAnimationsManager.h +31 -5
  62. package/ios/LayoutReanimation/REAAnimationsManager.m +265 -77
  63. package/ios/LayoutReanimation/REAFrame.h +10 -0
  64. package/ios/LayoutReanimation/REAFrame.m +15 -0
  65. package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
  66. package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
  67. package/ios/LayoutReanimation/REASharedElement.h +15 -0
  68. package/ios/LayoutReanimation/REASharedElement.m +16 -0
  69. package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
  70. package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
  71. package/ios/LayoutReanimation/REASnapshot.h +1 -0
  72. package/ios/LayoutReanimation/REASnapshot.m +96 -11
  73. package/ios/LayoutReanimation/REAUIManager.mm +67 -60
  74. package/ios/REAModule.mm +2 -7
  75. package/ios/REANodesManager.mm +1 -21
  76. package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
  77. package/ios/native/NativeProxy.mm +75 -114
  78. package/ios/native/REAInitializer.mm +2 -7
  79. package/ios/native/REAJSIUtils.h +60 -2
  80. package/ios/sensor/ReanimatedSensor.h +6 -2
  81. package/ios/sensor/ReanimatedSensor.m +43 -7
  82. package/ios/sensor/ReanimatedSensorContainer.h +4 -1
  83. package/ios/sensor/ReanimatedSensorContainer.m +8 -2
  84. package/lib/commonjs/createAnimatedComponent.js +232 -28
  85. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  86. package/lib/commonjs/reanimated2/Colors.js +43 -22
  87. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  88. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +18 -35
  89. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  90. package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
  91. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  92. package/lib/commonjs/reanimated2/animation/util.js +17 -15
  93. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  94. package/lib/commonjs/reanimated2/commonTypes.js +33 -1
  95. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  96. package/lib/commonjs/reanimated2/component/FlatList.js +19 -3
  97. package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
  98. package/lib/commonjs/reanimated2/core.js +34 -83
  99. package/lib/commonjs/reanimated2/core.js.map +1 -1
  100. package/lib/commonjs/reanimated2/errors.js +66 -0
  101. package/lib/commonjs/reanimated2/errors.js.map +1 -0
  102. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  103. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  104. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  105. package/lib/commonjs/reanimated2/hook/index.js +0 -6
  106. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  107. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  108. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  109. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  111. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  113. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +89 -16
  114. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  115. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -50
  116. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  117. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
  118. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  119. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
  120. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  121. package/lib/commonjs/reanimated2/hook/utils.js +18 -65
  122. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  123. package/lib/commonjs/reanimated2/index.js +13 -0
  124. package/lib/commonjs/reanimated2/index.js.map +1 -1
  125. package/lib/commonjs/reanimated2/initializers.js +196 -0
  126. package/lib/commonjs/reanimated2/initializers.js.map +1 -0
  127. package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
  128. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  129. package/lib/commonjs/reanimated2/jestUtils.js +1 -1
  130. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  131. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +101 -16
  132. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  133. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
  134. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  135. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
  136. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  137. package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  138. package/lib/commonjs/reanimated2/js-reanimated/global.js +4 -9
  139. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  140. package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
  141. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  142. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
  143. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  144. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
  145. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  146. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +16 -12
  147. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  148. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
  149. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  150. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
  151. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  152. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
  153. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  154. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
  155. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  156. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
  157. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  158. package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
  159. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  160. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
  161. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  162. package/lib/commonjs/reanimated2/mappers.js +18 -6
  163. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  164. package/lib/commonjs/reanimated2/mock.js +45 -0
  165. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  166. package/lib/commonjs/reanimated2/mutables.js +4 -2
  167. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  168. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -0
  169. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
  170. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
  171. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  172. package/lib/commonjs/reanimated2/pluginUtils.js +11 -0
  173. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
  174. package/lib/commonjs/reanimated2/shareables.js +38 -11
  175. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  176. package/lib/commonjs/reanimated2/threads.js +114 -4
  177. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  178. package/lib/commonjs/reanimated2/utils.js +7 -0
  179. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  180. package/lib/commonjs/reanimated2/valueSetter.js +1 -3
  181. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  182. package/lib/module/createAnimatedComponent.js +229 -29
  183. package/lib/module/createAnimatedComponent.js.map +1 -1
  184. package/lib/module/reanimated2/Colors.js +35 -19
  185. package/lib/module/reanimated2/Colors.js.map +1 -1
  186. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +18 -34
  187. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  188. package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
  189. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  190. package/lib/module/reanimated2/animation/util.js +17 -16
  191. package/lib/module/reanimated2/animation/util.js.map +1 -1
  192. package/lib/module/reanimated2/commonTypes.js +29 -0
  193. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  194. package/lib/module/reanimated2/component/FlatList.js +18 -4
  195. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  196. package/lib/module/reanimated2/core.js +30 -76
  197. package/lib/module/reanimated2/core.js.map +1 -1
  198. package/lib/module/reanimated2/errors.js +58 -0
  199. package/lib/module/reanimated2/errors.js.map +1 -0
  200. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  201. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  202. package/lib/module/reanimated2/globals.d.js.map +1 -1
  203. package/lib/module/reanimated2/hook/index.js +1 -1
  204. package/lib/module/reanimated2/hook/index.js.map +1 -1
  205. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  206. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  207. package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
  208. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  209. package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
  210. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  211. package/lib/module/reanimated2/hook/useAnimatedSensor.js +88 -13
  212. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  213. package/lib/module/reanimated2/hook/useAnimatedStyle.js +45 -52
  214. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  215. package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
  216. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  217. package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
  218. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  219. package/lib/module/reanimated2/hook/utils.js +17 -60
  220. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  221. package/lib/module/reanimated2/index.js +1 -0
  222. package/lib/module/reanimated2/index.js.map +1 -1
  223. package/lib/module/reanimated2/initializers.js +182 -0
  224. package/lib/module/reanimated2/initializers.js.map +1 -0
  225. package/lib/module/reanimated2/interpolateColor.js +96 -19
  226. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  227. package/lib/module/reanimated2/jestUtils.js +1 -1
  228. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  229. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +101 -16
  230. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  231. package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
  232. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  233. package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
  234. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  235. package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  236. package/lib/module/reanimated2/js-reanimated/global.js +4 -9
  237. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  238. package/lib/module/reanimated2/js-reanimated/index.js +0 -1
  239. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  240. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
  241. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  242. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
  243. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  244. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +15 -10
  245. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  246. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
  247. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  248. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
  249. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  250. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
  251. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  252. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
  253. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  254. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
  255. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  256. package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
  257. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  258. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
  259. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  260. package/lib/module/reanimated2/mappers.js +16 -6
  261. package/lib/module/reanimated2/mappers.js.map +1 -1
  262. package/lib/module/reanimated2/mock.js +45 -0
  263. package/lib/module/reanimated2/mock.js.map +1 -1
  264. package/lib/module/reanimated2/mutables.js +4 -2
  265. package/lib/module/reanimated2/mutables.js.map +1 -1
  266. package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -0
  267. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
  268. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
  269. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  270. package/lib/module/reanimated2/pluginUtils.js +4 -0
  271. package/lib/module/reanimated2/pluginUtils.js.map +1 -0
  272. package/lib/module/reanimated2/shareables.js +38 -9
  273. package/lib/module/reanimated2/shareables.js.map +1 -1
  274. package/lib/module/reanimated2/threads.js +105 -4
  275. package/lib/module/reanimated2/threads.js.map +1 -1
  276. package/lib/module/reanimated2/utils.js +5 -0
  277. package/lib/module/reanimated2/utils.js.map +1 -1
  278. package/lib/module/reanimated2/valueSetter.js +1 -2
  279. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  280. package/package.json +9 -8
  281. package/{plugin.js → plugin/index.js} +173 -228
  282. package/react-native-reanimated.d.ts +57 -10
  283. package/scripts/reanimated_utils.rb +15 -2
  284. package/src/createAnimatedComponent.tsx +238 -28
  285. package/src/reanimated2/Colors.ts +38 -11
  286. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +63 -41
  287. package/src/reanimated2/animation/styleAnimation.ts +8 -1
  288. package/src/reanimated2/animation/util.ts +29 -16
  289. package/src/reanimated2/commonTypes.ts +28 -1
  290. package/src/reanimated2/component/FlatList.tsx +30 -5
  291. package/src/reanimated2/core.ts +45 -75
  292. package/src/reanimated2/errors.ts +57 -0
  293. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
  294. package/src/reanimated2/globals.d.ts +34 -18
  295. package/src/reanimated2/hook/index.ts +1 -1
  296. package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
  297. package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
  298. package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
  299. package/src/reanimated2/hook/useAnimatedSensor.ts +88 -11
  300. package/src/reanimated2/hook/useAnimatedStyle.ts +43 -45
  301. package/src/reanimated2/hook/useDerivedValue.ts +8 -1
  302. package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
  303. package/src/reanimated2/hook/utils.ts +15 -61
  304. package/src/reanimated2/index.ts +1 -0
  305. package/src/reanimated2/initializers.ts +184 -0
  306. package/src/reanimated2/interpolateColor.ts +104 -20
  307. package/src/reanimated2/jestUtils.ts +1 -1
  308. package/src/reanimated2/js-reanimated/JSReanimated.ts +105 -18
  309. package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
  310. package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
  311. package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
  312. package/src/reanimated2/js-reanimated/global.ts +4 -8
  313. package/src/reanimated2/js-reanimated/index.ts +0 -1
  314. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
  315. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
  316. package/src/reanimated2/layoutReanimation/animationsManager.ts +17 -12
  317. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
  318. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
  319. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
  320. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
  321. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
  322. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  323. package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
  324. package/src/reanimated2/mappers.ts +17 -6
  325. package/src/reanimated2/mock.ts +128 -0
  326. package/src/reanimated2/mutables.ts +2 -0
  327. package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
  328. package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
  329. package/src/reanimated2/pluginUtils.ts +8 -0
  330. package/src/reanimated2/shareables.ts +47 -11
  331. package/src/reanimated2/threads.ts +103 -1
  332. package/src/reanimated2/utils.ts +6 -0
  333. package/src/reanimated2/valueSetter.ts +1 -2
  334. package/lib/commonjs/reanimated2/time.js +0 -55
  335. package/lib/commonjs/reanimated2/time.js.map +0 -1
  336. package/lib/module/reanimated2/time.js +0 -37
  337. package/lib/module/reanimated2/time.js.map +0 -1
  338. package/src/reanimated2/time.ts +0 -30
  339. /package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
@@ -0,0 +1,271 @@
1
+ package com.facebook.react.uimanager;
2
+
3
+ import androidx.annotation.Nullable;
4
+ import com.facebook.react.bridge.Callback;
5
+ import com.facebook.react.bridge.Dynamic;
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.facebook.react.bridge.ReactMethod;
8
+ import com.facebook.react.bridge.ReadableArray;
9
+ import com.facebook.react.bridge.ReadableMap;
10
+ import com.facebook.react.bridge.WritableMap;
11
+ import com.facebook.react.module.annotations.ReactModule;
12
+ import java.util.List;
13
+
14
+ @ReactModule(name = UIManagerModule.NAME)
15
+ public class ReanimatedUIManager extends UIManagerModule {
16
+
17
+ public ReanimatedUIManager(
18
+ ReactApplicationContext reactContext,
19
+ List<ViewManager> viewManagersList,
20
+ int minTimeLeftInFrameForNonBatchedOperationMs) {
21
+ super(reactContext, viewManagersList, minTimeLeftInFrameForNonBatchedOperationMs);
22
+ }
23
+
24
+ public void onBatchComplete() {
25
+ super.onBatchComplete();
26
+ }
27
+
28
+ @Override
29
+ public boolean canOverrideExistingModule() {
30
+ return true;
31
+ }
32
+
33
+ @ReactMethod(isBlockingSynchronousMethod = true)
34
+ public @Nullable WritableMap getConstantsForViewManager(@Nullable String viewManagerName) {
35
+ return super.getConstantsForViewManager(viewManagerName);
36
+ }
37
+
38
+ @ReactMethod(isBlockingSynchronousMethod = true)
39
+ public WritableMap getDefaultEventTypes() {
40
+ return super.getDefaultEventTypes();
41
+ }
42
+
43
+ /** Unregisters a new root view. */
44
+ @ReactMethod
45
+ public void removeRootView(int rootViewTag) {
46
+ super.removeRootView(rootViewTag);
47
+ }
48
+
49
+ @ReactMethod
50
+ public void createView(int tag, String className, int rootViewTag, ReadableMap props) {
51
+ super.createView(tag, className, rootViewTag, props);
52
+ }
53
+
54
+ @ReactMethod
55
+ public void updateView(final int tag, final String className, final ReadableMap props) {
56
+ super.updateView(tag, className, props);
57
+ }
58
+
59
+ /**
60
+ * Interface for adding/removing/moving views within a parent view from JS.
61
+ *
62
+ * @param viewTag the view tag of the parent view
63
+ * @param moveFrom a list of indices in the parent view to move views from
64
+ * @param moveTo parallel to moveFrom, a list of indices in the parent view to move views to
65
+ * @param addChildTags a list of tags of views to add to the parent
66
+ * @param addAtIndices parallel to addChildTags, a list of indices to insert those children at
67
+ * @param removeFrom a list of indices of views to permanently remove. The memory for the
68
+ * corresponding views and data structures should be reclaimed.
69
+ */
70
+ @ReactMethod
71
+ public void manageChildren(
72
+ int viewTag,
73
+ @Nullable ReadableArray moveFrom,
74
+ @Nullable ReadableArray moveTo,
75
+ @Nullable ReadableArray addChildTags,
76
+ @Nullable ReadableArray addAtIndices,
77
+ @Nullable ReadableArray removeFrom) {
78
+ super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom);
79
+ }
80
+
81
+ /**
82
+ * Interface for fast tracking the initial adding of views. Children view tags are assumed to be
83
+ * in order
84
+ *
85
+ * @param viewTag the view tag of the parent view
86
+ * @param childrenTags An array of tags to add to the parent in order
87
+ */
88
+ @ReactMethod
89
+ public void setChildren(int viewTag, ReadableArray childrenTags) {
90
+ super.setChildren(viewTag, childrenTags);
91
+ }
92
+
93
+ /**
94
+ * Replaces the View specified by oldTag with the View specified by newTag within oldTag's parent.
95
+ * This resolves to a simple {@link #manageChildren} call, but React doesn't have enough info in
96
+ * JS to formulate it itself.
97
+ *
98
+ * @deprecated This method will not be available in Fabric UIManager class.
99
+ */
100
+ @ReactMethod
101
+ @Deprecated
102
+ public void replaceExistingNonRootView(int oldTag, int newTag) {
103
+ super.replaceExistingNonRootView(oldTag, newTag);
104
+ }
105
+
106
+ /**
107
+ * Method which takes a container tag and then releases all subviews for that container upon
108
+ * receipt.
109
+ *
110
+ * @param containerTag the tag of the container for which the subviews must be removed
111
+ * @deprecated This method will not be available in Fabric UIManager class.
112
+ */
113
+ @ReactMethod
114
+ @Deprecated
115
+ public void removeSubviewsFromContainerWithID(int containerTag) {
116
+ super.removeSubviewsFromContainerWithID(containerTag);
117
+ }
118
+
119
+ /**
120
+ * Determines the location on screen, width, and height of the given view and returns the values
121
+ * via an async callback.
122
+ */
123
+ @ReactMethod
124
+ public void measure(int reactTag, Callback callback) {
125
+ super.measure(reactTag, callback);
126
+ }
127
+
128
+ /**
129
+ * Determines the location on screen, width, and height of the given view relative to the device
130
+ * screen and returns the values via an async callback. This is the absolute position including
131
+ * things like the status bar
132
+ */
133
+ @ReactMethod
134
+ public void measureInWindow(int reactTag, Callback callback) {
135
+ super.measureInWindow(reactTag, callback);
136
+ }
137
+
138
+ /**
139
+ * Measures the view specified by tag relative to the given ancestorTag. This means that the
140
+ * returned x, y are relative to the origin x, y of the ancestor view. Results are stored in the
141
+ * given outputBuffer. We allow ancestor view and measured view to be the same, in which case the
142
+ * position always will be (0, 0) and method will only measure the view dimensions.
143
+ *
144
+ * <p>NB: Unlike {@link #measure}, this will measure relative to the view layout, not the visible
145
+ * window which can cause unexpected results when measuring relative to things like ScrollViews
146
+ * that can have offset content on the screen.
147
+ */
148
+ @ReactMethod
149
+ public void measureLayout(
150
+ int tag, int ancestorTag, Callback errorCallback, Callback successCallback) {
151
+ super.measureLayout(tag, ancestorTag, errorCallback, successCallback);
152
+ }
153
+
154
+ /**
155
+ * Like {@link #measure} and {@link #measureLayout} but measures relative to the immediate parent.
156
+ *
157
+ * <p>NB: Unlike {@link #measure}, this will measure relative to the view layout, not the visible
158
+ * window which can cause unexpected results when measuring relative to things like ScrollViews
159
+ * that can have offset content on the screen.
160
+ *
161
+ * @deprecated this method will not be available in FabricUIManager class.
162
+ */
163
+ @ReactMethod
164
+ @Deprecated
165
+ public void measureLayoutRelativeToParent(
166
+ int tag, Callback errorCallback, Callback successCallback) {
167
+ super.measureLayoutRelativeToParent(tag, errorCallback, successCallback);
168
+ }
169
+
170
+ /**
171
+ * Find the touch target child native view in the supplied root view hierarchy, given a react
172
+ * target location.
173
+ *
174
+ * <p>This method is currently used only by Element Inspector DevTool.
175
+ *
176
+ * @param reactTag the tag of the root view to traverse
177
+ * @param point an array containing both X and Y target location
178
+ * @param callback will be called if with the identified child view react ID, and measurement
179
+ * info. If no view was found, callback will be invoked with no data.
180
+ */
181
+ @ReactMethod
182
+ public void findSubviewIn(
183
+ final int reactTag, final ReadableArray point, final Callback callback) {
184
+ super.findSubviewIn(reactTag, point, callback);
185
+ }
186
+
187
+ /**
188
+ * Check if the first shadow node is the descendant of the second shadow node
189
+ *
190
+ * @deprecated this method will not be available in FabricUIManager class.
191
+ */
192
+ @ReactMethod
193
+ @Deprecated
194
+ public void viewIsDescendantOf(
195
+ final int reactTag, final int ancestorReactTag, final Callback callback) {
196
+ super.viewIsDescendantOf(reactTag, ancestorReactTag, callback);
197
+ }
198
+
199
+ @ReactMethod
200
+ public void setJSResponder(int reactTag, boolean blockNativeResponder) {
201
+ super.setJSResponder(reactTag, blockNativeResponder);
202
+ }
203
+
204
+ @ReactMethod
205
+ public void clearJSResponder() {
206
+ super.clearJSResponder();
207
+ }
208
+
209
+ @ReactMethod
210
+ public void dispatchViewManagerCommand(
211
+ int reactTag, Dynamic commandId, @Nullable ReadableArray commandArgs) {
212
+ super.dispatchViewManagerCommand(reactTag, commandId, commandArgs);
213
+ }
214
+
215
+ /**
216
+ * Show a PopupMenu.
217
+ *
218
+ * @param reactTag the tag of the anchor view (the PopupMenu is displayed next to this view); this
219
+ * needs to be the tag of a native view (shadow views can not be anchors)
220
+ * @param items the menu items as an array of strings
221
+ * @param error will be called if there is an error displaying the menu
222
+ * @param success will be called with the position of the selected item as the first argument, or
223
+ * no arguments if the menu is dismissed
224
+ */
225
+ @ReactMethod
226
+ public void showPopupMenu(int reactTag, ReadableArray items, Callback error, Callback success) {
227
+ super.showPopupMenu(reactTag, items, error, success);
228
+ }
229
+
230
+ @ReactMethod
231
+ public void dismissPopupMenu() {
232
+ super.dismissPopupMenu();
233
+ }
234
+
235
+ /**
236
+ * LayoutAnimation API on Android is currently experimental. Therefore, it needs to be enabled
237
+ * explicitly in order to avoid regression in existing application written for iOS using this API.
238
+ *
239
+ * <p>Warning : This method will be removed in future version of React Native, and layout
240
+ * animation will be enabled by default, so always check for its existence before invoking it.
241
+ *
242
+ * <p>TODO(9139831) : remove this method once layout animation is fully stable.
243
+ *
244
+ * @param enabled whether layout animation is enabled or not
245
+ */
246
+ @ReactMethod
247
+ public void setLayoutAnimationEnabledExperimental(boolean enabled) {
248
+ super.setLayoutAnimationEnabledExperimental(enabled);
249
+ }
250
+
251
+ /**
252
+ * Configure an animation to be used for the native layout changes, and native views creation. The
253
+ * animation will only apply during the current batch operations.
254
+ *
255
+ * <p>TODO(7728153) : animating view deletion is currently not supported.
256
+ *
257
+ * @param config the configuration of the animation for view addition/removal/update.
258
+ * @param success will be called when the animation completes, or when the animation get
259
+ * interrupted. In this case, callback parameter will be false.
260
+ * @param error will be called if there was an error processing the animation
261
+ */
262
+ @ReactMethod
263
+ public void configureNextLayoutAnimation(ReadableMap config, Callback success, Callback error) {
264
+ super.configureNextLayoutAnimation(config, success, error);
265
+ }
266
+
267
+ @ReactMethod
268
+ public void sendAccessibilityEvent(int tag, int eventType) {
269
+ super.sendAccessibilityEvent(tag, eventType);
270
+ }
271
+ }
@@ -4,7 +4,9 @@ import android.os.Build;
4
4
  import android.util.Log;
5
5
  import android.view.View;
6
6
  import android.view.ViewGroup;
7
+
7
8
  import androidx.annotation.Nullable;
9
+
8
10
  import com.facebook.react.bridge.ReactApplicationContext;
9
11
  import com.facebook.react.bridge.UiThreadUtil;
10
12
  import com.facebook.react.uimanager.IllegalViewOperationException;
@@ -16,6 +18,7 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
16
18
  import com.facebook.react.uimanager.layoutanimation.LayoutAnimationController;
17
19
  import com.facebook.react.uimanager.layoutanimation.LayoutAnimationListener;
18
20
  import com.swmansion.reanimated.ReanimatedModule;
21
+
19
22
  import java.lang.ref.WeakReference;
20
23
  import java.lang.reflect.Field;
21
24
  import java.lang.reflect.Modifier;
@@ -29,6 +32,7 @@ class ReaLayoutAnimator extends LayoutAnimationController {
29
32
  private volatile boolean mInitialized = false;
30
33
  private final ReactApplicationContext mContext;
31
34
  private final WeakReference<NativeViewHierarchyManager> mWeakNativeViewHierarchyManager;
35
+ private final ArrayList<View> viewsToSnapshot = new ArrayList<>();
32
36
 
33
37
  ReaLayoutAnimator(
34
38
  ReactApplicationContext context, NativeViewHierarchyManager nativeViewHierarchyManager) {
@@ -60,6 +64,22 @@ class ReaLayoutAnimator extends LayoutAnimationController {
60
64
  return (viewToAnimate.getParent() != null);
61
65
  }
62
66
 
67
+ @Override
68
+ public void reset() {
69
+ super.reset();
70
+ // we have to make snapshots of the views after all of them have updated layouts
71
+ // to have correct global coordinates in the snapshots
72
+ // we do it here because React calls reset() method after all views have updated layouts
73
+ // and there is no semantically valid place to do it
74
+ for(View view : viewsToSnapshot) {
75
+ mAnimationsManager.onViewCreate(
76
+ view,
77
+ (ViewGroup) view.getParent(),
78
+ new Snapshot(view, mWeakNativeViewHierarchyManager.get()));
79
+ }
80
+ viewsToSnapshot.clear();
81
+ }
82
+
63
83
  /**
64
84
  * Update layout of given view, via immediate update or animation depending on the current batch
65
85
  * layout animation configuration supplied during initialization. Handles create and update
@@ -82,19 +102,22 @@ class ReaLayoutAnimator extends LayoutAnimationController {
82
102
  // otherwise use update animation. This approach is easier than maintaining a list of tags
83
103
  // for recently created views.
84
104
  if (view.getWidth() == 0 || view.getHeight() == 0) {
105
+ if (!mAnimationsManager.hasAnimationForTag(view.getId(), LayoutAnimations.Types.ENTERING)) {
106
+ super.applyLayoutUpdate(view, x, y, width, height);
107
+ mAnimationsManager.maybeRegisterSharedView(view);
108
+ return;
109
+ }
85
110
  view.layout(x, y, x + width, y + height);
86
111
  if (view.getId() != -1) {
87
- mAnimationsManager.onViewCreate(
88
- view,
89
- (ViewGroup) view.getParent(),
90
- new Snapshot(view, mWeakNativeViewHierarchyManager.get()));
112
+ viewsToSnapshot.add(view);
91
113
  }
92
- } else {
93
- Snapshot before = new Snapshot(view, mWeakNativeViewHierarchyManager.get());
94
- view.layout(x, y, x + width, y + height);
95
- Snapshot after = new Snapshot(view, mWeakNativeViewHierarchyManager.get());
96
- mAnimationsManager.onViewUpdate(view, before, after);
114
+ return;
97
115
  }
116
+
117
+ Snapshot before = new Snapshot(view, mWeakNativeViewHierarchyManager.get());
118
+ view.layout(x, y, x + width, y + height);
119
+ Snapshot after = new Snapshot(view, mWeakNativeViewHierarchyManager.get());
120
+ mAnimationsManager.onViewUpdate(view, before, after);
98
121
  }
99
122
 
100
123
  /**
@@ -118,6 +141,7 @@ class ReaLayoutAnimator extends LayoutAnimationController {
118
141
  } catch (IllegalViewOperationException e) {
119
142
  // (IllegalViewOperationException) == (vm == null)
120
143
  e.printStackTrace();
144
+ mAnimationsManager.cancelAnimationsInSubviews(view);
121
145
  super.deleteView(view, listener);
122
146
  return;
123
147
  }
@@ -135,11 +159,13 @@ class ReaLayoutAnimator extends LayoutAnimationController {
135
159
  } catch (IllegalViewOperationException e) {
136
160
  // (IllegalViewOperationException) == (vm == null)
137
161
  e.printStackTrace();
162
+ mAnimationsManager.cancelAnimationsInSubviews(view);
138
163
  super.deleteView(view, listener);
139
164
  return;
140
165
  }
141
166
  String parentName = screenParentViewManager.getName();
142
167
  if (parentName.equals("RNSScreenStack")) {
168
+ mAnimationsManager.cancelAnimationsInSubviews(view);
143
169
  super.deleteView(view, listener);
144
170
  return;
145
171
  }
@@ -153,12 +179,16 @@ class ReaLayoutAnimator extends LayoutAnimationController {
153
179
  maybeInit();
154
180
  return mAnimationsManager.isLayoutAnimationEnabled();
155
181
  }
182
+
183
+ public AnimationsManager getAnimationsManager() {
184
+ return mAnimationsManager;
185
+ }
156
186
  }
157
187
 
158
188
  public class ReanimatedNativeHierarchyManager extends NativeViewHierarchyManager {
159
189
  private final HashMap<Integer, ArrayList<View>> toBeRemoved = new HashMap<>();
160
190
  private final HashMap<Integer, Runnable> cleanerCallback = new HashMap<>();
161
- private final LayoutAnimationController mReaLayoutAnimator;
191
+ private final ReaLayoutAnimator mReaLayoutAnimator;
162
192
  private final HashMap<Integer, Set<Integer>> mPendingDeletionsForTag = new HashMap<>();
163
193
  private boolean initOk = true;
164
194
 
@@ -232,19 +262,20 @@ public class ReanimatedNativeHierarchyManager extends NativeViewHierarchyManager
232
262
  return;
233
263
  }
234
264
  try {
235
- View viewToUpdate = this.resolveView(tag);
236
- ViewManager viewManager = this.resolveViewManager(tag);
265
+ ViewManager viewManager = resolveViewManager(tag);
237
266
  String viewManagerName = viewManager.getName();
238
267
  View container = resolveView(parentTag);
239
268
  if (container != null
240
269
  && viewManagerName.equals("RNSScreen")
241
- && this.mReaLayoutAnimator != null) {
242
- this.mReaLayoutAnimator.applyLayoutUpdate(
243
- viewToUpdate,
244
- (int) container.getX(),
245
- (int) container.getY(),
246
- container.getWidth(),
247
- container.getHeight());
270
+ && mReaLayoutAnimator != null) {
271
+ boolean hasHeader = checkIfTopScreenHasHeader((ViewGroup) container);
272
+ if (!hasHeader || !container.isLayoutRequested()) {
273
+ mReaLayoutAnimator.getAnimationsManager().screenDidLayout();
274
+ }
275
+ }
276
+ View view = resolveView(tag);
277
+ if (view != null && mReaLayoutAnimator != null) {
278
+ mReaLayoutAnimator.getAnimationsManager().viewDidLayout(view);
248
279
  }
249
280
  } catch (IllegalViewOperationException e) {
250
281
  // (IllegalViewOperationException) == (vm == null)
@@ -252,6 +283,19 @@ public class ReanimatedNativeHierarchyManager extends NativeViewHierarchyManager
252
283
  }
253
284
  }
254
285
 
286
+ private boolean checkIfTopScreenHasHeader(ViewGroup screenStack) {
287
+ try {
288
+ ViewGroup fragment = (ViewGroup)screenStack.getChildAt(0);
289
+ ViewGroup screen = (ViewGroup)fragment.getChildAt(0);
290
+ View headerConfig = screen.getChildAt(0);
291
+ Field field = headerConfig.getClass().getDeclaredField("mIsHidden");
292
+ field.setAccessible(true);
293
+ return !field.getBoolean(headerConfig);
294
+ } catch (NullPointerException | NoSuchFieldException | IllegalAccessException e) {
295
+ return false;
296
+ }
297
+ }
298
+
255
299
  @Override
256
300
  public synchronized void manageChildren(
257
301
  int tag,
@@ -275,7 +319,19 @@ public class ReanimatedNativeHierarchyManager extends NativeViewHierarchyManager
275
319
  }
276
320
 
277
321
  // we don't want layout animations in native-stack since it is currently buggy there
322
+ AnimationsManager animationsManager = mReaLayoutAnimator.getAnimationsManager();
278
323
  if (viewGroupManager.getName().equals("RNSScreenStack")) {
324
+ if (tagsToDelete == null) {
325
+ animationsManager.makeSnapshotOfTopScreenViews(viewGroup);
326
+ } else {
327
+ animationsManager.notifyAboutViewsRemoval(tagsToDelete);
328
+ }
329
+ if (indicesToRemove != null && mReaLayoutAnimator instanceof ReaLayoutAnimator) {
330
+ for (int index : indicesToRemove) {
331
+ View child = viewGroupManager.getChildAt(viewGroup, index);
332
+ mReaLayoutAnimator.getAnimationsManager().cancelAnimationsInSubviews(child);
333
+ }
334
+ }
279
335
  super.manageChildren(tag, indicesToRemove, viewsToAdd, tagsToDelete);
280
336
  return;
281
337
  }
@@ -328,7 +384,7 @@ public class ReanimatedNativeHierarchyManager extends NativeViewHierarchyManager
328
384
  pendingTags.clear();
329
385
  }
330
386
  }
331
-
387
+ animationsManager.notifyAboutViewsRemoval(tagsToDelete);
332
388
  super.manageChildren(tag, indicesToRemove, viewsToAdd, null);
333
389
  if (toBeRemoved.containsKey(tag)) {
334
390
  ArrayList<View> childrenToBeRemoved = toBeRemoved.get(tag);
@@ -1,4 +1,6 @@
1
1
  #import <Foundation/Foundation.h>
2
+ #import <RNReanimated/LayoutAnimationType.h>
3
+ #import <RNReanimated/REANodesManager.h>
2
4
  #import <RNReanimated/REASnapshot.h>
3
5
  #import <React/RCTUIManager.h>
4
6
 
@@ -12,13 +14,19 @@ typedef NS_ENUM(NSInteger, ViewState) {
12
14
  ToRemove,
13
15
  };
14
16
 
15
- typedef BOOL (^REAHasAnimationBlock)(NSNumber *_Nonnull tag, NSString *_Nonnull type);
17
+ typedef BOOL (^REAHasAnimationBlock)(NSNumber *_Nonnull tag, LayoutAnimationType type);
16
18
  typedef void (^REAAnimationStartingBlock)(
17
19
  NSNumber *_Nonnull tag,
18
- NSString *_Nonnull type,
20
+ LayoutAnimationType type,
19
21
  NSDictionary *_Nonnull yogaValues,
20
22
  NSNumber *_Nonnull depth);
21
23
  typedef void (^REAAnimationRemovingBlock)(NSNumber *_Nonnull tag);
24
+ typedef void (
25
+ ^REACancelAnimationBlock)(NSNumber *_Nonnull tag, LayoutAnimationType type, BOOL cancelled, BOOL removeView);
26
+ typedef NSNumber *_Nullable (^REAFindPrecedingViewTagForTransitionBlock)(NSNumber *_Nonnull tag);
27
+ typedef int (^REATreeVisitor)(id<RCTComponent>);
28
+
29
+ BOOL REANodeFind(id<RCTComponent> view, int (^block)(id<RCTComponent>));
22
30
 
23
31
  @interface REAAnimationsManager : NSObject
24
32
 
@@ -26,16 +34,34 @@ typedef void (^REAAnimationRemovingBlock)(NSNumber *_Nonnull tag);
26
34
  - (void)setAnimationStartingBlock:(REAAnimationStartingBlock)startAnimation;
27
35
  - (void)setHasAnimationBlock:(REAHasAnimationBlock)hasAnimation;
28
36
  - (void)setAnimationRemovingBlock:(REAAnimationRemovingBlock)clearAnimation;
29
- - (void)progressLayoutAnimationWithStyle:(NSDictionary *_Nonnull)newStyle forTag:(NSNumber *_Nonnull)tag;
37
+ - (void)progressLayoutAnimationWithStyle:(NSDictionary *_Nonnull)newStyle
38
+ forTag:(NSNumber *_Nonnull)tag
39
+ isSharedTransition:(BOOL)isSharedTransition;
40
+ - (void)setFindPrecedingViewTagForTransitionBlock:
41
+ (REAFindPrecedingViewTagForTransitionBlock)findPrecedingViewTagForTransition;
42
+ - (void)setCancelAnimationBlock:(REACancelAnimationBlock)animationCancellingBlock;
30
43
  - (void)endLayoutAnimationForTag:(NSNumber *_Nonnull)tag cancelled:(BOOL)cancelled removeView:(BOOL)removeView;
44
+ - (void)endAnimationsRecursive:(UIView *)view;
31
45
  - (void)invalidate;
32
- - (void)viewDidMount:(UIView *)view withBeforeSnapshot:(REASnapshot *)snapshot;
46
+ - (void)viewDidMount:(UIView *)view withBeforeSnapshot:(REASnapshot *)snapshot withNewFrame:(CGRect)frame;
33
47
  - (REASnapshot *)prepareSnapshotBeforeMountForView:(UIView *)view;
34
48
  - (BOOL)wantsHandleRemovalOfView:(UIView *)view;
35
49
  - (void)removeAnimationsFromSubtree:(UIView *)view;
36
- - (void)removeChildren:(NSArray<UIView *> *)children fromContainer:(UIView *)container;
50
+ - (void)reattachAnimatedChildren:(NSArray<id<RCTComponent>> *)children
51
+ toContainer:(id<RCTComponent>)container
52
+ atIndices:(NSArray<NSNumber *> *)indices;
37
53
  - (void)onViewCreate:(UIView *)view after:(REASnapshot *)after;
38
54
  - (void)onViewUpdate:(UIView *)view before:(REASnapshot *)before after:(REASnapshot *)after;
55
+ - (void)viewsDidLayout;
56
+ - (NSDictionary *)prepareDataForLayoutAnimatingWorklet:(NSMutableDictionary *)currentValues
57
+ targetValues:(NSMutableDictionary *)targetValues;
58
+ - (UIView *)viewForTag:(NSNumber *)tag;
59
+ - (BOOL)hasAnimationForTag:(NSNumber *)tag type:(LayoutAnimationType)type;
60
+ - (void)clearAnimationConfigForTag:(NSNumber *)tag;
61
+ - (void)startAnimationForTag:(NSNumber *)tag
62
+ type:(LayoutAnimationType)type
63
+ yogaValues:(NSDictionary *)yogaValues
64
+ depth:(NSNumber *)depth;
39
65
 
40
66
  @end
41
67