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
@@ -6,7 +6,6 @@ import type {
6
6
  ShareableRef,
7
7
  ShareableSyncDataHolderRef,
8
8
  } from './commonTypes';
9
- import type { ReanimatedConsole } from './core';
10
9
  import type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';
11
10
  import type { ShadowNodeWrapper } from './hook/commonTypes';
12
11
  import { LayoutAnimationStartFunction } from './layoutReanimation';
@@ -16,14 +15,20 @@ declare global {
16
15
  const _WORKLET: boolean;
17
16
  const _IS_FABRIC: boolean;
18
17
  const _REANIMATED_VERSION_CPP: string;
19
- const _frameTimestamp: number | null;
20
- const _eventTimestamp: number;
21
18
  const __reanimatedModuleProxy: NativeReanimated;
22
- const _setGlobalConsole: (console?: ReanimatedConsole) => void;
19
+ const evalWithSourceMap: (
20
+ js: string,
21
+ sourceURL: string,
22
+ sourceMap: string
23
+ ) => any;
24
+ const evalWithSourceUrl: (js: string, sourceURL: string) => any;
23
25
  const _log: (s: string) => void;
24
26
  const _getCurrentTime: () => number;
25
- const _getTimestamp: () => number;
26
- const _notifyAboutProgress: (tag: number, value: number) => void;
27
+ const _notifyAboutProgress: (
28
+ tag: number,
29
+ value: number,
30
+ isSharedTransition: boolean
31
+ ) => void;
27
32
  const _notifyAboutEnd: (
28
33
  tag: number,
29
34
  finished: boolean,
@@ -45,9 +50,7 @@ declare global {
45
50
  shadowNodeWrapper: ShadowNodeWrapper,
46
51
  props: StyleProps | AnimatedStyle
47
52
  ) => void;
48
- const _removeShadowNodeFromRegistry: (
49
- shadowNodeWrapper: ShadowNodeWrapper
50
- ) => void;
53
+ const _removeShadowNodeFromRegistry: (viewTag: number) => void;
51
54
  const _measure: (viewTag: number) => MeasuredDimensions;
52
55
  const _scrollTo: (
53
56
  viewTag: number,
@@ -60,25 +63,33 @@ declare global {
60
63
  commandName: string,
61
64
  args: Array<unknown>
62
65
  ) => void;
63
- const _chronoNow: () => number;
64
66
  const performance: { now: () => number };
65
67
  const ReanimatedDataMock: {
66
68
  now: () => number;
67
69
  };
70
+ const ErrorUtils: {
71
+ reportFatalError: (error: Error) => void;
72
+ };
68
73
  const _frameCallbackRegistry: FrameCallbackRegistryUI;
74
+ const requestAnimationFrame: (callback: (time: number) => void) => number;
75
+ const setImmediate: (callback: (time: number) => void) => number;
76
+ const console: Console;
69
77
 
70
78
  namespace NodeJS {
71
79
  interface Global {
72
80
  _WORKLET: boolean;
73
81
  _IS_FABRIC: boolean;
74
82
  _REANIMATED_VERSION_CPP: string;
75
- _frameTimestamp: number | null;
76
- _eventTimestamp: number;
77
83
  __reanimatedModuleProxy: NativeReanimated;
78
- _setGlobalConsole: (console?: ReanimatedConsole) => void;
84
+ __frameTimestamp?: number;
85
+ evalWithSourceMap: (
86
+ js: string,
87
+ sourceURL: string,
88
+ sourceMap: string
89
+ ) => any;
90
+ evalWithSourceUrl: (js: string, sourceURL: string) => any;
79
91
  _log: (s: string) => void;
80
92
  _getCurrentTime: () => number;
81
- _getTimestamp: () => number;
82
93
  _setGestureState: (handlerTag: number, newState: number) => void;
83
94
  _makeShareableClone: (value: any) => any;
84
95
  _updateDataSynchronously: (
@@ -95,9 +106,7 @@ declare global {
95
106
  shadowNodeWrapper: ShadowNodeWrapper,
96
107
  props: StyleProps | AnimatedStyle
97
108
  ) => void;
98
- _removeShadowNodeFromRegistry: (
99
- shadowNodeWrapper: ShadowNodeWrapper
100
- ) => void;
109
+ _removeShadowNodeFromRegistry: (viewTag: number) => void;
101
110
  _measure: (viewTag: number) => MeasuredDimensions;
102
111
  _scrollTo: (
103
112
  viewTag: number,
@@ -110,7 +119,6 @@ declare global {
110
119
  commandName: string,
111
120
  args: Array<unknown>
112
121
  ) => void;
113
- _chronoNow: () => number;
114
122
  performance: { now: () => number };
115
123
  LayoutAnimationsManager: {
116
124
  start: LayoutAnimationStartFunction;
@@ -118,10 +126,18 @@ declare global {
118
126
  ReanimatedDataMock: {
119
127
  now: () => number;
120
128
  };
129
+ ErrorUtils: {
130
+ reportFatalError: (error: Error) => void;
131
+ };
121
132
  _frameCallbackRegistry: FrameCallbackRegistryUI;
122
133
  __workletsCache?: Map<string, (...args: any[]) => any>;
123
134
  __handleCache?: WeakMap<any, any>;
124
135
  __mapperRegistry?: MapperRegistry;
136
+ __flushImmediates: () => void;
137
+ __flushAnimationFrame: (frameTimestamp: number) => void;
138
+ requestAnimationFrame: (callback: (time: number) => void) => number;
139
+ setImmediate: (callback: (time: number) => void) => number;
140
+ console: Console;
125
141
  }
126
142
  }
127
143
  }
@@ -20,7 +20,7 @@ export { useAnimatedScrollHandler } from './useAnimatedScrollHandler';
20
20
  export type { ScrollHandler, ScrollHandlers } from './useAnimatedScrollHandler';
21
21
  export { useDerivedValue } from './useDerivedValue';
22
22
  export type { DerivedValue } from './useDerivedValue';
23
- export { useAnimatedSensor, SensorType } from './useAnimatedSensor';
23
+ export { useAnimatedSensor } from './useAnimatedSensor';
24
24
  export { useFrameCallback } from './useFrameCallback';
25
25
  export type { FrameCallback } from './useFrameCallback';
26
26
  export { useAnimatedKeyboard } from './useAnimatedKeyboard';
@@ -4,9 +4,15 @@ import {
4
4
  subscribeForKeyboardEvents,
5
5
  unsubscribeFromKeyboardEvents,
6
6
  } from '../core';
7
- import { AnimatedKeyboardInfo, KeyboardState } from '../commonTypes';
7
+ import {
8
+ AnimatedKeyboardInfo,
9
+ AnimatedKeyboardOptions,
10
+ KeyboardState,
11
+ } from '../commonTypes';
8
12
 
9
- export function useAnimatedKeyboard(): AnimatedKeyboardInfo {
13
+ export function useAnimatedKeyboard(
14
+ options: AnimatedKeyboardOptions = { isStatusBarTranslucentAndroid: false }
15
+ ): AnimatedKeyboardInfo {
10
16
  const ref = useRef<AnimatedKeyboardInfo | null>(null);
11
17
  const listenerId = useRef<number>(-1);
12
18
  const isSubscribed = useRef<boolean>(false);
@@ -20,7 +26,7 @@ export function useAnimatedKeyboard(): AnimatedKeyboardInfo {
20
26
  'worklet';
21
27
  keyboardEventData.state.value = state;
22
28
  keyboardEventData.height.value = height;
23
- });
29
+ }, options);
24
30
  ref.current = keyboardEventData;
25
31
  isSubscribed.current = true;
26
32
  }
@@ -32,7 +38,7 @@ export function useAnimatedKeyboard(): AnimatedKeyboardInfo {
32
38
  'worklet';
33
39
  keyboardEventData.state.value = state;
34
40
  keyboardEventData.height.value = height;
35
- });
41
+ }, options);
36
42
  isSubscribed.current = true;
37
43
  }
38
44
  return () => {
@@ -3,6 +3,7 @@ import { BasicWorkletFunction, WorkletFunction } from '../commonTypes';
3
3
  import { startMapper, stopMapper } from '../core';
4
4
  import { DependencyList } from './commonTypes';
5
5
  import { useSharedValue } from './useSharedValue';
6
+ import { shouldBeUseWeb } from '../PlatformChecker';
6
7
 
7
8
  export interface AnimatedReactionWorkletFunction<T> extends WorkletFunction {
8
9
  (prepared: T, previous: T | null): void;
@@ -19,6 +20,16 @@ export function useAnimatedReaction<T>(
19
20
  dependencies: DependencyList
20
21
  ): void {
21
22
  const previous = useSharedValue<T | null>(null);
23
+
24
+ let inputs = Object.values(prepare._closure ?? {});
25
+
26
+ if (shouldBeUseWeb()) {
27
+ if (!inputs.length && dependencies?.length) {
28
+ // let web work without a Babel/SWC plugin
29
+ inputs = dependencies;
30
+ }
31
+ }
32
+
22
33
  if (dependencies === undefined) {
23
34
  dependencies = [
24
35
  Object.values(prepare._closure ?? {}),
@@ -37,11 +48,7 @@ export function useAnimatedReaction<T>(
37
48
  react(input, previous.value);
38
49
  previous.value = input;
39
50
  };
40
- const mapperId = startMapper(
41
- fun,
42
- Object.values(prepare._closure ?? {}),
43
- []
44
- );
51
+ const mapperId = startMapper(fun, inputs, []);
45
52
  return () => {
46
53
  stopMapper(mapperId);
47
54
  };
@@ -6,16 +6,13 @@ import { getTag } from '../NativeMethods';
6
6
  import { getShadowNodeWrapperFromHostInstance } from '../fabricUtils';
7
7
  import {
8
8
  makeShareableCloneRecursive,
9
- makeShareableShadowNodeWrapper,
10
9
  registerShareableMapping,
11
10
  } from '../shareables';
12
11
 
13
12
  function getShareableShadowNodeFromComponent(
14
13
  component: Component
15
14
  ): ShadowNodeWrapper {
16
- return makeShareableShadowNodeWrapper(
17
- getShadowNodeWrapperFromHostInstance(component)
18
- );
15
+ return getShadowNodeWrapperFromHostInstance(component);
19
16
  }
20
17
 
21
18
  const getTagValueFunction = global._IS_FABRIC
@@ -1,17 +1,17 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  import { makeMutable, registerSensor, unregisterSensor } from '../core';
3
- import { SharedValue, Value3D, ValueRotation } from '../commonTypes';
4
-
5
- export enum SensorType {
6
- ACCELEROMETER = 1,
7
- GYROSCOPE = 2,
8
- GRAVITY = 3,
9
- MAGNETIC_FIELD = 4,
10
- ROTATION = 5,
11
- }
3
+ import {
4
+ SensorType,
5
+ SharedValue,
6
+ Value3D,
7
+ ValueRotation,
8
+ IOSReferenceFrame,
9
+ } from '../commonTypes';
12
10
 
13
11
  export type SensorConfig = {
14
12
  interval: number | 'auto';
13
+ adjustToInterfaceOrientation: boolean;
14
+ iosReferenceFrame: IOSReferenceFrame;
15
15
  };
16
16
 
17
17
  export type AnimatedSensor = {
@@ -33,19 +33,81 @@ function initSensorData(
33
33
  yaw: 0,
34
34
  pitch: 0,
35
35
  roll: 0,
36
+ interfaceOrientation: 0,
36
37
  });
37
38
  } else {
38
39
  return makeMutable<Value3D | ValueRotation>({
39
40
  x: 0,
40
41
  y: 0,
41
42
  z: 0,
43
+ interfaceOrientation: 0,
42
44
  });
43
45
  }
44
46
  }
45
47
 
48
+ // euler angles are in order ZXY, z = yaw, x = pitch, y = roll
49
+ // https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js#L237
50
+ function eulerToQuaternion(pitch: number, roll: number, yaw: number) {
51
+ 'worklet';
52
+ const c1 = Math.cos(pitch / 2);
53
+ const s1 = Math.sin(pitch / 2);
54
+ const c2 = Math.cos(roll / 2);
55
+ const s2 = Math.sin(roll / 2);
56
+ const c3 = Math.cos(yaw / 2);
57
+ const s3 = Math.sin(yaw / 2);
58
+
59
+ return [
60
+ s1 * c2 * c3 - c1 * s2 * s3,
61
+ c1 * s2 * c3 + s1 * c2 * s3,
62
+ c1 * c2 * s3 + s1 * s2 * c3,
63
+ c1 * c2 * c3 - s1 * s2 * s3,
64
+ ];
65
+ }
66
+
67
+ function adjustRotationToInterfaceOrientation(data: ValueRotation) {
68
+ 'worklet';
69
+ const { interfaceOrientation, pitch, roll, yaw } = data;
70
+ if (interfaceOrientation === 90) {
71
+ data.pitch = roll;
72
+ data.roll = -pitch;
73
+ data.yaw = yaw - Math.PI / 2;
74
+ } else if (interfaceOrientation === 270) {
75
+ data.pitch = -roll;
76
+ data.roll = pitch;
77
+ data.yaw = yaw + Math.PI / 2;
78
+ } else if (interfaceOrientation === 180) {
79
+ data.pitch *= -1;
80
+ data.roll *= -1;
81
+ data.yaw *= -1;
82
+ }
83
+
84
+ const q = eulerToQuaternion(data.pitch, data.roll, data.yaw);
85
+ data.qx = q[0];
86
+ data.qy = q[1];
87
+ data.qz = q[2];
88
+ data.qw = q[3];
89
+ return data;
90
+ }
91
+
92
+ function adjustVectorToInterfaceOrientation(data: Value3D) {
93
+ 'worklet';
94
+ const { interfaceOrientation, x, y } = data;
95
+ if (interfaceOrientation === 90) {
96
+ data.x = -y;
97
+ data.y = x;
98
+ } else if (interfaceOrientation === 270) {
99
+ data.x = y;
100
+ data.y = -x;
101
+ } else if (interfaceOrientation === 180) {
102
+ data.x *= -1;
103
+ data.y *= -1;
104
+ }
105
+ return data;
106
+ }
107
+
46
108
  export function useAnimatedSensor(
47
109
  sensorType: SensorType,
48
- userConfig?: SensorConfig
110
+ userConfig?: Partial<SensorConfig>
49
111
  ): AnimatedSensor {
50
112
  const ref = useRef<AnimatedSensor>({
51
113
  sensor: initSensorData(sensorType),
@@ -55,17 +117,32 @@ export function useAnimatedSensor(
55
117
  isAvailable: false,
56
118
  config: {
57
119
  interval: 0,
120
+ adjustToInterfaceOrientation: true,
121
+ iosReferenceFrame: IOSReferenceFrame.Auto,
58
122
  },
59
123
  });
60
124
 
61
125
  useEffect(() => {
62
- ref.current.config = { interval: 'auto', ...userConfig };
126
+ ref.current.config = {
127
+ interval: 'auto',
128
+ adjustToInterfaceOrientation: true,
129
+ iosReferenceFrame: IOSReferenceFrame.Auto,
130
+ ...userConfig,
131
+ };
63
132
  const sensorData = ref.current.sensor!;
64
133
  const id = registerSensor(
65
134
  sensorType,
66
135
  ref.current.config.interval === 'auto' ? -1 : ref.current.config.interval,
136
+ ref.current.config.iosReferenceFrame,
67
137
  (data) => {
68
138
  'worklet';
139
+ if (ref.current.config.adjustToInterfaceOrientation) {
140
+ if (sensorType === SensorType.ROTATION) {
141
+ data = adjustRotationToInterfaceOrientation(data as ValueRotation);
142
+ } else {
143
+ data = adjustVectorToInterfaceOrientation(data as Value3D);
144
+ }
145
+ }
69
146
  sensorData.value = data;
70
147
  }
71
148
  );
@@ -1,17 +1,14 @@
1
- /* global _frameTimestamp */
2
1
  import { MutableRefObject, useEffect, useRef } from 'react';
3
2
 
4
- import { startMapper, stopMapper, makeRemote, getTimestamp } from '../core';
3
+ import { startMapper, stopMapper, makeRemote } from '../core';
5
4
  import updateProps, { updatePropsJestWrapper } from '../UpdateProps';
6
5
  import { initialUpdaterRun } from '../animation';
7
6
  import NativeReanimatedModule from '../NativeReanimated';
8
7
  import { useSharedValue } from './useSharedValue';
9
8
  import {
10
9
  buildWorkletsHash,
11
- getStyleWithoutAnimations,
12
10
  isAnimated,
13
- parseColors,
14
- styleDiff,
11
+ shallowEqual,
15
12
  validateAnimatedStyles,
16
13
  } from './utils';
17
14
  import { DependencyList, Descriptor } from './commonTypes';
@@ -31,6 +28,7 @@ import {
31
28
  BasicWorkletFunctionOptional,
32
29
  NestedObjectValues,
33
30
  SharedValue,
31
+ StyleProps,
34
32
  } from '../commonTypes';
35
33
  export interface AnimatedStyleResult {
36
34
  viewDescriptors: ViewDescriptorsSet;
@@ -56,6 +54,7 @@ interface AnimationRef {
56
54
  }
57
55
 
58
56
  function prepareAnimation(
57
+ frameTimestamp: number,
59
58
  animatedProp: AnimatedStyle,
60
59
  lastAnimation: AnimatedStyle,
61
60
  lastValue: AnimatedStyle
@@ -64,6 +63,7 @@ function prepareAnimation(
64
63
  if (Array.isArray(animatedProp)) {
65
64
  animatedProp.forEach((prop, index) => {
66
65
  prepareAnimation(
66
+ frameTimestamp,
67
67
  prop,
68
68
  lastAnimation && lastAnimation[index],
69
69
  lastValue && lastValue[index]
@@ -98,12 +98,13 @@ function prepareAnimation(
98
98
  animation.callStart = (timestamp: Timestamp) => {
99
99
  animation.onStart(animation, value, timestamp, lastAnimation);
100
100
  };
101
- animation.callStart(getTimestamp());
101
+ animation.callStart(frameTimestamp);
102
102
  animation.callStart = null;
103
103
  } else if (typeof animatedProp === 'object') {
104
104
  // it is an object
105
105
  Object.keys(animatedProp).forEach((key) =>
106
106
  prepareAnimation(
107
+ frameTimestamp,
107
108
  animatedProp[key],
108
109
  lastAnimation && lastAnimation[key],
109
110
  lastValue && lastValue[key]
@@ -184,23 +185,28 @@ function styleUpdater(
184
185
  const animations = state.animations ?? {};
185
186
  const newValues = updater() ?? {};
186
187
  const oldValues = state.last;
188
+ const nonAnimatedNewValues: StyleProps = {};
187
189
 
188
190
  let hasAnimations = false;
191
+ let frameTimestamp: number | undefined;
192
+ let hasNonAnimatedValues = false;
189
193
  for (const key in newValues) {
190
194
  const value = newValues[key];
191
195
  if (isAnimated(value)) {
192
- prepareAnimation(value, animations[key], oldValues[key]);
196
+ frameTimestamp = global.__frameTimestamp || performance.now();
197
+ prepareAnimation(frameTimestamp, value, animations[key], oldValues[key]);
193
198
  animations[key] = value;
194
199
  hasAnimations = true;
195
200
  } else {
201
+ hasNonAnimatedValues = true;
202
+ nonAnimatedNewValues[key] = value;
196
203
  delete animations[key];
197
204
  }
198
205
  }
199
206
 
200
207
  if (hasAnimations) {
201
- const frame = (_timestamp?: Timestamp) => {
208
+ const frame = (timestamp: Timestamp) => {
202
209
  const { animations, last, isAnimationCancelled } = state;
203
- const timestamp = _timestamp ?? getTimestamp();
204
210
  if (isAnimationCancelled) {
205
211
  state.isAnimationRunning = false;
206
212
  return;
@@ -239,27 +245,21 @@ function styleUpdater(
239
245
  if (!state.isAnimationRunning) {
240
246
  state.isAnimationCancelled = false;
241
247
  state.isAnimationRunning = true;
242
- if (_frameTimestamp) {
243
- frame(_frameTimestamp);
244
- } else {
245
- requestAnimationFrame(frame);
246
- }
248
+ frame(frameTimestamp!);
247
249
  }
248
- state.last = Object.assign({}, oldValues, newValues);
249
- const style = getStyleWithoutAnimations(state.last);
250
- if (style) {
251
- updateProps(viewDescriptors, style, maybeViewRef);
250
+
251
+ if (hasNonAnimatedValues) {
252
+ updateProps(viewDescriptors, nonAnimatedNewValues, maybeViewRef);
252
253
  }
253
254
  } else {
254
255
  state.isAnimationCancelled = true;
255
256
  state.animations = [];
256
257
 
257
- const diff = styleDiff(oldValues, newValues);
258
- state.last = Object.assign({}, oldValues, newValues);
259
- if (diff) {
258
+ if (!shallowEqual(oldValues, newValues)) {
260
259
  updateProps(viewDescriptors, newValues, maybeViewRef);
261
260
  }
262
261
  }
262
+ state.last = newValues;
263
263
  }
264
264
 
265
265
  function jestStyleUpdater(
@@ -278,6 +278,7 @@ function jestStyleUpdater(
278
278
 
279
279
  // extract animated props
280
280
  let hasAnimations = false;
281
+ let frameTimestamp: number | undefined;
281
282
  Object.keys(animations).forEach((key) => {
282
283
  const value = newValues[key];
283
284
  if (!isAnimated(value)) {
@@ -287,15 +288,15 @@ function jestStyleUpdater(
287
288
  Object.keys(newValues).forEach((key) => {
288
289
  const value = newValues[key];
289
290
  if (isAnimated(value)) {
290
- prepareAnimation(value, animations[key], oldValues[key]);
291
+ frameTimestamp = global.__frameTimestamp || performance.now();
292
+ prepareAnimation(frameTimestamp, value, animations[key], oldValues[key]);
291
293
  animations[key] = value;
292
294
  hasAnimations = true;
293
295
  }
294
296
  });
295
297
 
296
- function frame(_timestamp?: Timestamp) {
298
+ function frame(timestamp: Timestamp) {
297
299
  const { animations, last, isAnimationCancelled } = state;
298
- const timestamp = _timestamp ?? getTimestamp();
299
300
  if (isAnimationCancelled) {
300
301
  state.isAnimationRunning = false;
301
302
  return;
@@ -341,11 +342,7 @@ function jestStyleUpdater(
341
342
  if (!state.isAnimationRunning) {
342
343
  state.isAnimationCancelled = false;
343
344
  state.isAnimationRunning = true;
344
- if (_frameTimestamp) {
345
- frame(_frameTimestamp);
346
- } else {
347
- requestAnimationFrame(frame);
348
- }
345
+ frame(frameTimestamp!);
349
346
  }
350
347
  } else {
351
348
  state.isAnimationCancelled = true;
@@ -353,13 +350,12 @@ function jestStyleUpdater(
353
350
  }
354
351
 
355
352
  // calculate diff
356
- const diff = styleDiff(oldValues, newValues);
357
- state.last = Object.assign({}, oldValues, newValues);
353
+ state.last = newValues;
358
354
 
359
- if (Object.keys(diff).length !== 0) {
355
+ if (!shallowEqual(oldValues, newValues)) {
360
356
  updatePropsJestWrapper(
361
357
  viewDescriptors,
362
- diff,
358
+ newValues,
363
359
  maybeViewRef,
364
360
  animatedStyle,
365
361
  adapters
@@ -401,7 +397,20 @@ export function useAnimatedStyle<T extends AnimatedStyle>(
401
397
  ): AnimatedStyleResult {
402
398
  const viewsRef: ViewRefSet<any> = makeViewsRefSet();
403
399
  const initRef = useRef<AnimationRef>();
404
- const inputs = Object.values(updater._closure ?? {});
400
+ let inputs = Object.values(updater._closure ?? {});
401
+ if (shouldBeUseWeb()) {
402
+ if (!inputs.length && dependencies?.length) {
403
+ // let web work without a Babel/SWC plugin
404
+ inputs = dependencies;
405
+ }
406
+ if (__DEV__ && !inputs.length && !dependencies && !updater.__workletHash) {
407
+ throw new Error(
408
+ `useAnimatedStyle was used without a dependency array or Babel plugin. Please explicitly pass a dependency array, or enable the Babel/SWC plugin.
409
+
410
+ For more, see the docs: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support#web-without-a-babel-plugin`
411
+ );
412
+ }
413
+ }
405
414
  const adaptersArray: AdapterWorkletFunction[] = adapters
406
415
  ? Array.isArray(adapters)
407
416
  ? adapters
@@ -460,15 +469,6 @@ export function useAnimatedStyle<T extends AnimatedStyle>(
460
469
  };
461
470
  }
462
471
 
463
- if (!shouldBeUseWeb()) {
464
- updaterFn = () => {
465
- 'worklet';
466
- const style = updaterFn();
467
- parseColors(style);
468
- return style;
469
- };
470
- }
471
-
472
472
  if (isJest()) {
473
473
  fun = () => {
474
474
  'worklet';
@@ -503,8 +503,6 @@ export function useAnimatedStyle<T extends AnimatedStyle>(
503
503
  useEffect(() => {
504
504
  animationsActive.value = true;
505
505
  return () => {
506
- // initRef.current = null;
507
- // viewsRef = null;
508
506
  animationsActive.value = false;
509
507
  };
510
508
  }, []);
@@ -3,6 +3,7 @@ import { initialUpdaterRun } from '../animation';
3
3
  import { BasicWorkletFunction, SharedValue } from '../commonTypes';
4
4
  import { makeMutable, startMapper, stopMapper } from '../core';
5
5
  import { DependencyList } from './commonTypes';
6
+ import { shouldBeUseWeb } from '../PlatformChecker';
6
7
 
7
8
  export type DerivedValue<T> = Readonly<SharedValue<T>>;
8
9
 
@@ -11,7 +12,13 @@ export function useDerivedValue<T>(
11
12
  dependencies: DependencyList
12
13
  ): DerivedValue<T> {
13
14
  const initRef = useRef<SharedValue<T> | null>(null);
14
- const inputs = Object.values(processor._closure ?? {});
15
+ let inputs = Object.values(processor._closure ?? {});
16
+ if (shouldBeUseWeb()) {
17
+ if (!inputs.length && dependencies?.length) {
18
+ // let web work without a Babel/SWC plugin
19
+ inputs = dependencies;
20
+ }
21
+ }
15
22
 
16
23
  // build dependencies
17
24
  if (dependencies === undefined) {
@@ -7,7 +7,7 @@ import { findNodeHandle } from 'react-native';
7
7
  import { useEvent } from './utils';
8
8
  import { useSharedValue } from './useSharedValue';
9
9
 
10
- const subscribeForEvents = [
10
+ const scrollEventNames = [
11
11
  'onScroll',
12
12
  'onScrollBeginDrag',
13
13
  'onScrollEndDrag',
@@ -26,7 +26,7 @@ export function useScrollViewOffset(
26
26
  event.contentOffset.x === 0
27
27
  ? event.contentOffset.y
28
28
  : event.contentOffset.x;
29
- }, subscribeForEvents);
29
+ }, scrollEventNames);
30
30
 
31
31
  useEffect(() => {
32
32
  const viewTag = findNodeHandle(aref.current);