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
@@ -114,7 +114,8 @@ declare module 'react-native-reanimated' {
114
114
  export type Adaptable<T> =
115
115
  | T
116
116
  | AnimatedNode<T>
117
- | ReadonlyArray<T | AnimatedNode<T> | ReadonlyArray<T | AnimatedNode<T>>>;
117
+ | ReadonlyArray<T | AnimatedNode<T> | ReadonlyArray<T | AnimatedNode<T>>>
118
+ | SharedValue<T>;
118
119
  type BinaryOperator<T = number> = (
119
120
  left: Adaptable<number>,
120
121
  right: Adaptable<number>
@@ -150,7 +151,8 @@ declare module 'react-native-reanimated' {
150
151
  | AnimatedNode<
151
152
  // allow `number` where `string` normally is to support colors
152
153
  S[K] extends ColorValue | undefined ? S[K] | number : S[K]
153
- >;
154
+ >
155
+ | SharedValue<AnimatableValue>;
154
156
  };
155
157
 
156
158
  export type StylesOrDefault<T> = 'style' extends keyof T
@@ -158,7 +160,7 @@ declare module 'react-native-reanimated' {
158
160
  : Record<string, unknown>;
159
161
 
160
162
  export type AnimateProps<P extends object> = {
161
- [K in keyof Omit<P, 'style'>]: P[K] | AnimatedNode<P[K]>;
163
+ [K in keyof Omit<P, 'style'>]: P[K] | AnimatedNode<P[K]> | SharedValue<P[K]>;
162
164
  } & {
163
165
  style?: StyleProp<AnimateStyle<StylesOrDefault<P>>>;
164
166
  } & {
@@ -177,6 +179,8 @@ declare module 'react-native-reanimated' {
177
179
  | typeof BaseAnimationBuilder
178
180
  | EntryExitAnimationFunction
179
181
  | Keyframe;
182
+ sharedTransitionTag?: string;
183
+ sharedTransitionStyle?: ILayoutAnimationBuilder;
180
184
  };
181
185
 
182
186
  export interface PhysicsAnimationState extends AnimationState {
@@ -278,8 +282,12 @@ declare module 'react-native-reanimated' {
278
282
  export interface ScrollView extends ReactNativeScrollView {}
279
283
 
280
284
  export class Code extends Component<CodeProps> {}
281
- export class FlatList<T> extends Component<AnimateProps<FlatListProps<T>>> {
282
- itemLayoutAnimation: ILayoutAnimationBuilder;
285
+ export interface FlatListPropsWithLayout<T> extends FlatListProps<T> {
286
+ itemLayoutAnimation?: ILayoutAnimationBuilder;
287
+ }
288
+ export class FlatList<T> extends Component<
289
+ AnimateProps<FlatListPropsWithLayout<T>>
290
+ > {
283
291
  getNode(): ReactNativeFlatList;
284
292
  }
285
293
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -496,14 +504,25 @@ declare module 'react-native-reanimated' {
496
504
  ROTATION = 5,
497
505
  }
498
506
 
499
- export type SensorConfig = {
507
+ export enum IOSReferenceFrame {
508
+ XArbitraryZVertical = 0,
509
+ XArbitraryCorrectedZVertical = 1,
510
+ XMagneticNorthZVertical = 2,
511
+ XTrueNorthZVertical = 3,
512
+ Auto = 4,
513
+ }
514
+
515
+ export type SensorConfig = Partial<{
500
516
  interval: number | 'auto';
501
- };
517
+ adjustToInterfaceOrientation: boolean;
518
+ iosReferenceFrame: IOSReferenceFrame;
519
+ }>;
502
520
 
503
521
  export type Value3D = {
504
522
  x: number;
505
523
  y: number;
506
524
  z: number;
525
+ interfaceOrientation: InterfaceOrientation;
507
526
  };
508
527
 
509
528
  export type SensorValue3D = SharedValue<Value3D>;
@@ -516,6 +535,7 @@ declare module 'react-native-reanimated' {
516
535
  yaw: number;
517
536
  pitch: number;
518
537
  roll: number;
538
+ interfaceOrientation: InterfaceOrientation;
519
539
  };
520
540
 
521
541
  export type SensorValueRotation = SharedValue<ValueRotation>;
@@ -566,7 +586,14 @@ declare module 'react-native-reanimated' {
566
586
  height: SharedValue<number>;
567
587
  state: SharedValue<KeyboardState>;
568
588
  };
569
- export function useAnimatedKeyboard(): AnimatedKeyboardInfo;
589
+
590
+ export interface AnimatedKeyboardOptions {
591
+ isStatusBarTranslucentAndroid?: boolean;
592
+ }
593
+
594
+ export function useAnimatedKeyboard(
595
+ options?: AnimatedKeyboardOptions
596
+ ): AnimatedKeyboardInfo;
570
597
 
571
598
  export function useScrollViewOffset(
572
599
  aref: RefObject<Animated.ScrollView>
@@ -715,11 +742,19 @@ declare module 'react-native-reanimated' {
715
742
 
716
743
  export function processColor(color: number | string): number;
717
744
 
745
+ export type InterpolationOptions = {
746
+ gamma?: number;
747
+ useCorrectedHSVInterpolation?: boolean;
748
+ };
749
+
750
+ export function isColor(value: unknown): boolean;
751
+
718
752
  export function interpolateColor<T extends string | number>(
719
753
  value: number,
720
754
  inputRange: readonly number[],
721
755
  outputRange: readonly T[],
722
- colorSpace?: 'RGB' | 'HSV'
756
+ colorSpace?: 'RGB' | 'HSV',
757
+ options?: InterpolationOptions
723
758
  ): T;
724
759
 
725
760
  export enum ColorSpace {
@@ -750,7 +785,8 @@ declare module 'react-native-reanimated' {
750
785
  export function useInterpolateConfig(
751
786
  inputRange: readonly number[],
752
787
  outputRange: readonly (string | number)[],
753
- colorSpace?: ColorSpace
788
+ colorSpace?: ColorSpace,
789
+ options?: InterpolationOptions
754
790
  ): SharedValue<InterpolateConfig>;
755
791
 
756
792
  export function interpolateSharableColor(
@@ -1238,4 +1274,15 @@ declare module 'react-native-reanimated' {
1238
1274
  export const useValue: typeof Animated.useValue;
1239
1275
  export const ReverseAnimation: typeof Animated.ReverseAnimation;
1240
1276
  export function enableLayoutAnimations(flag: boolean): void;
1277
+
1278
+ type AnimationFactoryType = (values: LayoutAnimationsValues) => StyleProps;
1279
+
1280
+ export class SharedTransition implements ILayoutAnimationBuilder {
1281
+ animationFactory: AnimationFactoryType | null = null;
1282
+ static createInstance(): SharedTransition;
1283
+ static custom(animationFactory: AnimationFactoryType): SharedTransition;
1284
+ custom(animationFactory: AnimationFactoryType): SharedTransition;
1285
+ static build(): LayoutAnimationFunction;
1286
+ build(): LayoutAnimationFunction;
1287
+ }
1241
1288
  }
@@ -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
@@ -10,6 +10,8 @@ import {
10
10
  configureLayoutAnimations,
11
11
  enableLayoutAnimations,
12
12
  runOnUI,
13
+ startMapper,
14
+ stopMapper,
13
15
  } from './reanimated2/core';
14
16
  import {
15
17
  isJest,
@@ -19,9 +21,11 @@ import {
19
21
  import { initialUpdaterRun } from './reanimated2/animation';
20
22
  import {
21
23
  BaseAnimationBuilder,
24
+ DefaultSharedTransition,
22
25
  EntryExitAnimationFunction,
23
26
  ILayoutAnimationBuilder,
24
27
  LayoutAnimationFunction,
28
+ LayoutAnimationType,
25
29
  } from './reanimated2/layoutReanimation';
26
30
  import {
27
31
  SharedValue,
@@ -29,11 +33,14 @@ import {
29
33
  ShadowNodeWrapper,
30
34
  } from './reanimated2/commonTypes';
31
35
  import {
36
+ makeViewDescriptorsSet,
32
37
  ViewDescriptorsSet,
33
38
  ViewRefSet,
34
39
  } from './reanimated2/ViewDescriptorsSet';
35
40
  import { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';
36
- import { makeShareableShadowNodeWrapper } from './reanimated2/shareables';
41
+ import updateProps from './reanimated2/UpdateProps';
42
+ import NativeReanimatedModule from './reanimated2/NativeReanimated';
43
+ import { isSharedValue } from './reanimated2';
37
44
 
38
45
  function dummyListener() {
39
46
  // empty listener we use to assign to listener properties for which animated
@@ -108,6 +115,78 @@ const has = <K extends string>(
108
115
  return false;
109
116
  };
110
117
 
118
+ function isInlineStyleTransform(transform: any): boolean {
119
+ return transform.some((t: Record<string, any>) => hasInlineStyles(t));
120
+ }
121
+
122
+ function hasInlineStyles(style: StyleProps): boolean {
123
+ return Object.keys(style).some((key) => {
124
+ const styleValue = style[key];
125
+ return (
126
+ isSharedValue(styleValue) ||
127
+ (key === 'transform' && isInlineStyleTransform(styleValue))
128
+ );
129
+ });
130
+ }
131
+
132
+ function extractSharedValuesMapFromProps(
133
+ props: AnimatedComponentProps<InitialComponentProps>
134
+ ): Record<string, any> {
135
+ const inlineProps: Record<string, any> = {};
136
+
137
+ for (const key in props) {
138
+ const value = props[key];
139
+ if (key === 'style') {
140
+ const styles = flattenArray<StyleProps>(props.style ?? []);
141
+ styles.forEach((style) => {
142
+ for (const [key, styleValue] of Object.entries(style)) {
143
+ if (isSharedValue(styleValue)) {
144
+ inlineProps[key] = styleValue;
145
+ } else if (
146
+ key === 'transform' &&
147
+ isInlineStyleTransform(styleValue)
148
+ ) {
149
+ inlineProps[key] = styleValue;
150
+ }
151
+ }
152
+ });
153
+ } else if (isSharedValue(value)) {
154
+ inlineProps[key] = value;
155
+ }
156
+ }
157
+
158
+ return inlineProps;
159
+ }
160
+
161
+ function inlinePropsHasChanged(styles1: StyleProps, styles2: StyleProps) {
162
+ if (Object.keys(styles1).length !== Object.keys(styles2).length) {
163
+ return true;
164
+ }
165
+
166
+ for (const key of Object.keys(styles1)) {
167
+ if (styles1[key] !== styles2[key]) return true;
168
+ }
169
+
170
+ return false;
171
+ }
172
+
173
+ function getInlinePropsUpdate(inlineProps: Record<string, any>) {
174
+ 'worklet';
175
+ const update: Record<string, any> = {};
176
+ for (const [key, styleValue] of Object.entries(inlineProps)) {
177
+ if (key === 'transform') {
178
+ update[key] = styleValue.map((transform: Record<string, any>) => {
179
+ return getInlinePropsUpdate(transform);
180
+ });
181
+ } else if (isSharedValue(styleValue)) {
182
+ update[key] = styleValue.value;
183
+ } else {
184
+ update[key] = styleValue;
185
+ }
186
+ }
187
+ return update;
188
+ }
189
+
111
190
  interface AnimatedProps extends Record<string, unknown> {
112
191
  viewDescriptors?: ViewDescriptorsSet;
113
192
  viewsRef?: ViewRefSet<unknown>;
@@ -133,6 +212,8 @@ export type AnimatedComponentProps<P extends Record<string, unknown>> = P & {
133
212
  | typeof BaseAnimationBuilder
134
213
  | EntryExitAnimationFunction
135
214
  | Keyframe;
215
+ sharedTransitionTag?: string;
216
+ sharedTransitionStyle?: ILayoutAnimationBuilder;
136
217
  };
137
218
 
138
219
  type Options<P> = {
@@ -170,6 +251,9 @@ export default function createAnimatedComponent(
170
251
  animatedStyle: { value: StyleProps } = { value: {} };
171
252
  initialStyle = {};
172
253
  _component: ComponentRef | null = null;
254
+ _inlinePropsViewDescriptors: ViewDescriptorsSet | null = null;
255
+ _inlinePropsMapperId: number | null = null;
256
+ _inlineProps: StyleProps = {};
173
257
  static displayName: string;
174
258
 
175
259
  constructor(props: AnimatedComponentProps<InitialComponentProps>) {
@@ -182,15 +266,27 @@ export default function createAnimatedComponent(
182
266
  componentWillUnmount() {
183
267
  this._detachNativeEvents();
184
268
  this._detachStyles();
269
+ this._detachInlineProps();
185
270
  }
186
271
 
187
272
  componentDidMount() {
188
273
  this._attachNativeEvents();
189
274
  this._attachAnimatedStyles();
275
+ this._attachInlineProps();
276
+ }
277
+
278
+ _getEventViewRef() {
279
+ // Make sure to get the scrollable node for components that implement
280
+ // `ScrollResponder.Mixin`.
281
+ return this._component?.getScrollableNode
282
+ ? this._component.getScrollableNode()
283
+ : this._component;
190
284
  }
191
285
 
192
286
  _attachNativeEvents() {
193
- const viewTag = findNodeHandle(this);
287
+ const node = this._getEventViewRef();
288
+ const viewTag = findNodeHandle(options?.setNativeProps ? this : node);
289
+
194
290
  for (const key in this.props) {
195
291
  const prop = this.props[key];
196
292
  if (
@@ -229,10 +325,10 @@ export default function createAnimatedComponent(
229
325
  this.props.animatedProps.viewDescriptors.remove(this._viewTag);
230
326
  }
231
327
  if (global._IS_FABRIC) {
232
- const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);
328
+ const viewTag = this._viewTag;
233
329
  runOnUI(() => {
234
330
  'worklet';
235
- _removeShadowNodeFromRegistry(shadowNodeWrapper);
331
+ _removeShadowNodeFromRegistry(viewTag);
236
332
  })();
237
333
  }
238
334
  }
@@ -289,23 +385,16 @@ export default function createAnimatedComponent(
289
385
  }
290
386
  }
291
387
 
292
- _attachAnimatedStyles() {
293
- const styles = this.props.style
294
- ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))
295
- : [];
296
- const prevStyles = this._styles;
297
- this._styles = styles;
298
-
299
- const prevAnimatedProps = this._animatedProps;
300
- this._animatedProps = this.props.animatedProps;
301
-
388
+ _getViewInfo() {
302
389
  let viewTag: number | null;
303
390
  let viewName: string | null;
304
391
  let shadowNodeWrapper: ShadowNodeWrapper | null = null;
392
+ let viewConfig;
305
393
  if (Platform.OS === 'web') {
306
394
  viewTag = findNodeHandle(this);
307
395
  viewName = null;
308
396
  shadowNodeWrapper = null;
397
+ viewConfig = null;
309
398
  } else {
310
399
  // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx
311
400
  const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);
@@ -321,19 +410,36 @@ export default function createAnimatedComponent(
321
410
  * The name we're looking for is in the field named uiViewClassName.
322
411
  */
323
412
  viewName = hostInstance?.viewConfig?.uiViewClassName;
324
- // update UI props whitelist for this view
325
- const hasReanimated2Props =
326
- this.props.animatedProps?.viewDescriptors || styles.length;
327
- if (hasReanimated2Props && hostInstance?.viewConfig) {
328
- adaptViewConfig(hostInstance.viewConfig);
329
- }
413
+
414
+ viewConfig = hostInstance?.viewConfig;
330
415
 
331
416
  if (global._IS_FABRIC) {
332
- shadowNodeWrapper = makeShareableShadowNodeWrapper(
333
- getShadowNodeWrapperFromRef(this)
334
- );
417
+ shadowNodeWrapper = getShadowNodeWrapperFromRef(this);
335
418
  }
336
419
  }
420
+ return { viewTag, viewName, shadowNodeWrapper, viewConfig };
421
+ }
422
+
423
+ _attachAnimatedStyles() {
424
+ const styles = this.props.style
425
+ ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))
426
+ : [];
427
+ const prevStyles = this._styles;
428
+ this._styles = styles;
429
+
430
+ const prevAnimatedProps = this._animatedProps;
431
+ this._animatedProps = this.props.animatedProps;
432
+
433
+ const { viewTag, viewName, shadowNodeWrapper, viewConfig } =
434
+ this._getViewInfo();
435
+
436
+ // update UI props whitelist for this view
437
+ const hasReanimated2Props =
438
+ this.props.animatedProps?.viewDescriptors || styles.length;
439
+ if (hasReanimated2Props && viewConfig) {
440
+ adaptViewConfig(viewConfig);
441
+ }
442
+
337
443
  this._viewTag = viewTag as number;
338
444
 
339
445
  // remove old styles
@@ -399,11 +505,72 @@ export default function createAnimatedComponent(
399
505
  }
400
506
  }
401
507
 
508
+ _attachInlineProps() {
509
+ const newInlineProps: Record<string, any> =
510
+ extractSharedValuesMapFromProps(this.props);
511
+ const hasChanged = inlinePropsHasChanged(
512
+ newInlineProps,
513
+ this._inlineProps
514
+ );
515
+
516
+ if (hasChanged) {
517
+ if (!this._inlinePropsViewDescriptors) {
518
+ this._inlinePropsViewDescriptors = makeViewDescriptorsSet();
519
+
520
+ const { viewTag, viewName, shadowNodeWrapper, viewConfig } =
521
+ this._getViewInfo();
522
+
523
+ if (Object.keys(newInlineProps).length && viewConfig) {
524
+ adaptViewConfig(viewConfig);
525
+ }
526
+
527
+ this._inlinePropsViewDescriptors.add({
528
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
529
+ tag: viewTag!,
530
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
531
+ name: viewName!,
532
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
533
+ shadowNodeWrapper: shadowNodeWrapper!,
534
+ });
535
+ }
536
+ const sharableViewDescriptors =
537
+ this._inlinePropsViewDescriptors.sharableViewDescriptors;
538
+
539
+ const maybeViewRef = NativeReanimatedModule.native
540
+ ? undefined
541
+ : ({ items: new Set([this]) } as ViewRefSet<any>); // see makeViewsRefSet
542
+
543
+ const updaterFunction = () => {
544
+ 'worklet';
545
+ const update = getInlinePropsUpdate(newInlineProps);
546
+ updateProps(sharableViewDescriptors, update, maybeViewRef);
547
+ };
548
+ this._inlineProps = newInlineProps;
549
+ if (this._inlinePropsMapperId) {
550
+ stopMapper(this._inlinePropsMapperId);
551
+ }
552
+ this._inlinePropsMapperId = null;
553
+ if (Object.keys(newInlineProps).length) {
554
+ this._inlinePropsMapperId = startMapper(
555
+ updaterFunction,
556
+ Object.values(newInlineProps)
557
+ );
558
+ }
559
+ }
560
+ }
561
+
562
+ _detachInlineProps() {
563
+ if (this._inlinePropsMapperId) {
564
+ stopMapper(this._inlinePropsMapperId);
565
+ }
566
+ }
567
+
402
568
  componentDidUpdate(
403
569
  prevProps: AnimatedComponentProps<InitialComponentProps>
404
570
  ) {
405
571
  this._reattachNativeEvents(prevProps);
406
572
  this._attachAnimatedStyles();
573
+ this._attachInlineProps();
407
574
  }
408
575
 
409
576
  _setComponentRef = setAndForwardRef<Component>({
@@ -414,19 +581,44 @@ export default function createAnimatedComponent(
414
581
  setLocalRef: (ref) => {
415
582
  // TODO update config
416
583
  const tag = findNodeHandle(ref);
417
- const { layout, entering, exiting } = this.props;
418
- if ((layout || entering || exiting) && tag != null) {
584
+ const { layout, entering, exiting, sharedTransitionTag } = this.props;
585
+ if (
586
+ (layout || entering || exiting || sharedTransitionTag) &&
587
+ tag != null
588
+ ) {
419
589
  if (!shouldBeUseWeb()) {
420
590
  enableLayoutAnimations(true, false);
421
591
  }
422
592
  if (layout) {
423
- configureLayoutAnimations(tag, 'layout', maybeBuild(layout));
593
+ configureLayoutAnimations(
594
+ tag,
595
+ LayoutAnimationType.LAYOUT,
596
+ maybeBuild(layout)
597
+ );
424
598
  }
425
599
  if (entering) {
426
- configureLayoutAnimations(tag, 'entering', maybeBuild(entering));
600
+ configureLayoutAnimations(
601
+ tag,
602
+ LayoutAnimationType.ENTERING,
603
+ maybeBuild(entering)
604
+ );
427
605
  }
428
606
  if (exiting) {
429
- configureLayoutAnimations(tag, 'exiting', maybeBuild(exiting));
607
+ configureLayoutAnimations(
608
+ tag,
609
+ LayoutAnimationType.EXITING,
610
+ maybeBuild(exiting)
611
+ );
612
+ }
613
+ if (sharedTransitionTag) {
614
+ const sharedElementTransition =
615
+ this.props.sharedTransitionStyle ?? DefaultSharedTransition;
616
+ configureLayoutAnimations(
617
+ tag,
618
+ LayoutAnimationType.SHARED_ELEMENT_TRANSITION,
619
+ maybeBuild(sharedElementTransition),
620
+ sharedTransitionTag
621
+ );
430
622
  }
431
623
  }
432
624
 
@@ -456,6 +648,20 @@ export default function createAnimatedComponent(
456
648
  };
457
649
  }
458
650
  return this.initialStyle;
651
+ } else if (hasInlineStyles(style)) {
652
+ if (this._isFirstRender) {
653
+ return getInlinePropsUpdate(style);
654
+ }
655
+ const newStyle: StyleProps = {};
656
+ for (const [key, styleValue] of Object.entries(style)) {
657
+ if (
658
+ !isSharedValue(styleValue) &&
659
+ !(key === 'transform' && isInlineStyleTransform(styleValue))
660
+ ) {
661
+ newStyle[key] = styleValue;
662
+ }
663
+ }
664
+ return newStyle;
459
665
  } else {
460
666
  return style;
461
667
  }
@@ -486,6 +692,10 @@ export default function createAnimatedComponent(
486
692
  } else {
487
693
  props[key] = dummyListener;
488
694
  }
695
+ } else if (isSharedValue(value)) {
696
+ if (this._isFirstRender) {
697
+ props[key] = (value as SharedValue<any>).value;
698
+ }
489
699
  } else if (
490
700
  key !== 'onGestureHandlerStateChange' ||
491
701
  !isChromeDebugger()
@@ -573,11 +573,12 @@ function HSVtoRGB(h: any, s?: any, v?: any) {
573
573
  export const hsvToColor = (
574
574
  h: number,
575
575
  s: number,
576
- v: number
576
+ v: number,
577
+ a: number
577
578
  ): number | string => {
578
579
  'worklet';
579
580
  const { r, g, b } = HSVtoRGB(h, s, v);
580
- return rgbaColor(r, g, b);
581
+ return rgbaColor(r, g, b, a);
581
582
  };
582
583
 
583
584
  export function processColorInitially(
@@ -634,19 +635,45 @@ export function processColor(color: unknown): number | null | undefined {
634
635
 
635
636
  export type ParsedColorArray = [number, number, number, number];
636
637
 
637
- export function convertToHSVA(color: unknown): ParsedColorArray {
638
+ export function convertToRGBA(color: unknown): ParsedColorArray {
638
639
  'worklet';
639
640
  const processedColor = processColorInitially(color)!; // argb;
640
641
  const a = (processedColor >>> 24) / 255;
641
- const r = (processedColor << 8) >>> 24;
642
- const g = (processedColor << 16) >>> 24;
643
- const b = (processedColor << 24) >>> 24;
644
- const { h, s, v } = RGBtoHSV(r, g, b);
645
- return [h, s, v, a];
642
+ const r = ((processedColor << 8) >>> 24) / 255;
643
+ const g = ((processedColor << 16) >>> 24) / 255;
644
+ const b = ((processedColor << 24) >>> 24) / 255;
645
+ return [r, g, b, a];
646
646
  }
647
647
 
648
- export function toRGBA(HSVA: ParsedColorArray): string {
648
+ export function rgbaArrayToRGBAColor(RGBA: ParsedColorArray): string {
649
649
  'worklet';
650
- const { r, g, b } = HSVtoRGB(HSVA[0], HSVA[1], HSVA[2]);
651
- return `rgba(${r}, ${g}, ${b}, ${HSVA[3]})`;
650
+ return `rgba(${Math.round(RGBA[0] * 255)}, ${Math.round(
651
+ RGBA[1] * 255
652
+ )}, ${Math.round(RGBA[2] * 255)}, ${RGBA[3]})`;
653
+ }
654
+
655
+ export function toLinearSpace(
656
+ RGBA: ParsedColorArray,
657
+ gamma = 2.2
658
+ ): ParsedColorArray {
659
+ 'worklet';
660
+ const res = [];
661
+ for (let i = 0; i < 3; ++i) {
662
+ res.push(Math.pow(RGBA[i], gamma));
663
+ }
664
+ res.push(RGBA[3]);
665
+ return res as ParsedColorArray;
666
+ }
667
+
668
+ export function toGammaSpace(
669
+ RGBA: ParsedColorArray,
670
+ gamma = 2.2
671
+ ): ParsedColorArray {
672
+ 'worklet';
673
+ const res = [];
674
+ for (let i = 0; i < 3; ++i) {
675
+ res.push(Math.pow(RGBA[i], 1 / gamma));
676
+ }
677
+ res.push(RGBA[3]);
678
+ return res as ParsedColorArray;
652
679
  }