react-native-reanimated 3.0.0-rc.9 → 3.0.1

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 (331) 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 +105 -109
  10. package/Common/cpp/NativeModules/NativeReanimatedModule.h +19 -12
  11. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
  12. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -2
  13. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +20 -1
  14. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +9 -0
  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 +9 -63
  19. package/Common/cpp/SharedItems/Shareables.h +77 -72
  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 +49 -230
  27. package/Common/cpp/Tools/RuntimeDecorator.h +0 -2
  28. package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
  29. package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
  30. package/README.md +1 -1
  31. package/RNReanimated.podspec +2 -1
  32. package/android/CMakeLists.txt +188 -181
  33. package/android/build.gradle +362 -311
  34. package/android/proguard-rules.pro +2 -0
  35. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
  36. package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
  37. package/android/src/main/cpp/LayoutAnimations.h +23 -6
  38. package/android/src/main/cpp/NativeProxy.cpp +143 -98
  39. package/android/src/main/cpp/NativeProxy.h +22 -28
  40. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
  41. package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
  42. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
  43. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
  44. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
  45. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
  46. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
  47. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
  48. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
  49. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
  50. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
  51. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
  52. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
  53. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
  54. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
  55. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
  56. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
  57. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
  58. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
  59. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
  60. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
  61. package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
  62. package/ios/LayoutReanimation/REAAnimationsManager.h +28 -4
  63. package/ios/LayoutReanimation/REAAnimationsManager.m +216 -61
  64. package/ios/LayoutReanimation/REAFrame.h +10 -0
  65. package/ios/LayoutReanimation/REAFrame.m +15 -0
  66. package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
  67. package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
  68. package/ios/LayoutReanimation/REASharedElement.h +15 -0
  69. package/ios/LayoutReanimation/REASharedElement.m +16 -0
  70. package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
  71. package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
  72. package/ios/LayoutReanimation/REASnapshot.h +1 -0
  73. package/ios/LayoutReanimation/REASnapshot.m +96 -11
  74. package/ios/LayoutReanimation/REAUIManager.mm +64 -17
  75. package/ios/REAModule.mm +2 -7
  76. package/ios/REANodesManager.mm +1 -21
  77. package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
  78. package/ios/native/NativeProxy.mm +75 -114
  79. package/ios/native/REAInitializer.mm +2 -7
  80. package/ios/native/REAJSIUtils.h +60 -2
  81. package/ios/sensor/ReanimatedSensor.h +6 -2
  82. package/ios/sensor/ReanimatedSensor.m +43 -7
  83. package/ios/sensor/ReanimatedSensorContainer.h +4 -1
  84. package/ios/sensor/ReanimatedSensorContainer.m +8 -2
  85. package/lib/commonjs/createAnimatedComponent.js +244 -28
  86. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  87. package/lib/commonjs/reanimated2/Colors.js +43 -22
  88. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  89. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +16 -33
  90. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  91. package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
  92. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  93. package/lib/commonjs/reanimated2/animation/util.js +17 -15
  94. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  95. package/lib/commonjs/reanimated2/commonTypes.js +33 -1
  96. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  97. package/lib/commonjs/reanimated2/core.js +33 -14
  98. package/lib/commonjs/reanimated2/core.js.map +1 -1
  99. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  100. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  101. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  102. package/lib/commonjs/reanimated2/hook/index.js +0 -6
  103. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  104. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  105. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  106. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
  107. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  108. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
  109. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +91 -15
  111. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -40
  113. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  114. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
  115. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  116. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
  117. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  118. package/lib/commonjs/reanimated2/hook/utils.js +18 -65
  119. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  120. package/lib/commonjs/reanimated2/index.js +13 -0
  121. package/lib/commonjs/reanimated2/index.js.map +1 -1
  122. package/lib/commonjs/reanimated2/initializers.js +71 -32
  123. package/lib/commonjs/reanimated2/initializers.js.map +1 -1
  124. package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
  125. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  126. package/lib/commonjs/reanimated2/jestUtils.js +1 -1
  127. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  128. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +103 -13
  129. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  130. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
  131. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  132. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
  133. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  134. package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  135. package/lib/commonjs/reanimated2/js-reanimated/global.js +0 -2
  136. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  137. package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
  138. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  139. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
  140. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  141. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
  142. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  143. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +22 -9
  144. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  145. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
  146. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  147. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
  148. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  149. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
  150. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  151. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
  152. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  153. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
  154. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  155. package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
  156. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  157. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
  158. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  159. package/lib/commonjs/reanimated2/mappers.js +18 -6
  160. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  161. package/lib/commonjs/reanimated2/mock.js +20 -1
  162. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  163. package/lib/commonjs/reanimated2/mutables.js +4 -2
  164. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  165. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -0
  166. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
  167. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
  168. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  169. package/lib/commonjs/reanimated2/pluginUtils.js +11 -0
  170. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
  171. package/lib/commonjs/reanimated2/shareables.js +36 -15
  172. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  173. package/lib/commonjs/reanimated2/threads.js +114 -7
  174. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  175. package/lib/commonjs/reanimated2/utils.js +7 -0
  176. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  177. package/lib/commonjs/reanimated2/valueSetter.js +1 -3
  178. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  179. package/lib/module/createAnimatedComponent.js +241 -29
  180. package/lib/module/createAnimatedComponent.js.map +1 -1
  181. package/lib/module/reanimated2/Colors.js +35 -19
  182. package/lib/module/reanimated2/Colors.js.map +1 -1
  183. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -32
  184. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  185. package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
  186. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  187. package/lib/module/reanimated2/animation/util.js +17 -16
  188. package/lib/module/reanimated2/animation/util.js.map +1 -1
  189. package/lib/module/reanimated2/commonTypes.js +29 -0
  190. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  191. package/lib/module/reanimated2/core.js +32 -7
  192. package/lib/module/reanimated2/core.js.map +1 -1
  193. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  194. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  195. package/lib/module/reanimated2/globals.d.js.map +1 -1
  196. package/lib/module/reanimated2/hook/index.js +1 -1
  197. package/lib/module/reanimated2/hook/index.js.map +1 -1
  198. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  199. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  200. package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
  201. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  202. package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
  203. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  204. package/lib/module/reanimated2/hook/useAnimatedSensor.js +90 -13
  205. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  206. package/lib/module/reanimated2/hook/useAnimatedStyle.js +46 -43
  207. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  208. package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
  209. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  210. package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
  211. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  212. package/lib/module/reanimated2/hook/utils.js +17 -60
  213. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  214. package/lib/module/reanimated2/index.js +1 -0
  215. package/lib/module/reanimated2/index.js.map +1 -1
  216. package/lib/module/reanimated2/initializers.js +72 -33
  217. package/lib/module/reanimated2/initializers.js.map +1 -1
  218. package/lib/module/reanimated2/interpolateColor.js +96 -19
  219. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  220. package/lib/module/reanimated2/jestUtils.js +1 -1
  221. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  222. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +103 -13
  223. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  224. package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
  225. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  226. package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
  227. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  228. package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  229. package/lib/module/reanimated2/js-reanimated/global.js +0 -2
  230. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  231. package/lib/module/reanimated2/js-reanimated/index.js +0 -1
  232. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  233. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
  234. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  235. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
  236. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  237. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +20 -8
  238. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  239. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
  240. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  241. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
  242. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  243. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
  244. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  245. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
  246. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  247. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
  248. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  249. package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
  250. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  251. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
  252. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  253. package/lib/module/reanimated2/mappers.js +16 -6
  254. package/lib/module/reanimated2/mappers.js.map +1 -1
  255. package/lib/module/reanimated2/mock.js +20 -1
  256. package/lib/module/reanimated2/mock.js.map +1 -1
  257. package/lib/module/reanimated2/mutables.js +4 -2
  258. package/lib/module/reanimated2/mutables.js.map +1 -1
  259. package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -0
  260. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
  261. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
  262. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  263. package/lib/module/reanimated2/pluginUtils.js +4 -0
  264. package/lib/module/reanimated2/pluginUtils.js.map +1 -0
  265. package/lib/module/reanimated2/shareables.js +36 -12
  266. package/lib/module/reanimated2/shareables.js.map +1 -1
  267. package/lib/module/reanimated2/threads.js +105 -7
  268. package/lib/module/reanimated2/threads.js.map +1 -1
  269. package/lib/module/reanimated2/utils.js +5 -0
  270. package/lib/module/reanimated2/utils.js.map +1 -1
  271. package/lib/module/reanimated2/valueSetter.js +1 -2
  272. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  273. package/mock.js +1 -211
  274. package/package.json +10 -10
  275. package/{plugin.js → plugin/index.js} +128 -249
  276. package/react-native-reanimated.d.ts +55 -417
  277. package/scripts/reanimated_utils.rb +15 -2
  278. package/src/createAnimatedComponent.tsx +247 -28
  279. package/src/reanimated2/Colors.ts +38 -11
  280. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +52 -39
  281. package/src/reanimated2/animation/styleAnimation.ts +8 -1
  282. package/src/reanimated2/animation/util.ts +29 -16
  283. package/src/reanimated2/commonTypes.ts +28 -1
  284. package/src/reanimated2/core.ts +42 -9
  285. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
  286. package/src/reanimated2/globals.d.ts +12 -15
  287. package/src/reanimated2/hook/index.ts +1 -1
  288. package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
  289. package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
  290. package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
  291. package/src/reanimated2/hook/useAnimatedSensor.ts +90 -11
  292. package/src/reanimated2/hook/useAnimatedStyle.ts +44 -36
  293. package/src/reanimated2/hook/useDerivedValue.ts +8 -1
  294. package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
  295. package/src/reanimated2/hook/utils.ts +15 -61
  296. package/src/reanimated2/index.ts +1 -0
  297. package/src/reanimated2/initializers.ts +76 -35
  298. package/src/reanimated2/interpolateColor.ts +104 -20
  299. package/src/reanimated2/jestUtils.ts +1 -1
  300. package/src/reanimated2/js-reanimated/JSReanimated.ts +98 -15
  301. package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
  302. package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
  303. package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
  304. package/src/reanimated2/js-reanimated/global.ts +0 -1
  305. package/src/reanimated2/js-reanimated/index.ts +0 -1
  306. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
  307. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
  308. package/src/reanimated2/layoutReanimation/animationsManager.ts +20 -9
  309. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
  310. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
  311. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
  312. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
  313. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
  314. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  315. package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
  316. package/src/reanimated2/mappers.ts +17 -6
  317. package/src/reanimated2/mock.ts +25 -2
  318. package/src/reanimated2/mutables.ts +2 -0
  319. package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
  320. package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
  321. package/src/reanimated2/pluginUtils.ts +8 -0
  322. package/src/reanimated2/shareables.ts +45 -16
  323. package/src/reanimated2/threads.ts +103 -4
  324. package/src/reanimated2/utils.ts +6 -0
  325. package/src/reanimated2/valueSetter.ts +1 -2
  326. package/lib/commonjs/reanimated2/time.js +0 -55
  327. package/lib/commonjs/reanimated2/time.js.map +0 -1
  328. package/lib/module/reanimated2/time.js +0 -37
  329. package/lib/module/reanimated2/time.js.map +0 -1
  330. package/src/reanimated2/time.ts +0 -30
  331. /package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
@@ -4,7 +4,6 @@
4
4
  declare module 'react-native-reanimated' {
5
5
  import {
6
6
  ComponentClass,
7
- ReactNode,
8
7
  Component,
9
8
  RefObject,
10
9
  FunctionComponent,
@@ -58,25 +57,6 @@ declare module 'react-native-reanimated' {
58
57
  import('./lib/types/lib/reanimated2/commonTypes').MeasuredDimensions;
59
58
 
60
59
  namespace Animated {
61
- type Nullable<T> = T | null | undefined;
62
- class AnimatedNode<T> {
63
- constructor(
64
- nodeConfig: object,
65
- inputNodes?: ReadonlyArray<AnimatedNode<any>>
66
- );
67
-
68
- isNativelyInitialized(): boolean;
69
- /**
70
- * ' __value' is not available at runtime on AnimatedNode<T>. It is
71
- * necessary to have some discriminating property on a type to know that
72
- * an AnimatedNode<number> and AnimatedNode<string> are not compatible types.
73
- */
74
- ' __value': T;
75
- }
76
- class AnimatedClock extends AnimatedNode<number> {
77
- constructor();
78
- }
79
-
80
60
  export enum Extrapolate {
81
61
  EXTEND = 'extend',
82
62
  CLAMP = 'clamp',
@@ -95,36 +75,13 @@ declare module 'react-native-reanimated' {
95
75
  extrapolateRight?: Extrapolate;
96
76
  }
97
77
  type Value = string | number | boolean;
98
- class AnimatedValue<T extends Value> extends AnimatedNode<T> {
99
- constructor(value?: T);
100
-
101
- setValue(value: Adaptable<T>): void;
102
-
103
- interpolate(config: InterpolationConfig): AnimatedNode<number>;
104
- }
105
- export interface AnimationState {
106
- finished: AnimatedValue<number>;
107
- position: AnimatedValue<number>;
108
- time: AnimatedValue<number>;
109
- }
110
78
 
111
79
  export type SharedValue<T> = { value: T };
112
80
  export type DerivedValue<T> = Readonly<SharedValue<T>>;
113
- export type Mapping = { [key: string]: Mapping } | Adaptable<any>;
114
81
  export type Adaptable<T> =
115
82
  | T
116
- | AnimatedNode<T>
117
- | ReadonlyArray<T | AnimatedNode<T> | ReadonlyArray<T | AnimatedNode<T>>>;
118
- type BinaryOperator<T = number> = (
119
- left: Adaptable<number>,
120
- right: Adaptable<number>
121
- ) => AnimatedNode<T>;
122
- type UnaryOperator = (value: Adaptable<number>) => AnimatedNode<number>;
123
- type MultiOperator<T = number> = (
124
- a: Adaptable<number>,
125
- b: Adaptable<number>,
126
- ...others: Adaptable<number>[]
127
- ) => AnimatedNode<T>;
83
+ | ReadonlyArray<T | ReadonlyArray<T>>
84
+ | SharedValue<T>;
128
85
 
129
86
  export type TransformStyleTypes = TransformsStyle['transform'] extends
130
87
  | readonly (infer T)[]
@@ -145,12 +102,7 @@ declare module 'react-native-reanimated' {
145
102
  ? AnimateStyle<S[K]>
146
103
  : S[K] extends ColorValue | undefined
147
104
  ? S[K] | number
148
- :
149
- | S[K]
150
- | AnimatedNode<
151
- // allow `number` where `string` normally is to support colors
152
- S[K] extends ColorValue | undefined ? S[K] | number : S[K]
153
- >;
105
+ : S[K] | SharedValue<AnimatableValue>;
154
106
  };
155
107
 
156
108
  export type StylesOrDefault<T> = 'style' extends keyof T
@@ -158,7 +110,7 @@ declare module 'react-native-reanimated' {
158
110
  : Record<string, unknown>;
159
111
 
160
112
  export type AnimateProps<P extends object> = {
161
- [K in keyof Omit<P, 'style'>]: P[K] | AnimatedNode<P[K]>;
113
+ [K in keyof Omit<P, 'style'>]: P[K] | SharedValue<P[K]>;
162
114
  } & {
163
115
  style?: StyleProp<AnimateStyle<StylesOrDefault<P>>>;
164
116
  } & {
@@ -177,82 +129,8 @@ declare module 'react-native-reanimated' {
177
129
  | typeof BaseAnimationBuilder
178
130
  | EntryExitAnimationFunction
179
131
  | Keyframe;
180
- };
181
-
182
- export interface PhysicsAnimationState extends AnimationState {
183
- velocity: AnimatedValue<number>;
184
- }
185
-
186
- export type DecayState = PhysicsAnimationState;
187
-
188
- export interface DecayConfig {
189
- deceleration: Adaptable<number>;
190
- }
191
- export interface BackwardCompatibleWrapper {
192
- start: (callback?: (data: { finished: boolean }) => any) => void;
193
- stop: () => void;
194
- }
195
-
196
- export interface TimingState extends AnimationState {
197
- frameTime: AnimatedValue<number>;
198
- }
199
- export type EasingNodeFunction = (
200
- value: Adaptable<number>
201
- ) => AnimatedNode<number>;
202
- export type EasingFunction = (value: number) => number;
203
- export interface TimingConfig {
204
- toValue: Adaptable<number>;
205
- duration: Adaptable<number>;
206
- easing: EasingNodeFunction;
207
- }
208
-
209
- export type SpringState = PhysicsAnimationState;
210
-
211
- export interface SpringConfig {
212
- damping: Adaptable<number>;
213
- mass: Adaptable<number>;
214
- stiffness: Adaptable<number>;
215
- overshootClamping: Adaptable<number> | boolean;
216
- restSpeedThreshold: Adaptable<number>;
217
- restDisplacementThreshold: Adaptable<number>;
218
- toValue: Adaptable<number>;
219
- }
220
- interface SpringConfigWithOrigamiTensionAndFriction {
221
- tension: Adaptable<number>;
222
- mass: Adaptable<number>;
223
- friction: Adaptable<number>;
224
- overshootClamping: Adaptable<number> | boolean;
225
- restSpeedThreshold: Adaptable<number>;
226
- restDisplacementThreshold: Adaptable<number>;
227
- toValue: Adaptable<number>;
228
- }
229
-
230
- interface SpringConfigWithBouncinessAndSpeed {
231
- bounciness: Adaptable<number>;
232
- mass: Adaptable<number>;
233
- speed: Adaptable<number>;
234
- overshootClamping: Adaptable<number> | boolean;
235
- restSpeedThreshold: Adaptable<number>;
236
- restDisplacementThreshold: Adaptable<number>;
237
- toValue: Adaptable<number>;
238
- }
239
-
240
- type SpringUtils = {
241
- makeDefaultConfig: () => SpringConfig;
242
- makeConfigFromBouncinessAndSpeed: (
243
- prevConfig: SpringConfigWithBouncinessAndSpeed
244
- ) => SpringConfig;
245
- makeConfigFromOrigamiTensionAndFriction: (
246
- prevConfig: SpringConfigWithOrigamiTensionAndFriction
247
- ) => SpringConfig;
248
- };
249
-
250
- export const SpringUtils: SpringUtils;
251
-
252
- type CodeProps = {
253
- exec?: AnimatedNode<number>;
254
- children?: () => AnimatedNode<number>;
255
- dependencies?: Array<any>;
132
+ sharedTransitionTag?: string;
133
+ sharedTransitionStyle?: ILayoutAnimationBuilder;
256
134
  };
257
135
 
258
136
  // components
@@ -276,10 +154,12 @@ declare module 'react-native-reanimated' {
276
154
  }
277
155
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
278
156
  export interface ScrollView extends ReactNativeScrollView {}
279
-
280
- export class Code extends Component<CodeProps> {}
281
- export class FlatList<T> extends Component<AnimateProps<FlatListProps<T>>> {
282
- itemLayoutAnimation: ILayoutAnimationBuilder;
157
+ export interface FlatListPropsWithLayout<T> extends FlatListProps<T> {
158
+ itemLayoutAnimation?: ILayoutAnimationBuilder;
159
+ }
160
+ export class FlatList<T> extends Component<
161
+ AnimateProps<FlatListPropsWithLayout<T>>
162
+ > {
283
163
  getNode(): ReactNativeFlatList;
284
164
  }
285
165
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -297,164 +177,6 @@ declare module 'react-native-reanimated' {
297
177
  options?: Options<P>
298
178
  ): FunctionComponent<AnimateProps<P>>;
299
179
 
300
- // classes
301
- export {
302
- AnimatedClock as Clock,
303
- AnimatedNode as Node,
304
- AnimatedValue as Value,
305
- };
306
-
307
- // base operations
308
- export const add: MultiOperator;
309
- export const sub: MultiOperator;
310
- export const multiply: MultiOperator;
311
- export const divide: MultiOperator;
312
- export const pow: MultiOperator;
313
- export const modulo: MultiOperator;
314
- export const sqrt: UnaryOperator;
315
- export const log: UnaryOperator;
316
- export const sin: UnaryOperator;
317
- export const cos: UnaryOperator;
318
- export const tan: UnaryOperator;
319
- export const acos: UnaryOperator;
320
- export const asin: UnaryOperator;
321
- export const atan: UnaryOperator;
322
- export const exp: UnaryOperator;
323
- export const round: UnaryOperator;
324
- export const floor: UnaryOperator;
325
- export const ceil: UnaryOperator;
326
- export const lessThan: BinaryOperator<0 | 1>;
327
- export const eq: BinaryOperator<0 | 1>;
328
- export const greaterThan: BinaryOperator<0 | 1>;
329
- export const lessOrEq: BinaryOperator<0 | 1>;
330
- export const greaterOrEq: BinaryOperator<0 | 1>;
331
- export const neq: BinaryOperator<0 | 1>;
332
- export const and: MultiOperator<0 | 1>;
333
- export const or: MultiOperator<0 | 1>;
334
- export function proc<T extends (Adaptable<Value> | undefined)[]>(
335
- func: (...args: T) => AnimatedNode<number>
336
- ): typeof func;
337
- export function defined(value: Adaptable<any>): AnimatedNode<0 | 1>;
338
- export function not(value: Adaptable<any>): AnimatedNode<0 | 1>;
339
- export function set<T extends Value>(
340
- valueToBeUpdated: AnimatedValue<T>,
341
- sourceNode: Adaptable<T>
342
- ): AnimatedNode<T>;
343
- export function concat(
344
- ...args: Array<Adaptable<string> | Adaptable<number>>
345
- ): AnimatedNode<string>;
346
- export function cond<T1 extends Value = number, T2 extends Value = number>(
347
- conditionNode: Adaptable<number>,
348
- ifNode: Adaptable<T1>,
349
- elseNode?: Adaptable<T2>
350
- ): AnimatedNode<T1 | T2>;
351
- export function block<T1 extends Value = number, T2 extends Value = any>(
352
- items: ReadonlyArray<Adaptable<T2>>
353
- ): AnimatedNode<T1>;
354
- export function call<T>(
355
- args: ReadonlyArray<T | AnimatedNode<T>>,
356
- callback: (args: ReadonlyArray<T>) => void
357
- ): AnimatedNode<0>;
358
- export function debug<T>(
359
- message: string,
360
- value: AnimatedNode<T>
361
- ): AnimatedNode<T>;
362
- export function onChange(
363
- value: Adaptable<number>,
364
- action: Adaptable<number>
365
- ): AnimatedNode<number>;
366
- export function startClock(clock: AnimatedClock): AnimatedNode<0>;
367
- export function stopClock(clock: AnimatedClock): AnimatedNode<0>;
368
- export function clockRunning(clock: AnimatedClock): AnimatedNode<0 | 1>;
369
- // the return type for `event` is a lie, but it's the same lie that
370
- // react-native makes within Animated
371
- type EventArgFunc<T> = (arg: T) => AnimatedNode<number>;
372
- type EventMapping<T> = T extends object
373
- ? { [K in keyof T]?: EventMapping<T[K]> | EventArgFunc<T[K]> }
374
- : Adaptable<T> | EventArgFunc<T>;
375
- type EventMappingArray<T> = T extends Array<any>
376
- ? { [I in keyof T]: EventMapping<T[I]> }
377
- : [EventMapping<T>];
378
- export function event<T>(
379
- argMapping: T extends never
380
- ? ReadonlyArray<Mapping>
381
- : Readonly<EventMappingArray<T>>,
382
- config?: {}
383
- ): (...args: any[]) => void;
384
-
385
- // derived operations
386
- export function abs(value: Adaptable<number>): AnimatedNode<number>;
387
- export function acc(value: Adaptable<number>): AnimatedNode<number>;
388
- export function color(
389
- r: Adaptable<number>,
390
- g: Adaptable<number>,
391
- b: Adaptable<number>,
392
- a?: Adaptable<number>
393
- ): AnimatedNode<number | string>;
394
- export function diff(value: Adaptable<number>): AnimatedNode<number>;
395
- export function diffClamp(
396
- value: Adaptable<number>,
397
- minVal: Adaptable<number>,
398
- maxVal: Adaptable<number>
399
- ): AnimatedNode<number>;
400
- export function interpolateNode(
401
- value: Adaptable<number>,
402
- config: InterpolationConfig
403
- ): AnimatedNode<number>;
404
- export function interpolateColors<T extends string | number>(
405
- animationValue: Adaptable<number>,
406
- {
407
- inputRange,
408
- outputColorRange,
409
- }: {
410
- inputRange: ReadonlyArray<Adaptable<number>>;
411
- outputColorRange: ReadonlyArray<Adaptable<T>>;
412
- }
413
- ): AnimatedNode<T>;
414
- export const max: BinaryOperator;
415
- export const min: BinaryOperator;
416
-
417
- // animations
418
- export function decay(
419
- clock: AnimatedClock,
420
- state: DecayState,
421
- config: DecayConfig
422
- ): AnimatedNode<number>;
423
- export function timing(
424
- clock: AnimatedClock,
425
- state: TimingState,
426
- config: TimingConfig
427
- ): AnimatedNode<number>;
428
- export function spring(
429
- clock: AnimatedClock,
430
- state: SpringState,
431
- config: SpringConfig
432
- ): AnimatedNode<number>;
433
- // backward compatible API
434
- export function spring(
435
- node: AnimatedNode<number>,
436
- config: SpringConfig
437
- ): BackwardCompatibleWrapper;
438
- export function timing(
439
- node: AnimatedNode<number>,
440
- config: TimingConfig
441
- ): BackwardCompatibleWrapper;
442
- export function decay(
443
- node: AnimatedNode<number>,
444
- config: DecayConfig
445
- ): BackwardCompatibleWrapper;
446
-
447
- // hooks
448
- export function useCode(
449
- exec: () =>
450
- | Nullable<AnimatedNode<number>[] | AnimatedNode<number>>
451
- | boolean,
452
- deps: Array<any>
453
- ): void;
454
- export function useValue<T extends Value>(
455
- initialValue: T
456
- ): AnimatedValue<T>;
457
-
458
180
  // configuration
459
181
  export function addWhitelistedNativeProps(props: {
460
182
  [key: string]: true;
@@ -467,7 +189,6 @@ declare module 'react-native-reanimated' {
467
189
  export type SharedValue<T> = Animated.SharedValue<T>;
468
190
  export type AnimateStyle<S> = Animated.AnimateStyle<S>;
469
191
  export type DerivedValue<T> = Animated.DerivedValue<T>;
470
- export type Mapping = Animated.Mapping;
471
192
  export type Adaptable<T> = Animated.Adaptable<T>;
472
193
  export type TransformStyleTypes = Animated.TransformStyleTypes;
473
194
  export type AdaptTransforms<T> = Animated.AdaptTransforms<T>;
@@ -496,14 +217,25 @@ declare module 'react-native-reanimated' {
496
217
  ROTATION = 5,
497
218
  }
498
219
 
499
- export type SensorConfig = {
220
+ export enum IOSReferenceFrame {
221
+ XArbitraryZVertical = 0,
222
+ XArbitraryCorrectedZVertical = 1,
223
+ XMagneticNorthZVertical = 2,
224
+ XTrueNorthZVertical = 3,
225
+ Auto = 4,
226
+ }
227
+
228
+ export type SensorConfig = Partial<{
500
229
  interval: number | 'auto';
501
- };
230
+ adjustToInterfaceOrientation: boolean;
231
+ iosReferenceFrame: IOSReferenceFrame;
232
+ }>;
502
233
 
503
234
  export type Value3D = {
504
235
  x: number;
505
236
  y: number;
506
237
  z: number;
238
+ interfaceOrientation: InterfaceOrientation;
507
239
  };
508
240
 
509
241
  export type SensorValue3D = SharedValue<Value3D>;
@@ -516,6 +248,7 @@ declare module 'react-native-reanimated' {
516
248
  yaw: number;
517
249
  pitch: number;
518
250
  roll: number;
251
+ interfaceOrientation: InterfaceOrientation;
519
252
  };
520
253
 
521
254
  export type SensorValueRotation = SharedValue<ValueRotation>;
@@ -566,7 +299,14 @@ declare module 'react-native-reanimated' {
566
299
  height: SharedValue<number>;
567
300
  state: SharedValue<KeyboardState>;
568
301
  };
569
- export function useAnimatedKeyboard(): AnimatedKeyboardInfo;
302
+
303
+ export interface AnimatedKeyboardOptions {
304
+ isStatusBarTranslucentAndroid?: boolean;
305
+ }
306
+
307
+ export function useAnimatedKeyboard(
308
+ options?: AnimatedKeyboardOptions
309
+ ): AnimatedKeyboardInfo;
570
310
 
571
311
  export function useScrollViewOffset(
572
312
  aref: RefObject<Animated.ScrollView>
@@ -715,11 +455,19 @@ declare module 'react-native-reanimated' {
715
455
 
716
456
  export function processColor(color: number | string): number;
717
457
 
458
+ export type InterpolationOptions = {
459
+ gamma?: number;
460
+ useCorrectedHSVInterpolation?: boolean;
461
+ };
462
+
463
+ export function isColor(value: unknown): boolean;
464
+
718
465
  export function interpolateColor<T extends string | number>(
719
466
  value: number,
720
467
  inputRange: readonly number[],
721
468
  outputRange: readonly T[],
722
- colorSpace?: 'RGB' | 'HSV'
469
+ colorSpace?: 'RGB' | 'HSV',
470
+ options?: InterpolationOptions
723
471
  ): T;
724
472
 
725
473
  export enum ColorSpace {
@@ -750,7 +498,8 @@ declare module 'react-native-reanimated' {
750
498
  export function useInterpolateConfig(
751
499
  inputRange: readonly number[],
752
500
  outputRange: readonly (string | number)[],
753
- colorSpace?: ColorSpace
501
+ colorSpace?: ColorSpace,
502
+ options?: InterpolationOptions
754
503
  ): SharedValue<InterpolateConfig>;
755
504
 
756
505
  export function interpolateSharableColor(
@@ -1081,32 +830,6 @@ declare module 'react-native-reanimated' {
1081
830
  export class RollInRight extends ComplexAnimationBuilder {}
1082
831
  export class RollOutLeft extends ComplexAnimationBuilder {}
1083
832
  export class RollOutRight extends ComplexAnimationBuilder {}
1084
- interface EasingNodeStatic {
1085
- linear: Animated.EasingNodeFunction;
1086
- ease: Animated.EasingNodeFunction;
1087
- quad: Animated.EasingNodeFunction;
1088
- cubic: Animated.EasingNodeFunction;
1089
- poly(n: Animated.Adaptable<number>): Animated.EasingNodeFunction;
1090
- sin: Animated.EasingNodeFunction;
1091
- circle: Animated.EasingNodeFunction;
1092
- exp: Animated.EasingNodeFunction;
1093
- elastic(
1094
- bounciness?: Animated.Adaptable<number>
1095
- ): Animated.EasingNodeFunction;
1096
- back(s?: Animated.Adaptable<number>): Animated.EasingNodeFunction;
1097
- bounce: Animated.EasingNodeFunction;
1098
- bezier(
1099
- x1: number,
1100
- y1: number,
1101
- x2: number,
1102
- y2: number
1103
- ): Animated.EasingNodeFunction;
1104
- in(easing: Animated.EasingNodeFunction): Animated.EasingNodeFunction;
1105
- out(easing: Animated.EasingNodeFunction): Animated.EasingNodeFunction;
1106
- inOut(easing: Animated.EasingNodeFunction): Animated.EasingNodeFunction;
1107
- }
1108
-
1109
- export const EasingNode: EasingNodeStatic;
1110
833
 
1111
834
  interface EasingStatic {
1112
835
  linear: Animated.EasingFunction;
@@ -1139,103 +862,18 @@ declare module 'react-native-reanimated' {
1139
862
 
1140
863
  export const Easing: EasingStatic;
1141
864
 
1142
- export interface TransitioningViewProps extends ViewProps {
1143
- transition: ReactNode;
1144
- }
1145
-
1146
- export class TransitioningView extends Component<TransitioningViewProps> {
1147
- animateNextTransition(): void;
1148
- }
865
+ export function enableLayoutAnimations(flag: boolean): void;
1149
866
 
1150
- export class Transitioning extends Component {
1151
- static View: typeof TransitioningView;
1152
- }
867
+ export const Extrapolate: typeof Animated.Extrapolate;
1153
868
 
1154
- export interface TransitionProps {
1155
- delayMs?: number;
1156
- durationMs?: number;
1157
- interpolation?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut';
1158
- propagation?: 'top' | 'bottom' | 'left' | 'right';
1159
- }
869
+ type AnimationFactoryType = (values: LayoutAnimationsValues) => StyleProps;
1160
870
 
1161
- export interface TransitionInOutProps extends TransitionProps {
1162
- type?:
1163
- | 'fade'
1164
- | 'scale'
1165
- | 'slide-top'
1166
- | 'slide-bottom'
1167
- | 'slide-right'
1168
- | 'slide-left';
1169
- }
1170
- export class Transition extends Component {
1171
- static In: ComponentClass<TransitionInOutProps>;
1172
- static Out: ComponentClass<TransitionInOutProps>;
1173
- static Change: ComponentClass<TransitionProps>;
1174
- static Together: ComponentClass<{}>;
1175
- static Sequence: ComponentClass<{}>;
871
+ export class SharedTransition implements ILayoutAnimationBuilder {
872
+ animationFactory: AnimationFactoryType | null = null;
873
+ static createInstance(): SharedTransition;
874
+ static custom(animationFactory: AnimationFactoryType): SharedTransition;
875
+ custom(animationFactory: AnimationFactoryType): SharedTransition;
876
+ static build(): LayoutAnimationFunction;
877
+ build(): LayoutAnimationFunction;
1176
878
  }
1177
-
1178
- export class Clock extends Animated.Clock {}
1179
- export class Value<
1180
- T extends string | number | boolean
1181
- > extends Animated.Value<T> {}
1182
- export class Node<T> extends Animated.Node<T> {}
1183
- export const add: typeof Animated.add;
1184
- export const sub: typeof Animated.sub;
1185
- export const multiply: typeof Animated.multiply;
1186
- export const divide: typeof Animated.divide;
1187
- export const pow: typeof Animated.pow;
1188
- export const modulo: typeof Animated.modulo;
1189
- export const sqrt: typeof Animated.sqrt;
1190
- export const log: typeof Animated.log;
1191
- export const sin: typeof Animated.sin;
1192
- export const cos: typeof Animated.cos;
1193
- export const exp: typeof Animated.exp;
1194
- export const round: typeof Animated.round;
1195
- export const lessThan: typeof Animated.lessThan;
1196
- export const eq: typeof Animated.eq;
1197
- export const greaterThan: typeof Animated.greaterThan;
1198
- export const lessOrEq: typeof Animated.lessOrEq;
1199
- export const greaterOrEq: typeof Animated.greaterOrEq;
1200
- export const neq: typeof Animated.neq;
1201
- export const and: typeof Animated.and;
1202
- export const or: typeof Animated.or;
1203
- export const defined: typeof Animated.defined;
1204
- export const not: typeof Animated.not;
1205
- export const tan: typeof Animated.tan;
1206
- export const acos: typeof Animated.acos;
1207
- export const asin: typeof Animated.asin;
1208
- export const atan: typeof Animated.atan;
1209
- export const proc: typeof Animated.proc;
1210
- export const block: typeof Animated.block;
1211
- export const concat: typeof Animated.concat;
1212
- export const event: typeof Animated.event;
1213
- export const call: typeof Animated.call;
1214
- export const debug: typeof Animated.debug;
1215
- export const clockRunning: typeof Animated.clockRunning;
1216
- export const stopClock: typeof Animated.stopClock;
1217
- export const startClock: typeof Animated.startClock;
1218
- export const set: typeof Animated.set;
1219
- export const cond: typeof Animated.cond;
1220
- export const abs: typeof Animated.abs;
1221
- export const acc: typeof Animated.acc;
1222
- export const color: typeof Animated.color;
1223
- export const interpolateColors: typeof Animated.interpolateColors;
1224
- export const diff: typeof Animated.diff;
1225
- export const diffClamp: typeof Animated.diffClamp;
1226
- export const interpolateNode: typeof Animated.interpolateNode;
1227
- export const Extrapolate: typeof Animated.Extrapolate;
1228
- export const max: typeof Animated.max;
1229
- export const min: typeof Animated.min;
1230
- export const onChange: typeof Animated.onChange;
1231
- export const floor: typeof Animated.floor;
1232
- export const ceil: typeof Animated.ceil;
1233
- export const useCode: typeof Animated.useCode;
1234
- export const decay: typeof Animated.decay;
1235
- export const timing: typeof Animated.timing;
1236
- export const spring: typeof Animated.spring;
1237
- export const SpringUtils: typeof Animated.SpringUtils;
1238
- export const useValue: typeof Animated.useValue;
1239
- export const ReverseAnimation: typeof Animated.ReverseAnimation;
1240
- export function enableLayoutAnimations(flag: boolean): void;
1241
879
  }
@@ -1,6 +1,6 @@
1
1
  def try_to_parse_react_native_package_json(node_modules_dir)
2
2
  react_native_package_json_path = File.join(node_modules_dir, 'react-native/package.json')
3
- if !File.exists?(react_native_package_json_path)
3
+ if !File.exist?(react_native_package_json_path)
4
4
  return nil
5
5
  end
6
6
  return JSON.parse(File.read(react_native_package_json_path))
@@ -34,6 +34,9 @@ def find_config()
34
34
  result[:is_tvos_target] = react_native_json['name'] == 'react-native-tvos'
35
35
  result[:react_native_version] = react_native_json['version']
36
36
  result[:react_native_minor_version] = react_native_json['version'].split('.')[1].to_i
37
+ if result[:react_native_minor_version] == 0 # nightly
38
+ result[:react_native_minor_version] = 1000
39
+ end
37
40
  result[:react_native_node_modules_dir] = File.expand_path(react_native_node_modules_dir)
38
41
  result[:reanimated_node_modules_dir] = File.expand_path(File.join(__dir__, '..', '..'))
39
42
 
@@ -65,7 +68,7 @@ def assert_no_multiple_instances(react_native_info)
65
68
  location['/package.json'] = ''
66
69
  parsed_location += "- " + location + "\n"
67
70
  end
68
- raise "[react-native-reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/next/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsed_location
71
+ raise "[react-native-reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting/#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsed_location
69
72
  end
70
73
  end
71
74
 
@@ -76,3 +79,13 @@ def assert_no_reanimated2_with_new_architecture(reanimated_package_json)
76
79
  raise "[react-native-reanimated] Reanimated 2.x does not support Fabric. Please upgrade to 3.x to use Reanimated with the New Architecture. For details, see https://blog.swmansion.com/announcing-reanimated-3-16167428c5f7"
77
80
  end
78
81
  end
82
+
83
+ def assert_latest_react_native_with_new_architecture(config, reanimated_package_json)
84
+ reanimated_version = reanimated_package_json['version']
85
+ reanimated_major_version = reanimated_version.split('.')[0].to_i
86
+ react_native_minor_version = config[:react_native_minor_version]
87
+ fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
88
+ if fabric_enabled && reanimated_major_version == 3 && react_native_minor_version < 71
89
+ raise "[react-native-reanimated] Reanimated " + reanimated_version + " supports the New Architecture only on the latest minor release of React Native. Please upgrade to React Native 0.71.0+ or downgrade to an older version of Reanimated v3"
90
+ end
91
+ end