react-native-reanimated 3.9.0-rc.0 → 3.9.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 (297) hide show
  1. package/Common/cpp/Fabric/ShadowTreeCloner.cpp +2 -1
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +11 -4
  3. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +5 -3
  4. package/apple/REAModule.mm +14 -29
  5. package/apple/REANodesManager.mm +7 -6
  6. package/lib/module/Animated.js.map +1 -1
  7. package/lib/module/ConfigHelper.js.map +1 -1
  8. package/lib/module/animationBuilder.js.map +1 -1
  9. package/lib/module/createAnimatedComponent/InlinePropManager.js +2 -2
  10. package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
  11. package/lib/module/createAnimatedComponent/JSPropsUpdater.js +4 -4
  12. package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
  13. package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js.map +1 -1
  14. package/lib/module/createAnimatedComponent/PropsFilter.js +5 -5
  15. package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
  16. package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
  17. package/lib/module/createAnimatedComponent/createAnimatedComponent.js +33 -33
  18. package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
  19. package/lib/module/createAnimatedComponent/getViewInfo.js +2 -2
  20. package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -1
  21. package/lib/module/createAnimatedComponent/index.js.map +1 -1
  22. package/lib/module/createAnimatedComponent/setAndForwardRef.js +4 -5
  23. package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
  24. package/lib/module/createAnimatedComponent/utils.js.map +1 -1
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/module/index.web.js +1 -2
  27. package/lib/module/index.web.js.map +1 -1
  28. package/lib/module/mock.js +3 -8
  29. package/lib/module/mock.js.map +1 -1
  30. package/lib/module/propsAllowlists.js.map +1 -1
  31. package/lib/module/reanimated2/Bezier.js.map +1 -1
  32. package/lib/module/reanimated2/Colors.js +4 -11
  33. package/lib/module/reanimated2/Colors.js.map +1 -1
  34. package/lib/module/reanimated2/Easing.js +3 -7
  35. package/lib/module/reanimated2/Easing.js.map +1 -1
  36. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +3 -3
  37. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  38. package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
  39. package/lib/module/reanimated2/NativeReanimated/index.web.js.map +1 -1
  40. package/lib/module/reanimated2/PlatformChecker.js +1 -0
  41. package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
  42. package/lib/module/reanimated2/PropAdapters.js +1 -1
  43. package/lib/module/reanimated2/PropAdapters.js.map +1 -1
  44. package/lib/module/reanimated2/PropsRegistry.js.map +1 -1
  45. package/lib/module/reanimated2/Sensor.js +2 -2
  46. package/lib/module/reanimated2/Sensor.js.map +1 -1
  47. package/lib/module/reanimated2/SensorContainer.js +2 -2
  48. package/lib/module/reanimated2/SensorContainer.js.map +1 -1
  49. package/lib/module/reanimated2/UpdateLayoutAnimations.js.map +1 -1
  50. package/lib/module/reanimated2/UpdateProps.js.map +1 -1
  51. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  52. package/lib/module/reanimated2/WorkletEventHandler.js +74 -31
  53. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  54. package/lib/module/reanimated2/animation/clamp.js.map +1 -1
  55. package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
  56. package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
  57. package/lib/module/reanimated2/animation/decay/index.js.map +1 -1
  58. package/lib/module/reanimated2/animation/decay/rigidDecay.js.map +1 -1
  59. package/lib/module/reanimated2/animation/decay/rubberBandDecay.js.map +1 -1
  60. package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
  61. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  62. package/lib/module/reanimated2/animation/index.js.map +1 -1
  63. package/lib/module/reanimated2/animation/repeat.js +1 -6
  64. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  65. package/lib/module/reanimated2/animation/sequence.js +1 -5
  66. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  67. package/lib/module/reanimated2/animation/spring.js.map +1 -1
  68. package/lib/module/reanimated2/animation/springUtils.js +8 -10
  69. package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
  70. package/lib/module/reanimated2/animation/styleAnimation.js +5 -4
  71. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  72. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  73. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +1 -2
  74. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
  75. package/lib/module/reanimated2/animation/util.js.map +1 -1
  76. package/lib/module/reanimated2/commonTypes.js +2 -0
  77. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  78. package/lib/module/reanimated2/component/FlatList.js +1 -0
  79. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  80. package/lib/module/reanimated2/component/Image.js +1 -0
  81. package/lib/module/reanimated2/component/Image.js.map +1 -1
  82. package/lib/module/reanimated2/component/LayoutAnimationConfig.js +1 -0
  83. package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
  84. package/lib/module/reanimated2/component/PerformanceMonitor.js +3 -4
  85. package/lib/module/reanimated2/component/PerformanceMonitor.js.map +1 -1
  86. package/lib/module/reanimated2/component/ScrollView.js +1 -0
  87. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  88. package/lib/module/reanimated2/component/Text.js +1 -0
  89. package/lib/module/reanimated2/component/Text.js.map +1 -1
  90. package/lib/module/reanimated2/component/View.js +1 -0
  91. package/lib/module/reanimated2/component/View.js.map +1 -1
  92. package/lib/module/reanimated2/core.js +2 -4
  93. package/lib/module/reanimated2/core.js.map +1 -1
  94. package/lib/module/reanimated2/errors.js +7 -8
  95. package/lib/module/reanimated2/errors.js.map +1 -1
  96. package/lib/module/reanimated2/fabricUtils.js +4 -4
  97. package/lib/module/reanimated2/fabricUtils.js.map +1 -1
  98. package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
  99. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +2 -2
  100. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  101. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  102. package/lib/module/reanimated2/frameCallback/index.js.map +1 -1
  103. package/lib/module/reanimated2/globals.d.js.map +1 -1
  104. package/lib/module/reanimated2/helperTypes.js.map +1 -1
  105. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
  106. package/lib/module/reanimated2/hook/index.js.map +1 -1
  107. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -0
  108. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  109. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +3 -4
  110. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  111. package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
  112. package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -0
  113. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  114. package/lib/module/reanimated2/hook/useAnimatedRef.js +1 -1
  115. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  116. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +3 -1
  117. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  118. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  119. package/lib/module/reanimated2/hook/useAnimatedStyle.js +3 -6
  120. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  121. package/lib/module/reanimated2/hook/useDerivedValue.js +3 -1
  122. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  123. package/lib/module/reanimated2/hook/useEvent.js +4 -5
  124. package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
  125. package/lib/module/reanimated2/hook/useFrameCallback.js +1 -2
  126. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  127. package/lib/module/reanimated2/hook/useHandler.js +3 -1
  128. package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
  129. package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
  130. package/lib/module/reanimated2/hook/useScrollViewOffset.js +14 -6
  131. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  132. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  133. package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
  134. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  135. package/lib/module/reanimated2/index.js.map +1 -1
  136. package/lib/module/reanimated2/initializers.js +1 -5
  137. package/lib/module/reanimated2/initializers.js.map +1 -1
  138. package/lib/module/reanimated2/interpolateColor.js +2 -6
  139. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  140. package/lib/module/reanimated2/interpolation.js +1 -1
  141. package/lib/module/reanimated2/interpolation.js.map +1 -1
  142. package/lib/module/reanimated2/isSharedValue.js.map +1 -1
  143. package/lib/module/reanimated2/jestUtils.js +3 -6
  144. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  145. package/lib/module/reanimated2/jestUtils.web.js.map +1 -1
  146. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +4 -5
  147. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  148. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -1
  149. package/lib/module/reanimated2/js-reanimated/index.js +2 -2
  150. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  151. package/lib/module/reanimated2/js-reanimated/react-native-web.d.js.map +1 -1
  152. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +4 -2
  153. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  154. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -11
  155. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  156. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +8 -9
  157. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  158. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  159. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  160. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +1 -2
  161. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  162. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +22 -22
  163. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  164. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +22 -22
  165. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  166. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +26 -26
  167. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  168. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +10 -10
  169. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  170. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -6
  171. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  172. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +10 -10
  173. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  174. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +18 -18
  175. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  176. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +18 -18
  177. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  178. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +10 -10
  179. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  180. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +34 -34
  181. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  182. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  183. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +4 -4
  184. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  185. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +4 -4
  186. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  187. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +4 -4
  188. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  189. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +4 -4
  190. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  191. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +4 -4
  192. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  193. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +4 -4
  194. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  195. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  196. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  197. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js +4 -6
  198. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js.map +1 -1
  199. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +4 -6
  200. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
  201. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.web.js.map +1 -1
  202. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  203. package/lib/module/reanimated2/layoutReanimation/web/animation/Bounce.web.js.map +1 -1
  204. package/lib/module/reanimated2/layoutReanimation/web/animation/Fade.web.js.map +1 -1
  205. package/lib/module/reanimated2/layoutReanimation/web/animation/Flip.web.js.map +1 -1
  206. package/lib/module/reanimated2/layoutReanimation/web/animation/Lightspeed.web.js.map +1 -1
  207. package/lib/module/reanimated2/layoutReanimation/web/animation/Pinwheel.web.js.map +1 -1
  208. package/lib/module/reanimated2/layoutReanimation/web/animation/Roll.web.js.map +1 -1
  209. package/lib/module/reanimated2/layoutReanimation/web/animation/Rotate.web.js.map +1 -1
  210. package/lib/module/reanimated2/layoutReanimation/web/animation/Slide.web.js.map +1 -1
  211. package/lib/module/reanimated2/layoutReanimation/web/animation/Stretch.web.js.map +1 -1
  212. package/lib/module/reanimated2/layoutReanimation/web/animation/Zoom.web.js.map +1 -1
  213. package/lib/module/reanimated2/layoutReanimation/web/animationParser.js +0 -2
  214. package/lib/module/reanimated2/layoutReanimation/web/animationParser.js.map +1 -1
  215. package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js +1 -2
  216. package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js.map +1 -1
  217. package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js +3 -1
  218. package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js.map +1 -1
  219. package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js +6 -7
  220. package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js.map +1 -1
  221. package/lib/module/reanimated2/layoutReanimation/web/config.js.map +1 -1
  222. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +2 -2
  223. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
  224. package/lib/module/reanimated2/layoutReanimation/web/domUtils.js +4 -4
  225. package/lib/module/reanimated2/layoutReanimation/web/domUtils.js.map +1 -1
  226. package/lib/module/reanimated2/layoutReanimation/web/index.js.map +1 -1
  227. package/lib/module/reanimated2/layoutReanimation/web/transition/Fading.web.js.map +1 -1
  228. package/lib/module/reanimated2/layoutReanimation/web/transition/Linear.web.js.map +1 -1
  229. package/lib/module/reanimated2/layoutReanimation/web/transition/Sequenced.web.js.map +1 -1
  230. package/lib/module/reanimated2/mappers.js +2 -4
  231. package/lib/module/reanimated2/mappers.js.map +1 -1
  232. package/lib/module/reanimated2/mockedRequestAnimationFrame.js.map +1 -1
  233. package/lib/module/reanimated2/mutables.js +2 -4
  234. package/lib/module/reanimated2/mutables.js.map +1 -1
  235. package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  236. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  237. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
  238. package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
  239. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
  240. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +2 -4
  241. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
  242. package/lib/module/reanimated2/platformFunctions/dispatchCommand.web.js.map +1 -1
  243. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +2 -2
  244. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
  245. package/lib/module/reanimated2/platformFunctions/index.js.map +1 -1
  246. package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
  247. package/lib/module/reanimated2/platformFunctions/measure.web.js.map +1 -1
  248. package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
  249. package/lib/module/reanimated2/platformFunctions/scrollTo.web.js +1 -1
  250. package/lib/module/reanimated2/platformFunctions/scrollTo.web.js.map +1 -1
  251. package/lib/module/reanimated2/platformFunctions/setGestureState.js.map +1 -1
  252. package/lib/module/reanimated2/platformFunctions/setGestureState.web.js.map +1 -1
  253. package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
  254. package/lib/module/reanimated2/platformFunctions/setNativeProps.web.js.map +1 -1
  255. package/lib/module/reanimated2/pluginUtils.js.map +1 -1
  256. package/lib/module/reanimated2/publicGlobals.js.map +1 -1
  257. package/lib/module/reanimated2/runtimes.js +11 -19
  258. package/lib/module/reanimated2/runtimes.js.map +1 -1
  259. package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js.map +1 -1
  260. package/lib/module/reanimated2/screenTransition/animationManager.js.map +1 -1
  261. package/lib/module/reanimated2/screenTransition/commonTypes.js.map +1 -1
  262. package/lib/module/reanimated2/screenTransition/index.js.map +1 -1
  263. package/lib/module/reanimated2/screenTransition/presets.js.map +1 -1
  264. package/lib/module/reanimated2/screenTransition/styleUpdater.js.map +1 -1
  265. package/lib/module/reanimated2/screenTransition/swipeSimulator.js +1 -1
  266. package/lib/module/reanimated2/screenTransition/swipeSimulator.js.map +1 -1
  267. package/lib/module/reanimated2/shareableMappingCache.js.map +1 -1
  268. package/lib/module/reanimated2/shareables.js +2 -4
  269. package/lib/module/reanimated2/shareables.js.map +1 -1
  270. package/lib/module/reanimated2/threads.js +9 -34
  271. package/lib/module/reanimated2/threads.js.map +1 -1
  272. package/lib/module/reanimated2/valueSetter.js +1 -2
  273. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  274. package/lib/module/reanimated2/valueUnpacker.js.map +1 -1
  275. package/lib/module/specs/NativeReanimatedModule.js.map +1 -1
  276. package/lib/typescript/reanimated2/WorkletEventHandler.d.ts +16 -9
  277. package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +1 -1
  278. package/lib/typescript/reanimated2/component/PerformanceMonitor.d.ts +2 -1
  279. package/lib/typescript/reanimated2/hook/commonTypes.d.ts +5 -0
  280. package/lib/typescript/reanimated2/hook/useEvent.d.ts +2 -3
  281. package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
  282. package/package.json +18 -14
  283. package/plugin/build/plugin.js +7 -2
  284. package/src/createAnimatedComponent/PropsFilter.tsx +1 -1
  285. package/src/createAnimatedComponent/createAnimatedComponent.tsx +29 -33
  286. package/src/reanimated2/WorkletEventHandler.ts +98 -39
  287. package/src/reanimated2/animation/styleAnimation.ts +8 -6
  288. package/src/reanimated2/hook/commonTypes.ts +9 -0
  289. package/src/reanimated2/hook/useEvent.ts +4 -4
  290. package/src/reanimated2/hook/useScrollViewOffset.ts +21 -5
  291. package/src/reanimated2/js-reanimated/JSReanimated.ts +6 -3
  292. package/src/reanimated2/layoutReanimation/web/animationsManager.ts +1 -1
  293. package/src/reanimated2/layoutReanimation/web/componentStyle.ts +3 -1
  294. package/src/reanimated2/layoutReanimation/web/componentUtils.ts +1 -1
  295. package/src/reanimated2/layoutReanimation/web/createAnimation.ts +2 -2
  296. package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
  297. package/src/reanimated2/platformFunctions/getRelativeCoords.ts +2 -2
@@ -8,7 +8,7 @@ import type {
8
8
  } from 'react';
9
9
  import React from 'react';
10
10
  import { findNodeHandle, Platform } from 'react-native';
11
- import WorkletEventHandler from '../reanimated2/WorkletEventHandler';
11
+ import { WorkletEventHandler } from '../reanimated2/WorkletEventHandler';
12
12
  import '../reanimated2/layoutReanimation/animationsManager';
13
13
  import invariant from 'invariant';
14
14
  import { adaptViewConfig } from '../ConfigHelper';
@@ -143,6 +143,7 @@ export function createAnimatedComponent(
143
143
  }
144
144
 
145
145
  componentDidMount() {
146
+ this._viewTag = this._getViewInfo().viewTag as number;
146
147
  this._attachNativeEvents();
147
148
  this._jsPropsUpdater.addOnJSPropsChangeListener(this);
148
149
  this._attachAnimatedStyles();
@@ -189,6 +190,7 @@ export function createAnimatedComponent(
189
190
  const exiting = this.props.exiting;
190
191
  if (
191
192
  IS_WEB &&
193
+ this._component &&
192
194
  this.props.exiting &&
193
195
  !getReducedMotionFromConfig(this.props.exiting as CustomConfig)
194
196
  ) {
@@ -228,21 +230,13 @@ export function createAnimatedComponent(
228
230
  }
229
231
 
230
232
  _attachNativeEvents() {
231
- const node = this._getEventViewRef() as AnimatedComponentRef;
232
- let viewTag = null; // We set it only if needed
233
-
234
233
  for (const key in this.props) {
235
234
  const prop = this.props[key];
236
235
  if (
237
236
  has('workletEventHandler', prop) &&
238
237
  prop.workletEventHandler instanceof WorkletEventHandler
239
238
  ) {
240
- if (viewTag === null) {
241
- viewTag = IS_WEB
242
- ? this._component
243
- : findNodeHandle(options?.setNativeProps ? this : node);
244
- }
245
- prop.workletEventHandler.registerForEvents(viewTag as number, key);
239
+ prop.workletEventHandler.registerForEvents(this._viewTag, key);
246
240
  }
247
241
  }
248
242
  }
@@ -254,7 +248,7 @@ export function createAnimatedComponent(
254
248
  has('workletEventHandler', prop) &&
255
249
  prop.workletEventHandler instanceof WorkletEventHandler
256
250
  ) {
257
- prop.workletEventHandler.unregisterFromEvents();
251
+ prop.workletEventHandler.unregisterFromEvents(this._viewTag);
258
252
  }
259
253
  }
260
254
  }
@@ -277,38 +271,40 @@ export function createAnimatedComponent(
277
271
  }
278
272
  }
279
273
 
280
- _reattachNativeEvents(
274
+ _updateNativeEvents(
281
275
  prevProps: AnimatedComponentProps<InitialComponentProps>
282
276
  ) {
283
277
  for (const key in prevProps) {
284
- const prop = this.props[key];
278
+ const prevProp = prevProps[key];
285
279
  if (
286
- has('workletEventHandler', prop) &&
287
- prop.workletEventHandler instanceof WorkletEventHandler &&
288
- prop.workletEventHandler.reattachNeeded
280
+ has('workletEventHandler', prevProp) &&
281
+ prevProp.workletEventHandler instanceof WorkletEventHandler
289
282
  ) {
290
- prop.workletEventHandler.unregisterFromEvents();
283
+ const newProp = this.props[key];
284
+ if (!newProp) {
285
+ // Prop got deleted
286
+ prevProp.workletEventHandler.unregisterFromEvents(this._viewTag);
287
+ } else if (
288
+ has('workletEventHandler', newProp) &&
289
+ newProp.workletEventHandler instanceof WorkletEventHandler &&
290
+ newProp.workletEventHandler !== prevProp.workletEventHandler
291
+ ) {
292
+ // Prop got changed
293
+ prevProp.workletEventHandler.unregisterFromEvents(this._viewTag);
294
+ newProp.workletEventHandler.registerForEvents(this._viewTag);
295
+ }
291
296
  }
292
297
  }
293
298
 
294
- let viewTag = null;
295
-
296
299
  for (const key in this.props) {
297
- const prop = this.props[key];
300
+ const newProp = this.props[key];
298
301
  if (
299
- has('workletEventHandler', prop) &&
300
- prop.workletEventHandler instanceof WorkletEventHandler &&
301
- prop.workletEventHandler.reattachNeeded
302
+ has('workletEventHandler', newProp) &&
303
+ newProp.workletEventHandler instanceof WorkletEventHandler &&
304
+ !prevProps[key]
302
305
  ) {
303
- if (viewTag === null) {
304
- const node = this._getEventViewRef() as AnimatedComponentRef;
305
-
306
- viewTag = IS_WEB
307
- ? this._component
308
- : findNodeHandle(options?.setNativeProps ? this : node);
309
- }
310
- prop.workletEventHandler.registerForEvents(viewTag as number, key);
311
- prop.workletEventHandler.reattachNeeded = false;
306
+ // Prop got added
307
+ newProp.workletEventHandler.registerForEvents(this._viewTag);
312
308
  }
313
309
  }
314
310
  }
@@ -460,7 +456,7 @@ export function createAnimatedComponent(
460
456
  ) {
461
457
  this._configureSharedTransition();
462
458
  }
463
- this._reattachNativeEvents(prevProps);
459
+ this._updateNativeEvents(prevProps);
464
460
  this._attachAnimatedStyles();
465
461
  this._InlinePropManager.attachInlineProps(this, this._getViewInfo());
466
462
 
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
  import type { NativeSyntheticEvent } from 'react-native';
3
3
  import { registerEventHandler, unregisterEventHandler } from './core';
4
- import type { EventPayload, ReanimatedEvent } from './hook/commonTypes';
4
+ import type {
5
+ EventPayload,
6
+ ReanimatedEvent,
7
+ IWorkletEventHandler,
8
+ } from './hook/commonTypes';
5
9
  import { shouldBeUseWeb } from './PlatformChecker';
6
10
 
7
11
  const SHOULD_BE_USE_WEB = shouldBeUseWeb();
@@ -20,64 +24,119 @@ function jsListener<Event extends object>(
20
24
  };
21
25
  }
22
26
 
23
- export default class WorkletEventHandler<Event extends object> {
27
+ class WorkletEventHandlerNative<Event extends object>
28
+ implements IWorkletEventHandler<Event>
29
+ {
30
+ eventNames: string[];
24
31
  worklet: (event: ReanimatedEvent<Event>) => void;
32
+ #viewTags: Set<number>;
33
+ #registrations: Map<number, number[]>; // keys are viewTags, values are arrays of registration ID's for each viewTag
34
+ constructor(
35
+ worklet: (event: ReanimatedEvent<Event>) => void,
36
+ eventNames: string[]
37
+ ) {
38
+ this.worklet = worklet;
39
+ this.eventNames = eventNames;
40
+ this.#viewTags = new Set<number>();
41
+ this.#registrations = new Map<number, number[]>();
42
+ }
43
+
44
+ updateEventHandler(
45
+ newWorklet: (event: ReanimatedEvent<Event>) => void,
46
+ newEvents: string[]
47
+ ): void {
48
+ // Update worklet and event names
49
+ this.worklet = newWorklet;
50
+ this.eventNames = newEvents;
51
+
52
+ // Detach all events
53
+ this.#registrations.forEach((registrationIDs) => {
54
+ registrationIDs.forEach((id) => unregisterEventHandler(id));
55
+ // No need to remove registrationIDs from map, since it gets overwritten when attaching
56
+ });
57
+
58
+ // Attach new events with new worklet
59
+ Array.from(this.#viewTags).forEach((tag) => {
60
+ const newRegistrations = this.eventNames.map((eventName) =>
61
+ registerEventHandler(this.worklet, eventName, tag)
62
+ );
63
+ this.#registrations.set(tag, newRegistrations);
64
+ });
65
+ }
66
+
67
+ registerForEvents(viewTag: number, fallbackEventName?: string): void {
68
+ this.#viewTags.add(viewTag);
69
+
70
+ const newRegistrations = this.eventNames.map((eventName) =>
71
+ registerEventHandler(this.worklet, eventName, viewTag)
72
+ );
73
+ this.#registrations.set(viewTag, newRegistrations);
74
+
75
+ if (this.eventNames.length === 0 && fallbackEventName) {
76
+ const newRegistration = registerEventHandler(
77
+ this.worklet,
78
+ fallbackEventName,
79
+ viewTag
80
+ );
81
+ this.#registrations.set(viewTag, [newRegistration]);
82
+ }
83
+ }
84
+
85
+ unregisterFromEvents(viewTag: number): void {
86
+ this.#viewTags.delete(viewTag);
87
+ this.#registrations.get(viewTag)?.forEach((id) => {
88
+ unregisterEventHandler(id);
89
+ });
90
+ this.#registrations.delete(viewTag);
91
+ }
92
+ }
93
+
94
+ class WorkletEventHandlerWeb<Event extends object>
95
+ implements IWorkletEventHandler<Event>
96
+ {
25
97
  eventNames: string[];
26
- reattachNeeded: boolean;
27
98
  listeners:
28
99
  | Record<string, (event: ReanimatedEvent<ReanimatedEvent<Event>>) => void>
29
100
  | Record<string, (event: JSEvent<Event>) => void>;
30
101
 
31
- viewTag: number | undefined;
32
- registrations: number[];
102
+ worklet: (event: ReanimatedEvent<Event>) => void;
103
+
33
104
  constructor(
34
105
  worklet: (event: ReanimatedEvent<Event>) => void,
35
106
  eventNames: string[] = []
36
107
  ) {
37
108
  this.worklet = worklet;
38
109
  this.eventNames = eventNames;
39
- this.reattachNeeded = false;
40
110
  this.listeners = {};
41
- this.viewTag = undefined;
42
- this.registrations = [];
43
-
44
- if (SHOULD_BE_USE_WEB) {
45
- this.listeners = eventNames.reduce(
46
- (
47
- acc: Record<string, (event: JSEvent<Event>) => void>,
48
- eventName: string
49
- ) => {
50
- acc[eventName] = jsListener(eventName, worklet);
51
- return acc;
52
- },
53
- {}
54
- );
55
- }
111
+ this.setupWebListeners();
56
112
  }
57
113
 
58
- updateWorklet(newWorklet: (event: ReanimatedEvent<Event>) => void): void {
59
- this.worklet = newWorklet;
60
- this.reattachNeeded = true;
114
+ setupWebListeners() {
115
+ this.listeners = {};
116
+ this.eventNames.forEach((eventName) => {
117
+ this.listeners[eventName] = jsListener(eventName, this.worklet);
118
+ });
61
119
  }
62
120
 
63
- registerForEvents(viewTag: number, fallbackEventName?: string): void {
64
- this.viewTag = viewTag;
65
- this.registrations = this.eventNames.map((eventName) =>
66
- registerEventHandler(this.worklet, eventName, viewTag)
67
- );
68
- if (this.registrations.length === 0 && fallbackEventName) {
69
- this.registrations.push(
70
- registerEventHandler(this.worklet, fallbackEventName, viewTag)
71
- );
72
- }
121
+ updateEventHandler(
122
+ newWorklet: (event: ReanimatedEvent<Event>) => void,
123
+ newEvents: string[]
124
+ ): void {
125
+ // Update worklet and event names
126
+ this.worklet = newWorklet;
127
+ this.eventNames = newEvents;
128
+ this.setupWebListeners();
73
129
  }
74
130
 
75
- registerForEventByName(eventName: string) {
76
- this.registrations.push(registerEventHandler(this.worklet, eventName));
131
+ registerForEvents(_viewTag: number, _fallbackEventName?: string): void {
132
+ // noop
77
133
  }
78
134
 
79
- unregisterFromEvents(): void {
80
- this.registrations.forEach((id) => unregisterEventHandler(id));
81
- this.registrations = [];
135
+ unregisterFromEvents(_viewTag: number): void {
136
+ // noop
82
137
  }
83
138
  }
139
+
140
+ export const WorkletEventHandler = SHOULD_BE_USE_WEB
141
+ ? WorkletEventHandlerWeb
142
+ : WorkletEventHandlerNative;
@@ -125,16 +125,18 @@ export function withStyleAnimation(
125
125
  stillGoing = true;
126
126
  }
127
127
 
128
- if (ColorProperties.includes(currentEntry.path[0] as string)) {
129
- currentStyleAnimation.current = processColor(
130
- currentStyleAnimation.current
131
- ) as number;
132
- }
128
+ // When working with animations changing colors, we need to make sure that each one of them begins with a rgba, not a processed number.
129
+ // Thus, we only set the path to a processed color, but currentStyleAnimation.current stays as rgba.
130
+ const isAnimatingColorProp = ColorProperties.includes(
131
+ currentEntry.path[0] as string
132
+ );
133
133
 
134
134
  setPath(
135
135
  animation.current,
136
136
  currentEntry.path,
137
- currentStyleAnimation.current
137
+ isAnimatingColorProp
138
+ ? processColor(currentStyleAnimation.current)
139
+ : currentStyleAnimation.current
138
140
  );
139
141
  }
140
142
  }
@@ -79,6 +79,15 @@ export type RNNativeScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
79
79
 
80
80
  export type ReanimatedScrollEvent = ReanimatedEvent<RNNativeScrollEvent>;
81
81
 
82
+ export interface IWorkletEventHandler<Event extends object> {
83
+ updateEventHandler: (
84
+ newWorklet: (event: ReanimatedEvent<Event>) => void,
85
+ newEvents: string[]
86
+ ) => void;
87
+ registerForEvents: (viewTag: number, fallbackEventName?: string) => void;
88
+ unregisterFromEvents: (viewTag: number) => void;
89
+ }
90
+
82
91
  export interface AnimatedStyleHandle<
83
92
  Style extends DefaultStyle = DefaultStyle
84
93
  > {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  import { useRef } from 'react';
3
- import WorkletEventHandler from '../WorkletEventHandler';
4
- import type { ReanimatedEvent } from './commonTypes';
3
+ import { WorkletEventHandler } from '../WorkletEventHandler';
4
+ import type { IWorkletEventHandler, ReanimatedEvent } from './commonTypes';
5
5
 
6
6
  /**
7
7
  * Worklet to provide as an argument to `useEvent` hook.
@@ -17,7 +17,7 @@ export type EventHandlerProcessed<
17
17
  > = (event: Event, context?: Context) => void;
18
18
 
19
19
  export type EventHandlerInternal<Event extends object> = {
20
- workletEventHandler: WorkletEventHandler<Event>;
20
+ workletEventHandler: IWorkletEventHandler<Event>;
21
21
  };
22
22
 
23
23
  /**
@@ -57,7 +57,7 @@ export function useEvent<Event extends object, Context = never>(
57
57
  initRef.current = { workletEventHandler };
58
58
  } else if (rebuild) {
59
59
  const workletEventHandler = initRef.current.workletEventHandler;
60
- workletEventHandler.updateWorklet(handler);
60
+ workletEventHandler.updateEventHandler(handler, eventNames);
61
61
  initRef.current = { workletEventHandler };
62
62
  }
63
63
 
@@ -73,6 +73,7 @@ function useScrollViewOffsetNative(
73
73
  const internalOffset = useSharedValue(0);
74
74
  const offset = useRef(providedOffset ?? internalOffset).current;
75
75
  const scrollRef = useRef<AnimatedScrollView | null>(null);
76
+ const scrollRefTag = useRef<number | null>(null);
76
77
 
77
78
  const eventHandler = useEvent<RNNativeScrollEvent>(
78
79
  (event: ReanimatedScrollEvent) => {
@@ -89,15 +90,30 @@ function useScrollViewOffsetNative(
89
90
 
90
91
  useEffect(() => {
91
92
  // We need to make sure that listener for old animatedRef value is removed
92
- if (scrollRef.current !== null) {
93
- eventHandler.workletEventHandler.unregisterFromEvents();
93
+ if (scrollRef.current !== null && scrollRefTag.current !== null) {
94
+ eventHandler.workletEventHandler.unregisterFromEvents(
95
+ scrollRefTag.current
96
+ );
94
97
  }
98
+
99
+ // Store the ref and viewTag for future cleanup
95
100
  scrollRef.current = animatedRef.current;
101
+ scrollRefTag.current = animatedRef.getTag();
102
+
103
+ if (scrollRefTag === null) {
104
+ console.warn(
105
+ '[Reanimated] ScrollViewOffset failed to resolve the view tag from animated ref. Did you forget to attach the ref to a component?'
106
+ );
107
+ } else {
108
+ eventHandler.workletEventHandler.registerForEvents(scrollRefTag.current);
109
+ }
96
110
 
97
- const viewTag = animatedRef.getTag();
98
- eventHandler.workletEventHandler.registerForEvents(viewTag);
99
111
  return () => {
100
- eventHandler.workletEventHandler.unregisterFromEvents();
112
+ if (scrollRefTag.current !== null) {
113
+ eventHandler.workletEventHandler.unregisterFromEvents(
114
+ scrollRefTag.current
115
+ );
116
+ }
101
117
  };
102
118
  // React here has a problem with `animatedRef.current` since a Ref .current
103
119
  // field shouldn't be used as a dependency. However, in this case we have
@@ -55,12 +55,15 @@ export default class JSReanimated {
55
55
  _eventName: string,
56
56
  _emitterReactTag: number
57
57
  ): number {
58
- // noop
59
- return -1;
58
+ throw new Error(
59
+ '[Reanimated] registerEventHandler is not available in JSReanimated.'
60
+ );
60
61
  }
61
62
 
62
63
  unregisterEventHandler(_: number): void {
63
- // noop
64
+ throw new Error(
65
+ '[Reanimated] unregisterEventHandler is not available in JSReanimated.'
66
+ );
64
67
  }
65
68
 
66
69
  enableLayoutAnimations() {
@@ -48,7 +48,7 @@ function checkUndefinedAnimationFail(
48
48
  }
49
49
 
50
50
  console.warn(
51
- "[Reanimated] Couldn't load entering/exiting animation. Current version supports only predefined animations with modifiers: duration, delay, easing, randomizeDelay, wtihCallback, reducedMotion."
51
+ "[Reanimated] Couldn't load entering/exiting animation. Current version supports only predefined animations with modifiers: duration, delay, easing, randomizeDelay, withCallback, reducedMotion."
52
52
  );
53
53
 
54
54
  return true;
@@ -78,5 +78,7 @@ export function setDummyPosition(
78
78
  dummy.style.height = `${snapshot.height}px`;
79
79
  dummy.style.margin = '0px'; // tmpElement has absolute position, so margin is not necessary
80
80
 
81
- fixElementPosition(dummy, dummy.parentElement!, snapshot);
81
+ if (dummy.parentElement) {
82
+ fixElementPosition(dummy, dummy.parentElement, snapshot);
83
+ }
82
84
  }
@@ -276,7 +276,7 @@ export function handleExitingAnimation(
276
276
 
277
277
  const scrollOffsets = getElementScrollValue(element);
278
278
 
279
- // Scroll does not trigger snapshoting, therefore if we start exiting animation after
279
+ // Scroll does not trigger snapshotting, therefore if we start exiting animation after
280
280
  // scrolling through parent component, dummy will end up in wrong place. In order to fix that
281
281
  // we keep last known scroll position in snapshot and then adjust dummy position based on
282
282
  // last known scroll offset and current scroll offset
@@ -14,7 +14,7 @@ import { FadingTransition } from './transition/Fading.web';
14
14
  import { insertWebAnimation } from './domUtils';
15
15
 
16
16
  // Translate values are passed as numbers. However, if `translate` property receives number, it will not automatically
17
- // convert it to `px`. Therefore if we want to keep exisitng transform we have to add 'px' suffix to each of translate values
17
+ // convert it to `px`. Therefore if we want to keep existing transform we have to add 'px' suffix to each of translate values
18
18
  // that are present inside transform.
19
19
  function addPxToTranslate(
20
20
  existingTransform: NonNullable<TransformsStyle['transform']>
@@ -43,7 +43,7 @@ function addPxToTranslate(
43
43
  return newTransform;
44
44
  }
45
45
 
46
- // In order to keep exisitng transform throughout animation, we have to add it to each of keyframe step.
46
+ // In order to keep existing transform throughout animation, we have to add it to each of keyframe step.
47
47
  function addExistingTransform(
48
48
  newAnimationData: AnimationData,
49
49
  newTransform: ReanimatedWebTransformProperties[]
@@ -4,4 +4,4 @@
4
4
  * with the version used to build the native part of the library in runtime.
5
5
  * Remember to keep this in sync with the version declared in `package.json`
6
6
  */
7
- export const jsVersion = '3.9.0-rc.0';
7
+ export const jsVersion = '3.9.0';
@@ -31,7 +31,7 @@ export function getRelativeCoords(
31
31
  return null;
32
32
  }
33
33
  return {
34
- x: absoluteX - parentCoords.x,
35
- y: absoluteY - parentCoords.y,
34
+ x: absoluteX - parentCoords.pageX,
35
+ y: absoluteY - parentCoords.pageY,
36
36
  };
37
37
  }