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
@@ -1,4 +1,5 @@
1
1
  import { NestedObjectValues } from '../commonTypes';
2
+ import { shouldBeUseWeb } from '../PlatformChecker';
2
3
  import { JSReanimated } from './commonTypes';
3
4
  import MutableValue from './MutableValue';
4
5
 
@@ -49,6 +50,9 @@ export default class Mapper<T> {
49
50
  res.push(value);
50
51
  } else if (Array.isArray(value)) {
51
52
  value.forEach((v) => extractMutables(v));
53
+ } else if (isWebDomElement(value)) {
54
+ // do nothing on dom elements
55
+ // without this check, we get a "Maximum call size exceeded error"
52
56
  } else if (typeof value === 'object') {
53
57
  Object.keys(value).forEach((key) => {
54
58
  extractMutables(value[key]);
@@ -60,3 +64,31 @@ export default class Mapper<T> {
60
64
  return res;
61
65
  }
62
66
  }
67
+
68
+ function isWebDomElement(value: any) {
69
+ if (!shouldBeUseWeb()) {
70
+ return false;
71
+ }
72
+
73
+ // https://stackoverflow.com/a/384380/7869175
74
+ function isWebNode(o: any) {
75
+ return typeof Node === 'object'
76
+ ? o instanceof Node
77
+ : o &&
78
+ typeof o === 'object' &&
79
+ typeof o.nodeType === 'number' &&
80
+ typeof o.nodeName === 'string';
81
+ }
82
+
83
+ function isWebElement(o: any) {
84
+ return typeof HTMLElement === 'object'
85
+ ? o instanceof HTMLElement // DOM2
86
+ : o &&
87
+ typeof o === 'object' &&
88
+ o !== null &&
89
+ o.nodeType === 1 &&
90
+ typeof o.nodeName === 'string';
91
+ }
92
+
93
+ return isWebNode(value) || isWebElement(value);
94
+ }
@@ -0,0 +1,34 @@
1
+ export declare class WebSensor {
2
+ start: () => void;
3
+ stop: () => void;
4
+ addEventListener: (eventType: string, eventHandler: () => void) => void;
5
+ quaternion: [number, number, number, number];
6
+ x: number;
7
+ y: number;
8
+ z: number;
9
+ }
10
+
11
+ type configOptions =
12
+ | {
13
+ referenceFrame: string;
14
+ frequency?: undefined;
15
+ }
16
+ | {
17
+ frequency: number;
18
+ referenceFrame?: undefined;
19
+ };
20
+
21
+ interface Constructable<T> {
22
+ new (config: configOptions): T;
23
+ }
24
+
25
+ declare global {
26
+ interface Window {
27
+ Accelerometer: Constructable<WebSensor>;
28
+ GravitySensor: Constructable<WebSensor>;
29
+ Gyroscope: Constructable<WebSensor>;
30
+ Magnetometer: Constructable<WebSensor>;
31
+ AbsoluteOrientationSensor: Constructable<WebSensor>;
32
+ Sensor: Constructable<WebSensor>;
33
+ }
34
+ }
@@ -32,7 +32,6 @@ export interface JSReanimated {
32
32
  _frames: ((timestamp: Timestamp) => void)[];
33
33
  timeProvider: { now: () => number };
34
34
  pushFrame(frame: (timestamp: Timestamp) => void): void;
35
- getTimestamp(): number;
36
35
  maybeRequestRender(): void;
37
36
  _onRender(timestampMs: number): void;
38
37
  installCoreFunctions(valueSetter: <T>(value: T) => void): void;
@@ -3,10 +3,6 @@
3
3
  import { shouldBeUseWeb } from '../PlatformChecker';
4
4
  const initializeGlobalsForWeb = () => {
5
5
  if (shouldBeUseWeb()) {
6
- global._frameTimestamp = null;
7
- global._setGlobalConsole = (_val) => {
8
- // noop
9
- };
10
6
  global._measure = () => {
11
7
  console.warn(
12
8
  "[Reanimated] You can't use `measure` with Chrome Debugger or with web version"
@@ -40,10 +36,10 @@ const initializeGlobalsForWeb = () => {
40
36
  };
41
37
 
42
38
  /*
43
- If a file doesn't export anything, tree shaking doesn't pack
44
- it into the JS bundle. In effect, the code inside of this file
45
- will never execute. That is why we wrapped initialization code
46
- into a function, and we call this one during creating
39
+ If a file doesn't export anything, tree shaking doesn't pack
40
+ it into the JS bundle. In effect, the code inside of this file
41
+ will never execute. That is why we wrapped initialization code
42
+ into a function, and we call this one during creating
47
43
  the module export object.
48
44
  */
49
45
 
@@ -5,7 +5,6 @@ const reanimatedJS = new JSReanimated();
5
5
 
6
6
  global._makeShareableClone = (c) => c;
7
7
  global._scheduleOnJS = setImmediate;
8
- global._getTimestamp = reanimatedJS.getTimestamp.bind(reanimatedJS);
9
8
 
10
9
  interface JSReanimatedComponent {
11
10
  previousStyle: StyleProps;
@@ -21,6 +21,8 @@ export interface EntryAnimationsValues {
21
21
  targetHeight: number;
22
22
  targetGlobalOriginX: number;
23
23
  targetGlobalOriginY: number;
24
+ windowWidth: number;
25
+ windowHeight: number;
24
26
  }
25
27
 
26
28
  export interface ExitAnimationsValues {
@@ -30,6 +32,8 @@ export interface ExitAnimationsValues {
30
32
  currentHeight: number;
31
33
  currentGlobalOriginX: number;
32
34
  currentGlobalOriginY: number;
35
+ windowWidth: number;
36
+ windowHeight: number;
33
37
  }
34
38
 
35
39
  export type EntryExitAnimationFunction = (
@@ -39,6 +43,7 @@ export type EntryExitAnimationFunction = (
39
43
  export type AnimationConfigFunction<T> = (targetValues: T) => LayoutAnimation;
40
44
 
41
45
  export interface LayoutAnimationsValues {
46
+ [key: string]: number;
42
47
  currentOriginX: number;
43
48
  currentOriginY: number;
44
49
  currentWidth: number;
@@ -55,13 +60,20 @@ export interface LayoutAnimationsValues {
55
60
  windowHeight: number;
56
61
  }
57
62
 
63
+ export enum LayoutAnimationType {
64
+ ENTERING = 1,
65
+ EXITING = 2,
66
+ LAYOUT = 3,
67
+ SHARED_ELEMENT_TRANSITION = 4,
68
+ }
69
+
58
70
  export type LayoutAnimationFunction = (
59
71
  targetValues: LayoutAnimationsValues
60
72
  ) => LayoutAnimation;
61
73
 
62
74
  export type LayoutAnimationStartFunction = (
63
75
  tag: number,
64
- type: string,
76
+ type: LayoutAnimationType,
65
77
  yogaValues: LayoutAnimationsValues,
66
78
  config: LayoutAnimationFunction
67
79
  ) => void;
@@ -1,6 +1,7 @@
1
1
  export { BaseAnimationBuilder } from './BaseAnimationBuilder';
2
2
  export { ComplexAnimationBuilder } from './ComplexAnimationBuilder';
3
3
  export { Keyframe } from './Keyframe';
4
+ export { LayoutAnimationType } from './commonTypes';
4
5
  export type {
5
6
  LayoutAnimation,
6
7
  AnimationFunction,
@@ -1,24 +1,25 @@
1
- import { runOnUI } from '../core';
2
1
  import { withStyleAnimation } from '../animation/styleAnimation';
3
- import { LogBox } from 'react-native';
4
2
  import { SharedValue } from '../commonTypes';
5
3
  import { makeUIMutable } from '../mutables';
6
4
  import {
7
5
  LayoutAnimationFunction,
6
+ LayoutAnimationType,
8
7
  LayoutAnimationsValues,
9
8
  } from './animationBuilder';
10
-
11
- LogBox.ignoreLogs(['Overriding previous layout animation with']);
9
+ import { runOnUIImmediately } from '../threads';
12
10
 
13
11
  const TAG_OFFSET = 1e9;
14
12
 
15
13
  function startObservingProgress(
16
14
  tag: number,
17
- sharedValue: SharedValue<number>
15
+ sharedValue: SharedValue<number>,
16
+ animationType: LayoutAnimationType
18
17
  ): void {
19
18
  'worklet';
19
+ const isSharedTransition =
20
+ animationType === LayoutAnimationType.SHARED_ELEMENT_TRANSITION;
20
21
  sharedValue.addListener(tag + TAG_OFFSET, () => {
21
- _notifyAboutProgress(tag, sharedValue.value);
22
+ _notifyAboutProgress(tag, sharedValue.value, isSharedTransition);
22
23
  });
23
24
  }
24
25
 
@@ -41,16 +42,16 @@ function createLayoutAnimationManager() {
41
42
  return {
42
43
  start(
43
44
  tag: number,
44
- type: string,
45
+ type: LayoutAnimationType,
45
46
  yogaValues: LayoutAnimationsValues,
46
47
  config: LayoutAnimationFunction
47
48
  ) {
48
49
  const style = config(yogaValues);
49
50
  let currentAnimation = style.animations;
50
51
 
51
- if (type === 'entering') {
52
+ if (type === LayoutAnimationType.ENTERING) {
52
53
  enteringAnimationForTag.set(tag, currentAnimation);
53
- } else if (type === 'layout') {
54
+ } else if (type === LayoutAnimationType.LAYOUT) {
54
55
  // When layout animation is requested, but entering is still running, we merge
55
56
  // new layout animation targets into the ongoing animation
56
57
  const enteringAnimation = enteringAnimationForTag.get(tag);
@@ -75,20 +76,24 @@ function createLayoutAnimationManager() {
75
76
  if (finished) {
76
77
  enteringAnimationForTag.delete(tag);
77
78
  mutableValuesForTag.delete(tag);
78
- const shouldRemoveView = type === 'exiting';
79
+ const shouldRemoveView = type === LayoutAnimationType.EXITING;
79
80
  stopObservingProgress(tag, value, finished, shouldRemoveView);
80
81
  }
81
82
  style.callback &&
82
83
  style.callback(finished === undefined ? false : finished);
83
84
  };
84
85
 
85
- startObservingProgress(tag, value);
86
+ startObservingProgress(tag, value, type);
86
87
  value.value = animation;
87
88
  },
89
+ stop(tag: number) {
90
+ const value = mutableValuesForTag.get(tag);
91
+ stopObservingProgress(tag, value, true, true);
92
+ },
88
93
  };
89
94
  }
90
95
 
91
- runOnUI(() => {
96
+ runOnUIImmediately(() => {
92
97
  'worklet';
93
98
  global.LayoutAnimationsManager = createLayoutAnimationManager();
94
99
  })();
@@ -3,11 +3,8 @@ import {
3
3
  IEntryExitAnimationBuilder,
4
4
  } from '../animationBuilder/commonTypes';
5
5
  import { withSequence, withTiming } from '../../animation';
6
- import { Dimensions } from 'react-native';
7
6
  import { ComplexAnimationBuilder } from '../animationBuilder/ComplexAnimationBuilder';
8
7
 
9
- const { width, height } = Dimensions.get('window');
10
-
11
8
  export class BounceIn
12
9
  extends ComplexAnimationBuilder
13
10
  implements IEntryExitAnimationBuilder
@@ -82,7 +79,7 @@ export class BounceInDown
82
79
  const callback = this.callbackV;
83
80
  const initialValues = this.initialValues;
84
81
 
85
- return () => {
82
+ return (values) => {
86
83
  'worklet';
87
84
  return {
88
85
  animations: {
@@ -103,7 +100,7 @@ export class BounceInDown
103
100
  initialValues: {
104
101
  transform: [
105
102
  {
106
- translateY: height,
103
+ translateY: values.windowHeight,
107
104
  },
108
105
  ],
109
106
  ...initialValues,
@@ -137,7 +134,7 @@ export class BounceInUp
137
134
  const callback = this.callbackV;
138
135
  const initialValues = this.initialValues;
139
136
 
140
- return () => {
137
+ return (values) => {
141
138
  'worklet';
142
139
  return {
143
140
  animations: {
@@ -156,7 +153,7 @@ export class BounceInUp
156
153
  ],
157
154
  },
158
155
  initialValues: {
159
- transform: [{ translateY: -height }],
156
+ transform: [{ translateY: -values.windowHeight }],
160
157
  ...initialValues,
161
158
  },
162
159
  callback: callback,
@@ -188,7 +185,7 @@ export class BounceInLeft
188
185
  const callback = this.callbackV;
189
186
  const initialValues = this.initialValues;
190
187
 
191
- return () => {
188
+ return (values) => {
192
189
  'worklet';
193
190
  return {
194
191
  animations: {
@@ -207,7 +204,7 @@ export class BounceInLeft
207
204
  ],
208
205
  },
209
206
  initialValues: {
210
- transform: [{ translateX: -width }],
207
+ transform: [{ translateX: -values.windowWidth }],
211
208
  ...initialValues,
212
209
  },
213
210
  callback: callback,
@@ -239,7 +236,7 @@ export class BounceInRight
239
236
  const callback = this.callbackV;
240
237
  const initialValues = this.initialValues;
241
238
 
242
- return () => {
239
+ return (values) => {
243
240
  'worklet';
244
241
  return {
245
242
  animations: {
@@ -258,7 +255,7 @@ export class BounceInRight
258
255
  ],
259
256
  },
260
257
  initialValues: {
261
- transform: [{ translateX: width }],
258
+ transform: [{ translateX: values.windowWidth }],
262
259
  ...initialValues,
263
260
  },
264
261
  callback: callback,
@@ -341,7 +338,7 @@ export class BounceOutDown
341
338
  const callback = this.callbackV;
342
339
  const initialValues = this.initialValues;
343
340
 
344
- return () => {
341
+ return (values) => {
345
342
  'worklet';
346
343
  return {
347
344
  animations: {
@@ -353,7 +350,7 @@ export class BounceOutDown
353
350
  withTiming(-10, { duration: duration * 0.15 }),
354
351
  withTiming(10, { duration: duration * 0.15 }),
355
352
  withTiming(-20, { duration: duration * 0.15 }),
356
- withTiming(height, {
353
+ withTiming(values.windowHeight, {
357
354
  duration: duration * 0.55,
358
355
  })
359
356
  )
@@ -394,7 +391,7 @@ export class BounceOutUp
394
391
  const callback = this.callbackV;
395
392
  const initialValues = this.initialValues;
396
393
 
397
- return () => {
394
+ return (values) => {
398
395
  'worklet';
399
396
  return {
400
397
  animations: {
@@ -406,7 +403,7 @@ export class BounceOutUp
406
403
  withTiming(10, { duration: duration * 0.15 }),
407
404
  withTiming(-10, { duration: duration * 0.15 }),
408
405
  withTiming(20, { duration: duration * 0.15 }),
409
- withTiming(-height, {
406
+ withTiming(-values.windowHeight, {
410
407
  duration: duration * 0.55,
411
408
  })
412
409
  )
@@ -447,7 +444,7 @@ export class BounceOutLeft
447
444
  const callback = this.callbackV;
448
445
  const initialValues = this.initialValues;
449
446
 
450
- return () => {
447
+ return (values) => {
451
448
  'worklet';
452
449
  return {
453
450
  animations: {
@@ -459,7 +456,7 @@ export class BounceOutLeft
459
456
  withTiming(10, { duration: duration * 0.15 }),
460
457
  withTiming(-10, { duration: duration * 0.15 }),
461
458
  withTiming(20, { duration: duration * 0.15 }),
462
- withTiming(-width, {
459
+ withTiming(-values.windowWidth, {
463
460
  duration: duration * 0.55,
464
461
  })
465
462
  )
@@ -500,7 +497,7 @@ export class BounceOutRight
500
497
  const callback = this.callbackV;
501
498
  const initialValues = this.initialValues;
502
499
 
503
- return () => {
500
+ return (values) => {
504
501
  'worklet';
505
502
  return {
506
503
  animations: {
@@ -512,7 +509,7 @@ export class BounceOutRight
512
509
  withTiming(-10, { duration: duration * 0.15 }),
513
510
  withTiming(10, { duration: duration * 0.15 }),
514
511
  withTiming(-20, { duration: duration * 0.15 }),
515
- withTiming(width, {
512
+ withTiming(values.windowWidth, {
516
513
  duration: duration * 0.55,
517
514
  })
518
515
  )
@@ -1,4 +1,3 @@
1
- import { Dimensions } from 'react-native';
2
1
  import { withSequence, withTiming } from '../../animation';
3
2
  import { ComplexAnimationBuilder } from '../animationBuilder';
4
3
  import {
@@ -6,8 +5,6 @@ import {
6
5
  IEntryExitAnimationBuilder,
7
6
  } from '../animationBuilder/commonTypes';
8
7
 
9
- const { width } = Dimensions.get('window');
10
-
11
8
  export class LightSpeedInRight
12
9
  extends ComplexAnimationBuilder
13
10
  implements IEntryExitAnimationBuilder
@@ -24,7 +21,7 @@ export class LightSpeedInRight
24
21
  const callback = this.callbackV;
25
22
  const initialValues = this.initialValues;
26
23
 
27
- return () => {
24
+ return (values) => {
28
25
  'worklet';
29
26
  return {
30
27
  animations: {
@@ -50,7 +47,7 @@ export class LightSpeedInRight
50
47
  },
51
48
  initialValues: {
52
49
  opacity: 0,
53
- transform: [{ translateX: width }, { skewX: '-45deg' }],
50
+ transform: [{ translateX: values.windowWidth }, { skewX: '-45deg' }],
54
51
  ...initialValues,
55
52
  },
56
53
  callback: callback,
@@ -75,7 +72,7 @@ export class LightSpeedInLeft
75
72
  const callback = this.callbackV;
76
73
  const initialValues = this.initialValues;
77
74
 
78
- return () => {
75
+ return (values) => {
79
76
  'worklet';
80
77
  return {
81
78
  animations: {
@@ -101,7 +98,7 @@ export class LightSpeedInLeft
101
98
  },
102
99
  initialValues: {
103
100
  opacity: 0,
104
- transform: [{ translateX: -width }, { skewX: '45deg' }],
101
+ transform: [{ translateX: -values.windowWidth }, { skewX: '45deg' }],
105
102
  ...initialValues,
106
103
  },
107
104
  callback: callback,
@@ -125,14 +122,17 @@ export class LightSpeedOutRight
125
122
  const callback = this.callbackV;
126
123
  const initialValues = this.initialValues;
127
124
 
128
- return () => {
125
+ return (values) => {
129
126
  'worklet';
130
127
  return {
131
128
  animations: {
132
129
  opacity: delayFunction(delay, animation(0, config)),
133
130
  transform: [
134
131
  {
135
- translateX: delayFunction(delay, animation(width, config)),
132
+ translateX: delayFunction(
133
+ delay,
134
+ animation(values.windowWidth, config)
135
+ ),
136
136
  },
137
137
  {
138
138
  skewX: delayFunction(delay, animation('-45deg', config)),
@@ -165,14 +165,17 @@ export class LightSpeedOutLeft
165
165
  const callback = this.callbackV;
166
166
  const initialValues = this.initialValues;
167
167
 
168
- return () => {
168
+ return (values) => {
169
169
  'worklet';
170
170
  return {
171
171
  animations: {
172
172
  opacity: delayFunction(delay, animation(0, config)),
173
173
  transform: [
174
174
  {
175
- translateX: delayFunction(delay, animation(-width, config)),
175
+ translateX: delayFunction(
176
+ delay,
177
+ animation(-values.windowWidth, config)
178
+ ),
176
179
  },
177
180
  {
178
181
  skewX: delayFunction(delay, animation('45deg', config)),
@@ -1,12 +1,9 @@
1
- import { Dimensions } from 'react-native';
2
1
  import { ComplexAnimationBuilder } from '../animationBuilder';
3
2
  import {
4
3
  EntryExitAnimationFunction,
5
4
  IEntryExitAnimationBuilder,
6
5
  } from '../animationBuilder/commonTypes';
7
6
 
8
- const { width } = Dimensions.get('window');
9
-
10
7
  export class RollInLeft
11
8
  extends ComplexAnimationBuilder
12
9
  implements IEntryExitAnimationBuilder
@@ -22,7 +19,7 @@ export class RollInLeft
22
19
  const callback = this.callbackV;
23
20
  const initialValues = this.initialValues;
24
21
 
25
- return () => {
22
+ return (values) => {
26
23
  'worklet';
27
24
  return {
28
25
  animations: {
@@ -32,7 +29,10 @@ export class RollInLeft
32
29
  ],
33
30
  },
34
31
  initialValues: {
35
- transform: [{ translateX: -width }, { rotate: '-180deg' }],
32
+ transform: [
33
+ { translateX: -values.windowWidth },
34
+ { rotate: '-180deg' },
35
+ ],
36
36
  ...initialValues,
37
37
  },
38
38
  callback: callback,
@@ -56,7 +56,7 @@ export class RollInRight
56
56
  const callback = this.callbackV;
57
57
  const initialValues = this.initialValues;
58
58
 
59
- return () => {
59
+ return (values) => {
60
60
  'worklet';
61
61
  return {
62
62
  animations: {
@@ -66,7 +66,7 @@ export class RollInRight
66
66
  ],
67
67
  },
68
68
  initialValues: {
69
- transform: [{ translateX: width }, { rotate: '180deg' }],
69
+ transform: [{ translateX: values.windowWidth }, { rotate: '180deg' }],
70
70
  ...initialValues,
71
71
  },
72
72
  callback: callback,
@@ -90,12 +90,17 @@ export class RollOutLeft
90
90
  const callback = this.callbackV;
91
91
  const initialValues = this.initialValues;
92
92
 
93
- return () => {
93
+ return (values) => {
94
94
  'worklet';
95
95
  return {
96
96
  animations: {
97
97
  transform: [
98
- { translateX: delayFunction(delay, animation(-width, config)) },
98
+ {
99
+ translateX: delayFunction(
100
+ delay,
101
+ animation(-values.windowWidth, config)
102
+ ),
103
+ },
99
104
  { rotate: delayFunction(delay, animation('-180deg', config)) },
100
105
  ],
101
106
  },
@@ -124,12 +129,17 @@ export class RollOutRight
124
129
  const callback = this.callbackV;
125
130
  const initialValues = this.initialValues;
126
131
 
127
- return () => {
132
+ return (values) => {
128
133
  'worklet';
129
134
  return {
130
135
  animations: {
131
136
  transform: [
132
- { translateX: delayFunction(delay, animation(width, config)) },
137
+ {
138
+ translateX: delayFunction(
139
+ delay,
140
+ animation(values.windowWidth, config)
141
+ ),
142
+ },
133
143
  { rotate: delayFunction(delay, animation('180deg', config)) },
134
144
  ],
135
145
  },