react-native-reanimated 2.3.0-alpha.3 → 2.3.0-beta.4

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 (264) hide show
  1. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +15 -8
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +176 -154
  3. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +49 -33
  4. package/Common/cpp/Registries/EventHandlerRegistry.cpp +14 -7
  5. package/Common/cpp/Registries/MapperRegistry.cpp +24 -20
  6. package/Common/cpp/Registries/WorkletsCache.cpp +19 -9
  7. package/Common/cpp/SharedItems/FrozenObject.cpp +17 -8
  8. package/Common/cpp/SharedItems/MutableValue.cpp +38 -25
  9. package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +11 -7
  10. package/Common/cpp/SharedItems/RemoteObject.cpp +9 -5
  11. package/Common/cpp/SharedItems/ShareableValue.cpp +211 -160
  12. package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
  13. package/Common/cpp/Tools/JSIStoreValueUser.cpp +25 -6
  14. package/Common/cpp/Tools/Mapper.cpp +30 -30
  15. package/Common/cpp/Tools/RuntimeDecorator.cpp +124 -86
  16. package/Common/cpp/Tools/Scheduler.cpp +6 -5
  17. package/Common/cpp/Tools/WorkletEventHandler.cpp +4 -2
  18. package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +12 -11
  19. package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +50 -31
  20. package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +34 -16
  21. package/Common/cpp/headers/Registries/EventHandlerRegistry.h +15 -8
  22. package/Common/cpp/headers/Registries/MapperRegistry.h +5 -4
  23. package/Common/cpp/headers/Registries/WorkletsCache.h +9 -7
  24. package/Common/cpp/headers/SharedItems/FrozenObject.h +19 -11
  25. package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +8 -4
  26. package/Common/cpp/headers/SharedItems/MutableValue.h +23 -12
  27. package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +12 -7
  28. package/Common/cpp/headers/SharedItems/RemoteObject.h +19 -8
  29. package/Common/cpp/headers/SharedItems/RuntimeManager.h +26 -25
  30. package/Common/cpp/headers/SharedItems/ShareableValue.h +32 -27
  31. package/Common/cpp/headers/SharedItems/SharedParent.h +10 -7
  32. package/Common/cpp/headers/SharedItems/ValueWrapper.h +95 -72
  33. package/Common/cpp/headers/SpecTools/ErrorHandler.h +18 -19
  34. package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
  35. package/Common/cpp/headers/Tools/JSIStoreValueUser.h +13 -16
  36. package/Common/cpp/headers/Tools/Mapper.h +19 -16
  37. package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +17 -7
  38. package/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +7 -11
  39. package/Common/cpp/headers/Tools/RuntimeDecorator.h +36 -27
  40. package/Common/cpp/headers/Tools/Scheduler.h +30 -35
  41. package/Common/cpp/headers/Tools/WorkletEventHandler.h +11 -8
  42. package/Common/cpp/hidden_headers/Logger.h +14 -14
  43. package/Common/cpp/hidden_headers/LoggerInterface.h +8 -9
  44. package/Common/cpp/hidden_headers/SpeedChecker.h +7 -8
  45. package/README.md +1 -1
  46. package/RNReanimated.podspec +24 -6
  47. package/android/build.gradle +38 -29
  48. package/android/react-native-reanimated-63-hermes.aar +0 -0
  49. package/android/react-native-reanimated-63-jsc.aar +0 -0
  50. package/android/react-native-reanimated-64-hermes.aar +0 -0
  51. package/android/react-native-reanimated-64-jsc.aar +0 -0
  52. package/android/react-native-reanimated-65-hermes.aar +0 -0
  53. package/android/react-native-reanimated-65-jsc.aar +0 -0
  54. package/android/react-native-reanimated-66-hermes.aar +0 -0
  55. package/android/react-native-reanimated-66-jsc.aar +0 -0
  56. package/android/react-native-reanimated-67-hermes.aar +0 -0
  57. package/android/react-native-reanimated-67-jsc.aar +0 -0
  58. package/ios/LayoutReanimation/REAAnimationsManager.h +10 -8
  59. package/ios/LayoutReanimation/REAAnimationsManager.m +91 -87
  60. package/ios/LayoutReanimation/REASnapshot.h +2 -2
  61. package/ios/LayoutReanimation/REASnapshot.m +8 -7
  62. package/ios/LayoutReanimation/REAUIManager.h +4 -4
  63. package/ios/LayoutReanimation/REAUIManager.mm +116 -70
  64. package/ios/Nodes/REAAlwaysNode.m +14 -15
  65. package/ios/Nodes/REABezierNode.m +8 -7
  66. package/ios/Nodes/REABlockNode.m +1 -1
  67. package/ios/Nodes/REACallFuncNode.h +0 -1
  68. package/ios/Nodes/REACallFuncNode.m +10 -8
  69. package/ios/Nodes/REAClockNodes.m +22 -20
  70. package/ios/Nodes/REAConcatNode.h +0 -1
  71. package/ios/Nodes/REAConcatNode.m +2 -2
  72. package/ios/Nodes/REACondNode.m +7 -5
  73. package/ios/Nodes/READebugNode.m +5 -4
  74. package/ios/Nodes/REAEventNode.m +1 -1
  75. package/ios/Nodes/REAFunctionNode.h +0 -1
  76. package/ios/Nodes/REAFunctionNode.m +2 -2
  77. package/ios/Nodes/REAJSCallNode.m +4 -5
  78. package/ios/Nodes/REANode.h +3 -4
  79. package/ios/Nodes/REANode.m +9 -11
  80. package/ios/Nodes/REAOperatorNode.m +68 -67
  81. package/ios/Nodes/REAParamNode.h +1 -3
  82. package/ios/Nodes/REAParamNode.m +15 -17
  83. package/ios/Nodes/REAPropsNode.h +1 -3
  84. package/ios/Nodes/REAPropsNode.m +19 -22
  85. package/ios/Nodes/REASetNode.h +0 -1
  86. package/ios/Nodes/REASetNode.m +7 -5
  87. package/ios/Nodes/REAStyleNode.h +0 -1
  88. package/ios/Nodes/REAStyleNode.m +2 -4
  89. package/ios/Nodes/REATransformNode.h +0 -1
  90. package/ios/Nodes/REATransformNode.m +3 -5
  91. package/ios/Nodes/REAValueNode.m +5 -7
  92. package/ios/REAEventDispatcher.m +4 -4
  93. package/ios/REAModule.h +0 -2
  94. package/ios/REAModule.m +29 -38
  95. package/ios/REANodesManager.h +11 -19
  96. package/ios/REANodesManager.m +106 -130
  97. package/ios/REAUtils.h +5 -3
  98. package/ios/RNGestureHandlerStateManager.h +5 -0
  99. package/ios/Transitioning/RCTConvert+REATransition.m +45 -29
  100. package/ios/Transitioning/REAAllTransitions.h +2 -2
  101. package/ios/Transitioning/REAAllTransitions.m +14 -25
  102. package/ios/Transitioning/REATransition.h +8 -7
  103. package/ios/Transitioning/REATransition.m +19 -16
  104. package/ios/Transitioning/REATransitionAnimation.h +1 -1
  105. package/ios/Transitioning/REATransitionAnimation.m +2 -3
  106. package/ios/Transitioning/REATransitionManager.m +3 -3
  107. package/ios/native/NativeMethods.h +20 -5
  108. package/ios/native/NativeMethods.mm +14 -6
  109. package/ios/native/NativeProxy.h +4 -2
  110. package/ios/native/NativeProxy.mm +84 -63
  111. package/ios/native/REAIOSErrorHandler.h +13 -10
  112. package/ios/native/REAIOSErrorHandler.mm +19 -15
  113. package/ios/native/REAIOSLogger.h +8 -8
  114. package/ios/native/REAIOSLogger.mm +10 -6
  115. package/ios/native/REAIOSScheduler.h +5 -5
  116. package/ios/native/REAIOSScheduler.mm +17 -10
  117. package/ios/native/REAInitializer.h +5 -7
  118. package/ios/native/REAInitializer.mm +43 -31
  119. package/ios/native/UIResponder+Reanimated.mm +2 -2
  120. package/lib/Animated.js +9 -1
  121. package/lib/ConfigHelper.js +121 -138
  122. package/lib/ReanimatedEventEmitter.js +0 -1
  123. package/lib/ReanimatedModule.js +0 -1
  124. package/lib/ReanimatedModule.macos.js +0 -1
  125. package/lib/ReanimatedModule.native.js +5 -6
  126. package/lib/ReanimatedModule.windows.js +0 -1
  127. package/lib/ReanimatedModuleCompat.js +64 -35
  128. package/lib/createAnimatedComponent.js +468 -487
  129. package/lib/index.js +9 -1
  130. package/lib/reanimated2/NativeMethods.js +7 -12
  131. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +37 -0
  132. package/lib/reanimated2/NativeReanimated/index.js +15 -0
  133. package/lib/reanimated2/PropAdapters.js +0 -1
  134. package/lib/reanimated2/UpdateProps.js +6 -7
  135. package/lib/reanimated2/ViewDescriptorsSet.js +4 -4
  136. package/lib/reanimated2/WorkletEventHandler.js +15 -13
  137. package/lib/reanimated2/animation/delay.js +8 -2
  138. package/lib/reanimated2/animation/spring.js +2 -0
  139. package/lib/reanimated2/animation/styleAnimation.js +7 -3
  140. package/lib/reanimated2/animation/util.js +25 -2
  141. package/lib/reanimated2/core.js +41 -17
  142. package/lib/reanimated2/globals.d.ts +21 -1
  143. package/lib/reanimated2/hook/useAnimatedRef.js +1 -1
  144. package/lib/reanimated2/hook/useAnimatedStyle.js +3 -3
  145. package/lib/reanimated2/index.js +1 -0
  146. package/lib/reanimated2/interpolation.js +95 -87
  147. package/lib/reanimated2/js-reanimated/JSReanimated.js +13 -10
  148. package/lib/reanimated2/js-reanimated/Mapper.js +4 -3
  149. package/lib/reanimated2/js-reanimated/MapperRegistry.js +3 -6
  150. package/lib/reanimated2/js-reanimated/MutableValue.js +0 -2
  151. package/lib/reanimated2/js-reanimated/index.js +10 -8
  152. package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +33 -2
  153. package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +27 -124
  154. package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +125 -0
  155. package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +1 -2
  156. package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +115 -45
  157. package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +7 -2
  158. package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +21 -21
  159. package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +25 -25
  160. package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +19 -17
  161. package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +5 -5
  162. package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +9 -9
  163. package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +17 -17
  164. package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +19 -19
  165. package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +9 -9
  166. package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +33 -33
  167. package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +78 -0
  168. package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +128 -0
  169. package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +37 -0
  170. package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +41 -0
  171. package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +34 -0
  172. package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +46 -0
  173. package/lib/reanimated2/layoutReanimation/defaultTransitions/index.js +6 -0
  174. package/lib/reanimated2/layoutReanimation/index.js +1 -0
  175. package/lib/reanimated2/mock.js +3 -1
  176. package/lib/reanimated2/utils.js +9 -0
  177. package/lib/setAndForwardRef.js +14 -48
  178. package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
  179. package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
  180. package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
  181. package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
  182. package/mock.js +1 -1
  183. package/package.json +28 -17
  184. package/plugin.js +220 -39
  185. package/react-native-reanimated.d.ts +542 -547
  186. package/src/Animated.js +9 -1
  187. package/src/{ConfigHelper.js → ConfigHelper.ts} +15 -7
  188. package/src/{ReanimatedEventEmitter.js → ReanimatedEventEmitter.ts} +0 -0
  189. package/src/{ReanimatedModule.js → ReanimatedModule.macos.ts} +0 -0
  190. package/src/{ReanimatedModule.native.js → ReanimatedModule.native.ts} +0 -0
  191. package/src/{ReanimatedModule.macos.js → ReanimatedModule.ts} +0 -0
  192. package/src/{ReanimatedModule.windows.js → ReanimatedModule.windows.ts} +0 -0
  193. package/src/ReanimatedModuleCompat.ts +51 -0
  194. package/src/{createAnimatedComponent.js → createAnimatedComponent.tsx} +285 -126
  195. package/src/reanimated2/NativeMethods.ts +34 -13
  196. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +72 -0
  197. package/src/reanimated2/NativeReanimated/index.ts +18 -0
  198. package/src/reanimated2/PropAdapters.ts +0 -1
  199. package/src/reanimated2/UpdateProps.ts +31 -15
  200. package/src/reanimated2/ViewDescriptorsSet.ts +15 -12
  201. package/src/reanimated2/WorkletEventHandler.ts +41 -23
  202. package/src/reanimated2/animation/commonTypes.ts +4 -4
  203. package/src/reanimated2/animation/decay.ts +2 -2
  204. package/src/reanimated2/animation/delay.ts +11 -5
  205. package/src/reanimated2/animation/index.ts +7 -7
  206. package/src/reanimated2/animation/repeat.ts +4 -4
  207. package/src/reanimated2/animation/sequence.ts +2 -2
  208. package/src/reanimated2/animation/spring.ts +6 -5
  209. package/src/reanimated2/animation/styleAnimation.ts +27 -15
  210. package/src/reanimated2/animation/timing.ts +5 -5
  211. package/src/reanimated2/animation/util.ts +47 -8
  212. package/src/reanimated2/commonTypes.ts +3 -0
  213. package/src/reanimated2/core.ts +80 -34
  214. package/src/reanimated2/globals.d.ts +21 -1
  215. package/src/reanimated2/hook/useAnimatedGestureHandler.ts +1 -1
  216. package/src/reanimated2/hook/useAnimatedRef.ts +13 -15
  217. package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -3
  218. package/src/reanimated2/hook/useAnimatedStyle.ts +7 -7
  219. package/src/reanimated2/hook/utils.ts +4 -3
  220. package/src/reanimated2/index.ts +1 -0
  221. package/src/reanimated2/interpolation.ts +170 -103
  222. package/src/reanimated2/js-reanimated/JSReanimated.ts +37 -23
  223. package/src/reanimated2/js-reanimated/Mapper.ts +22 -9
  224. package/src/reanimated2/js-reanimated/MapperRegistry.ts +22 -19
  225. package/src/reanimated2/js-reanimated/MutableValue.ts +11 -11
  226. package/src/reanimated2/js-reanimated/index.ts +31 -14
  227. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +75 -0
  228. package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +29 -159
  229. package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +169 -0
  230. package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -2
  231. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +3 -9
  232. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -5
  233. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +162 -82
  234. package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +7 -2
  235. package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +32 -32
  236. package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +38 -38
  237. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +34 -32
  238. package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -8
  239. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +14 -14
  240. package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +26 -26
  241. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +28 -28
  242. package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +14 -14
  243. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +50 -50
  244. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +104 -0
  245. package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +213 -0
  246. package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +60 -0
  247. package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +58 -0
  248. package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +41 -0
  249. package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +78 -0
  250. package/src/reanimated2/layoutReanimation/defaultTransitions/index.ts +6 -0
  251. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  252. package/src/reanimated2/mock.ts +3 -1
  253. package/src/reanimated2/utils.ts +21 -0
  254. package/src/{setAndForwardRef.js → setAndForwardRef.ts} +12 -2
  255. package/android/react-native-reanimated-62-hermes.aar +0 -0
  256. package/android/react-native-reanimated-62-jsc.aar +0 -0
  257. package/lib/reanimated2/NativeReanimated.js +0 -48
  258. package/lib/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.js +0 -55
  259. package/lib/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.js +0 -165
  260. package/src/ReanimatedModuleCompat.js +0 -37
  261. package/src/reanimated2/NativeReanimated.ts +0 -70
  262. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.tsx +0 -41
  263. package/src/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.ts +0 -82
  264. package/src/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.ts +0 -217
@@ -3,7 +3,7 @@ import {
3
3
  Timestamp,
4
4
  HigherOrderAnimation,
5
5
  AnimationCallback,
6
- PrimitiveValue,
6
+ AnimatableValue,
7
7
  AnimationObject,
8
8
  Animation,
9
9
  } from './commonTypes';
@@ -14,6 +14,8 @@ import {
14
14
  StyleProps,
15
15
  } from '../commonTypes';
16
16
  import { withTiming } from './timing';
17
+ import { ColorProperties } from '../UpdateProps';
18
+ import { processColor } from '../Colors';
17
19
 
18
20
  export interface StyleLayoutAnimation extends HigherOrderAnimation {
19
21
  current: StyleProps;
@@ -30,30 +32,33 @@ export interface StyleLayoutAnimation extends HigherOrderAnimation {
30
32
 
31
33
  // resolves path to value for nested objects
32
34
  // if path cannot be resolved returns undefined
33
- function resolvePath<T>(
35
+ export function resolvePath<T>(
34
36
  obj: NestedObject<T>,
35
- path: PrimitiveValue[] | PrimitiveValue
37
+ path: AnimatableValue[] | AnimatableValue
36
38
  ): NestedObjectValues<T> | undefined {
37
39
  'worklet';
38
- const keys: PrimitiveValue[] = Array.isArray(path) ? path : [path];
40
+ const keys: AnimatableValue[] = Array.isArray(path) ? path : [path];
39
41
  return keys.reduce<NestedObjectValues<T> | undefined>((acc, current) => {
40
42
  if (Array.isArray(acc) && typeof current === 'number') {
41
43
  return acc[current];
42
- } else if (typeof acc === 'object' && current in acc) {
43
- return (acc as { [key: string]: NestedObjectValues<T> })[current];
44
+ } else if (typeof acc === 'object' && (current as number | string) in acc) {
45
+ return (acc as { [key: string]: NestedObjectValues<T> })[
46
+ current as number | string
47
+ ];
44
48
  }
45
49
  return undefined;
46
50
  }, obj);
47
51
  }
48
52
 
49
53
  // set value at given path
50
- function setPath<T>(
54
+ type Path = Array<string | number> | string | number;
55
+ export function setPath<T>(
51
56
  obj: NestedObject<T>,
52
- path: PrimitiveValue[] | PrimitiveValue,
57
+ path: Path,
53
58
  value: NestedObjectValues<T>
54
- ) {
59
+ ): void {
55
60
  'worklet';
56
- const keys: PrimitiveValue[] = Array.isArray(path) ? path : [path];
61
+ const keys: Path = Array.isArray(path) ? path : [path];
57
62
  let currObj: NestedObjectValues<T> = obj;
58
63
  for (let i = 0; i < keys.length - 1; i++) {
59
64
  // creates entry if there isn't one
@@ -76,7 +81,7 @@ function setPath<T>(
76
81
 
77
82
  interface NestedObjectEntry<T> {
78
83
  value: NestedObjectValues<T>;
79
- path: PrimitiveValue[];
84
+ path: (string | number)[];
80
85
  }
81
86
 
82
87
  export function withStyleAnimation(
@@ -131,6 +136,13 @@ export function withStyleAnimation(
131
136
  } else {
132
137
  stillGoing = true;
133
138
  }
139
+
140
+ if (ColorProperties.includes(currentEntry.path[0] as string)) {
141
+ currentStyleAnimation.current = processColor(
142
+ currentStyleAnimation.current
143
+ ) as number;
144
+ }
145
+
134
146
  setPath(
135
147
  animation.current,
136
148
  currentEntry.path,
@@ -148,13 +160,13 @@ export function withStyleAnimation(
148
160
  previousAnimation: StyleLayoutAnimation
149
161
  ): void => {
150
162
  const entriesToCheck: NestedObjectEntry<
151
- AnimationObject | PrimitiveValue
163
+ AnimationObject | AnimatableValue
152
164
  >[] = [{ value: styleAnimations, path: [] }];
153
165
  while (entriesToCheck.length > 0) {
154
166
  const currentEntry: NestedObjectEntry<
155
- AnimationObject | PrimitiveValue
167
+ AnimationObject | AnimatableValue
156
168
  > = entriesToCheck.pop() as NestedObjectEntry<
157
- AnimationObject | PrimitiveValue
169
+ AnimationObject | AnimatableValue
158
170
  >;
159
171
  if (Array.isArray(currentEntry.value)) {
160
172
  for (let index = 0; index < currentEntry.value.length; index++) {
@@ -189,7 +201,7 @@ export function withStyleAnimation(
189
201
  !currentEntry.value.onStart
190
202
  ) {
191
203
  currentAnimation = withTiming(
192
- currentEntry.value as PrimitiveValue,
204
+ currentEntry.value as AnimatableValue,
193
205
  { duration: 0 }
194
206
  );
195
207
  setPath(
@@ -4,7 +4,7 @@ import {
4
4
  Animation,
5
5
  AnimationCallback,
6
6
  Timestamp,
7
- PrimitiveValue,
7
+ AnimatableValue,
8
8
  } from './commonTypes';
9
9
 
10
10
  interface TimingConfig {
@@ -15,11 +15,11 @@ interface TimingConfig {
15
15
  export interface TimingAnimation extends Animation<TimingAnimation> {
16
16
  type: string;
17
17
  easing: EasingFn;
18
- startValue: PrimitiveValue;
18
+ startValue: AnimatableValue;
19
19
  startTime: Timestamp;
20
20
  progress: number;
21
- toValue: PrimitiveValue;
22
- current: PrimitiveValue;
21
+ toValue: AnimatableValue;
22
+ current: AnimatableValue;
23
23
  }
24
24
 
25
25
  export interface InnerTimingAnimation
@@ -29,7 +29,7 @@ export interface InnerTimingAnimation
29
29
  }
30
30
 
31
31
  export function withTiming(
32
- toValue: PrimitiveValue,
32
+ toValue: AnimatableValue,
33
33
  userConfig?: TimingConfig,
34
34
  callback?: AnimationCallback
35
35
  ): Animation<TimingAnimation> {
@@ -3,7 +3,7 @@ import {
3
3
  AnimationObject,
4
4
  HigherOrderAnimation,
5
5
  NextAnimation,
6
- PrimitiveValue,
6
+ AnimatableValue,
7
7
  Timestamp,
8
8
  } from './commonTypes';
9
9
  /* global _WORKLET */
@@ -11,7 +11,7 @@ import { ParsedColorArray, convertToHSVA, isColor, toRGBA } from '../Colors';
11
11
 
12
12
  import { AnimatedStyle, SharedValue } from '../commonTypes';
13
13
  import { DelayAnimation } from './delay';
14
- import NativeReanimated from '../NativeReanimated';
14
+ import NativeReanimatedModule from '../NativeReanimated';
15
15
  import { RepeatAnimation } from './repeat';
16
16
  import { SequenceAnimation } from './sequence';
17
17
  import { StyleLayoutAnimation } from './styleAnimation';
@@ -32,7 +32,7 @@ interface RecognizedPrefixSuffix {
32
32
  strippedValue: number;
33
33
  }
34
34
 
35
- function recognizePrefixSuffix(value: PrimitiveValue): RecognizedPrefixSuffix {
35
+ function recognizePrefixSuffix(value: string | number): RecognizedPrefixSuffix {
36
36
  'worklet';
37
37
  if (typeof value === 'string') {
38
38
  const match = value.match(
@@ -68,7 +68,7 @@ function decorateAnimation<T extends AnimationObject | StyleLayoutAnimation>(
68
68
 
69
69
  const prefNumberSuffOnStart = (
70
70
  animation: Animation<AnimationObject>,
71
- value: PrimitiveValue,
71
+ value: string | number,
72
72
  timestamp: number,
73
73
  previousAnimation: Animation<AnimationObject>
74
74
  ) => {
@@ -78,7 +78,7 @@ function decorateAnimation<T extends AnimationObject | StyleLayoutAnimation>(
78
78
  animation.__suffix = suffix;
79
79
  animation.strippedCurrent = strippedValue;
80
80
  const { strippedValue: strippedToValue } = recognizePrefixSuffix(
81
- animation.toValue as PrimitiveValue
81
+ animation.toValue as string | number
82
82
  );
83
83
  animation.current = strippedValue;
84
84
  animation.startValue = strippedValue;
@@ -167,6 +167,41 @@ function decorateAnimation<T extends AnimationObject | StyleLayoutAnimation>(
167
167
  return finished;
168
168
  };
169
169
 
170
+ const arrayOnStart = (
171
+ animation: Animation<AnimationObject>,
172
+ value: Array<number>,
173
+ timestamp: Timestamp,
174
+ previousAnimation: Animation<AnimationObject>
175
+ ): void => {
176
+ value.forEach((v, i) => {
177
+ animation[i] = Object.assign({}, animationCopy);
178
+ animation[i].current = v;
179
+ animation[i].toValue = (animation.toValue as Array<number>)[i];
180
+ animation[i].onStart(
181
+ animation[i],
182
+ v,
183
+ timestamp,
184
+ previousAnimation ? previousAnimation[i] : undefined
185
+ );
186
+ });
187
+
188
+ animation.current = value;
189
+ };
190
+
191
+ const arrayOnFrame = (
192
+ animation: Animation<AnimationObject>,
193
+ timestamp: Timestamp
194
+ ): boolean => {
195
+ let finished = true;
196
+ (animation.current as Array<number>).forEach((v, i) => {
197
+ // @ts-ignore: disable-next-line
198
+ finished &= animation[i].onFrame(animation[i], timestamp);
199
+ (animation.current as Array<number>)[i] = animation[i].current;
200
+ });
201
+
202
+ return finished;
203
+ };
204
+
170
205
  animation.onStart = (
171
206
  animation: Animation<AnimationObject>,
172
207
  value: number,
@@ -177,6 +212,10 @@ function decorateAnimation<T extends AnimationObject | StyleLayoutAnimation>(
177
212
  colorOnStart(animation, value, timestamp, previousAnimation);
178
213
  animation.onFrame = colorOnFrame;
179
214
  return;
215
+ } else if (Array.isArray(value)) {
216
+ arrayOnStart(animation, value, timestamp, previousAnimation);
217
+ animation.onFrame = arrayOnFrame;
218
+ return;
180
219
  } else if (typeof value === 'string') {
181
220
  prefNumberSuffOnStart(animation, value, timestamp, previousAnimation);
182
221
  animation.onFrame = prefNumberSuffOnFrame;
@@ -196,7 +235,7 @@ type AnimationToDecoration<
196
235
  ? NextAnimation<RepeatAnimation>
197
236
  : T extends SequenceAnimation
198
237
  ? NextAnimation<SequenceAnimation>
199
- : PrimitiveValue | T;
238
+ : AnimatableValue | T;
200
239
 
201
240
  export function defineAnimation<
202
241
  T extends AnimationObject | StyleLayoutAnimation
@@ -212,7 +251,7 @@ export function defineAnimation<
212
251
  return animation;
213
252
  };
214
253
 
215
- if (_WORKLET || !NativeReanimated.native) {
254
+ if (_WORKLET || !NativeReanimatedModule.native) {
216
255
  return create();
217
256
  }
218
257
  // @ts-ignore: eslint-disable-line
@@ -227,7 +266,7 @@ export function cancelAnimation<T>(sharedValue: SharedValue<T>): void {
227
266
 
228
267
  // TODO it should work only if there was no animation before.
229
268
  export function withStartValue(
230
- startValue: PrimitiveValue,
269
+ startValue: AnimatableValue,
231
270
  animation: NextAnimation<AnimationObject>
232
271
  ): Animation<AnimationObject> {
233
272
  'worklet';
@@ -59,6 +59,9 @@ export interface BasicWorkletFunction<T> extends WorkletFunction {
59
59
  (): T;
60
60
  }
61
61
 
62
+ export interface NativeEvent<T> {
63
+ nativeEvent: T;
64
+ }
62
65
  export interface ComplexWorkletFunction<A extends any[], R>
63
66
  extends WorkletFunction {
64
67
  (...args: A): R;
@@ -1,5 +1,5 @@
1
1
  /* global _WORKLET _getCurrentTime _frameTimestamp _eventTimestamp, _setGlobalConsole */
2
- import NativeReanimated from './NativeReanimated';
2
+ import NativeReanimatedModule from './NativeReanimated';
3
3
  import { Platform } from 'react-native';
4
4
  import { nativeShouldBeMock, shouldBeUseWeb } from './PlatformChecker';
5
5
  import {
@@ -10,10 +10,11 @@ import {
10
10
  } from './commonTypes';
11
11
  import {
12
12
  AnimationObject,
13
- PrimitiveValue,
13
+ AnimatableValue,
14
14
  Timestamp,
15
15
  } from './animation/commonTypes';
16
16
  import { Descriptor } from './hook/commonTypes';
17
+ import JSReanimated from './js-reanimated/JSReanimated';
17
18
 
18
19
  global.__reanimatedWorkletInit = function (worklet: WorkletFunction) {
19
20
  worklet.__worklet = true;
@@ -30,11 +31,17 @@ export type ReanimatedConsole = Pick<
30
31
  Console,
31
32
  'debug' | 'log' | 'warn' | 'info' | 'error'
32
33
  >;
34
+
35
+ export type WorkletValue =
36
+ | (() => AnimationObject)
37
+ | AnimationObject
38
+ | AnimatableValue
39
+ | Descriptor;
33
40
  interface WorkletValueSetterContext {
34
41
  _animation?: AnimationObject | null;
35
- _value?: PrimitiveValue | Descriptor;
36
- value?: PrimitiveValue;
37
- _setValue?: (val: PrimitiveValue | Descriptor) => void;
42
+ _value?: AnimatableValue | Descriptor;
43
+ value?: AnimatableValue;
44
+ _setValue?: (val: AnimatableValue | Descriptor) => void;
38
45
  }
39
46
 
40
47
  const testWorklet: BasicWorkletFunction<void> = () => {
@@ -58,13 +65,13 @@ export const checkPluginState: (throwError: boolean) => boolean = (
58
65
  export const isConfigured: (throwError?: boolean) => boolean = (
59
66
  throwError = false
60
67
  ) => {
61
- return checkPluginState(throwError) && !NativeReanimated.useOnlyV1;
68
+ return checkPluginState(throwError) && !NativeReanimatedModule.useOnlyV1;
62
69
  };
63
70
 
64
71
  export const isConfiguredCheck: () => void = () => {
65
72
  if (!isConfigured(true)) {
66
73
  throw new Error(
67
- 'If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/installation'
74
+ 'If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation'
68
75
  );
69
76
  }
70
77
  };
@@ -112,12 +119,12 @@ global.__reanimatedWorkletInit = function (worklet: WorkletFunction) {
112
119
  };
113
120
 
114
121
  function pushFrame(frame: (timestamp: Timestamp) => void): void {
115
- NativeReanimated.pushFrame(frame);
122
+ (NativeReanimatedModule as JSReanimated).pushFrame(frame);
116
123
  }
117
124
 
118
125
  export function requestFrame(frame: (timestamp: Timestamp) => void): void {
119
126
  'worklet';
120
- if (NativeReanimated.native) {
127
+ if (NativeReanimatedModule.native) {
121
128
  requestAnimationFrame(frame);
122
129
  } else {
123
130
  pushFrame(frame);
@@ -137,25 +144,29 @@ export function runOnUI<A extends any[], R>(
137
144
 
138
145
  export function makeShareable<T>(value: T): T {
139
146
  isConfiguredCheck();
140
- return NativeReanimated.makeShareable(value);
147
+ return NativeReanimatedModule.makeShareable(value);
141
148
  }
142
149
 
143
150
  export function getViewProp<T>(viewTag: string, propName: string): Promise<T> {
144
151
  return new Promise((resolve, reject) => {
145
- return NativeReanimated.getViewProp(viewTag, propName, (result: T) => {
146
- if (typeof result === 'string' && result.substr(0, 6) === 'error:') {
147
- reject(result);
148
- } else {
149
- resolve(result);
152
+ return NativeReanimatedModule.getViewProp(
153
+ viewTag,
154
+ propName,
155
+ (result: T) => {
156
+ if (typeof result === 'string' && result.substr(0, 6) === 'error:') {
157
+ reject(result);
158
+ } else {
159
+ resolve(result);
160
+ }
150
161
  }
151
- });
162
+ );
152
163
  });
153
164
  }
154
165
 
155
166
  let _getTimestamp: () => number;
156
167
  if (nativeShouldBeMock()) {
157
168
  _getTimestamp = () => {
158
- return NativeReanimated.getTimestamp();
169
+ return (NativeReanimatedModule as JSReanimated).getTimestamp();
159
170
  };
160
171
  } else {
161
172
  _getTimestamp = () => {
@@ -173,14 +184,14 @@ if (nativeShouldBeMock()) {
173
184
  export function getTimestamp(): number {
174
185
  'worklet';
175
186
  if (Platform.OS === 'web') {
176
- return NativeReanimated.getTimestamp();
187
+ return (NativeReanimatedModule as JSReanimated).getTimestamp();
177
188
  }
178
189
  return _getTimestamp();
179
190
  }
180
191
 
181
- function workletValueSetter(
192
+ function workletValueSetter<T extends WorkletValue>(
182
193
  this: WorkletValueSetterContext,
183
- value: (() => AnimationObject) | AnimationObject | PrimitiveValue | Descriptor
194
+ value: T
184
195
  ): void {
185
196
  'worklet';
186
197
  const previousAnimation = this._animation;
@@ -195,7 +206,9 @@ function workletValueSetter(
195
206
  (value as AnimationObject).onFrame !== undefined)
196
207
  ) {
197
208
  const animation: AnimationObject =
198
- typeof value === 'function' ? value() : (value as AnimationObject);
209
+ typeof value === 'function'
210
+ ? (value as () => AnimationObject)()
211
+ : (value as AnimationObject);
199
212
  // prevent setting again to the same value
200
213
  // and triggering the mappers that treat this value as an input
201
214
  // this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)
@@ -239,15 +252,15 @@ function workletValueSetter(
239
252
  if (this._value === value) {
240
253
  return;
241
254
  }
242
- this._value = value as Descriptor | PrimitiveValue;
255
+ this._value = value as Descriptor | AnimatableValue;
243
256
  }
244
257
  }
245
258
 
246
259
  // We cannot use pushFrame
247
260
  // so we use own implementation for js
248
- function workletValueSetterJS(
261
+ function workletValueSetterJS<T extends WorkletValue>(
249
262
  this: WorkletValueSetterContext,
250
- value: (() => AnimationObject) | AnimationObject | PrimitiveValue | Descriptor
263
+ value: T
251
264
  ): void {
252
265
  const previousAnimation = this._animation;
253
266
  if (previousAnimation) {
@@ -262,7 +275,9 @@ function workletValueSetterJS(
262
275
  ) {
263
276
  // animated set
264
277
  const animation: AnimationObject =
265
- typeof value === 'function' ? value() : (value as AnimationObject);
278
+ typeof value === 'function'
279
+ ? (value as () => AnimationObject)()
280
+ : (value as AnimationObject);
266
281
  let initializeAnimation: ((timestamp: number) => void) | null = (
267
282
  timestamp: number
268
283
  ) => {
@@ -279,7 +294,7 @@ function workletValueSetterJS(
279
294
  }
280
295
  const finished = animation.onFrame(animation, timestamp);
281
296
  animation.timestamp = timestamp;
282
- this._setValue && this._setValue(animation.current as PrimitiveValue);
297
+ this._setValue && this._setValue(animation.current as AnimatableValue);
283
298
  if (finished) {
284
299
  animation.callback && animation.callback(true /* finished */);
285
300
  } else {
@@ -291,18 +306,18 @@ function workletValueSetterJS(
291
306
 
292
307
  requestFrame(step);
293
308
  } else {
294
- this._setValue && this._setValue(value as PrimitiveValue | Descriptor);
309
+ this._setValue && this._setValue(value as AnimatableValue | Descriptor);
295
310
  }
296
311
  }
297
312
 
298
313
  export function makeMutable<T>(value: T): SharedValue<T> {
299
314
  isConfiguredCheck();
300
- return NativeReanimated.makeMutable(value);
315
+ return NativeReanimatedModule.makeMutable(value);
301
316
  }
302
317
 
303
318
  export function makeRemote<T>(object = {}): T {
304
319
  isConfiguredCheck();
305
- return NativeReanimated.makeRemote(object);
320
+ return NativeReanimatedModule.makeRemote(object);
306
321
  }
307
322
 
308
323
  export function startMapper(
@@ -315,7 +330,7 @@ export function startMapper(
315
330
  viewDescriptors: Descriptor[] | SharedValue<Descriptor[]> = []
316
331
  ): number {
317
332
  isConfiguredCheck();
318
- return NativeReanimated.startMapper(
333
+ return NativeReanimatedModule.startMapper(
319
334
  mapper,
320
335
  inputs,
321
336
  outputs,
@@ -325,7 +340,7 @@ export function startMapper(
325
340
  }
326
341
 
327
342
  export function stopMapper(mapperId: number): void {
328
- NativeReanimated.stopMapper(mapperId);
343
+ NativeReanimatedModule.stopMapper(mapperId);
329
344
  }
330
345
 
331
346
  export interface RunOnJSFunction<A extends any[], R> {
@@ -349,9 +364,11 @@ export function runOnJS<A extends any[], R>(
349
364
  }
350
365
  }
351
366
 
352
- if (!NativeReanimated.useOnlyV1) {
353
- NativeReanimated.installCoreFunctions(
354
- NativeReanimated.native ? workletValueSetter : workletValueSetterJS
367
+ if (!NativeReanimatedModule.useOnlyV1) {
368
+ NativeReanimatedModule.installCoreFunctions(
369
+ NativeReanimatedModule.native
370
+ ? (workletValueSetter as <T>(value: T) => void)
371
+ : (workletValueSetterJS as <T>(value: T) => void)
355
372
  );
356
373
 
357
374
  const capturableConsole = console;
@@ -368,3 +385,32 @@ if (!NativeReanimated.useOnlyV1) {
368
385
  _setGlobalConsole(console);
369
386
  })();
370
387
  }
388
+
389
+ type FeaturesConfig = {
390
+ enableLayoutAnimations: boolean;
391
+ setByUser: boolean;
392
+ };
393
+
394
+ let featuresConfig: FeaturesConfig = {
395
+ enableLayoutAnimations: false,
396
+ setByUser: false,
397
+ };
398
+
399
+ export function enableLayoutAnimations(
400
+ flag: boolean,
401
+ isCallByUser = true
402
+ ): void {
403
+ if (isCallByUser) {
404
+ featuresConfig = {
405
+ enableLayoutAnimations: flag,
406
+ setByUser: true,
407
+ };
408
+ NativeReanimatedModule.enableLayoutAnimations(flag);
409
+ } else if (
410
+ !featuresConfig.setByUser &&
411
+ featuresConfig.enableLayoutAnimations !== flag
412
+ ) {
413
+ featuresConfig.enableLayoutAnimations = flag;
414
+ NativeReanimatedModule.enableLayoutAnimations(flag);
415
+ }
416
+ }
@@ -1,5 +1,7 @@
1
- import { WorkletFunction } from './commonTypes';
1
+ import { AnimatedStyle, StyleProps, WorkletFunction } from './commonTypes';
2
2
  import { ReanimatedConsole } from './core';
3
+ import { MeasuredDimensions } from './NativeMethods';
4
+ import { NativeReanimated } from './NativeReanimated/NativeReanimated';
3
5
  declare global {
4
6
  const _WORKLET: boolean;
5
7
  const _frameTimestamp: number;
@@ -11,12 +13,30 @@ declare global {
11
13
  tag: number,
12
14
  flag: { value: boolean; _value: boolean }
13
15
  ) => void;
16
+ const _setGestureState: (handlerTag: number, newState: number) => void;
17
+ const _updateProps: (
18
+ tag: number,
19
+ name: string,
20
+ updates: StyleProps | AnimatedStyle
21
+ ) => void;
22
+ const _measure: (viewTag: number) => MeasuredDimensions;
23
+ const _scrollTo: (
24
+ viewTag: number,
25
+ x: number,
26
+ y: number,
27
+ animated: boolean
28
+ ) => void;
14
29
  namespace NodeJS {
15
30
  interface Global {
16
31
  __reanimatedWorkletInit: (worklet: WorkletFunction) => void;
17
32
  _setGlobalConsole: (console?: ReanimatedConsole) => void;
18
33
  _log: (s: string) => void;
34
+ _setGestureState: () => void;
19
35
  _WORKLET: boolean;
36
+ __reanimatedModuleProxy: NativeReanimated;
37
+ _frameTimestamp: number | null;
38
+ _measure: () => MeasuredDimensions;
39
+ _scrollTo: () => void;
20
40
  LayoutAnimationRepository: {
21
41
  configs: Record<string, unknown>;
22
42
  registerConfig(tag: number, config: Record<string, unknown>): void;
@@ -46,7 +46,7 @@ export function useAnimatedGestureHandler<
46
46
  >(
47
47
  handlers: GestureHandlers<T, TContext>,
48
48
  dependencies?: DependencyList
49
- ): MutableRefObject<WorkletEventHandler | null> | ((e: T) => void) {
49
+ ): MutableRefObject<WorkletEventHandler<T> | null> | ((e: T) => void) {
50
50
  const { context, doDependenciesDiffer, useWeb } = useHandler<T, TContext>(
51
51
  handlers,
52
52
  dependencies
@@ -1,28 +1,26 @@
1
- import { Component, RefObject, useRef } from 'react';
1
+ import { Component, useRef } from 'react';
2
2
  import { getTag } from '../NativeMethods';
3
3
  import { useSharedValue } from './useSharedValue';
4
4
 
5
- interface RefObjectFunction<T> {
5
+ export interface RefObjectFunction<T> {
6
6
  current: T | null;
7
- (component: T): number;
7
+ (component?: T): number;
8
8
  }
9
9
 
10
- export function useAnimatedRef<T extends Component>(): RefObject<T> {
10
+ export function useAnimatedRef<T extends Component>(): RefObjectFunction<T> {
11
11
  const tag = useSharedValue<number | null>(-1);
12
- const ref = useRef<RefObject<T>>();
12
+ const ref = useRef<RefObjectFunction<T>>();
13
13
 
14
14
  if (!ref.current) {
15
- const fun: RefObjectFunction<T> = <RefObjectFunction<T>>(
16
- function (component) {
17
- 'worklet';
18
- // enters when ref is set by attaching to a component
19
- if (component) {
20
- tag.value = getTag(component);
21
- fun.current = component;
22
- }
23
- return tag.value;
15
+ const fun: RefObjectFunction<T> = <RefObjectFunction<T>>((component) => {
16
+ 'worklet';
17
+ // enters when ref is set by attaching to a component
18
+ if (component) {
19
+ tag.value = getTag(component);
20
+ fun.current = component;
24
21
  }
25
- );
22
+ return tag.value;
23
+ });
26
24
 
27
25
  Object.defineProperty(fun, 'current', {
28
26
  value: null,
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from 'react';
2
2
  import { NativeScrollEvent } from 'react-native';
3
- import { WorkletFunction } from '../commonTypes';
3
+ import { NativeEvent, WorkletFunction } from '../commonTypes';
4
4
  import WorkletEventHandler from '../WorkletEventHandler';
5
5
  import { Context, DependencyList } from './commonTypes';
6
6
  import { useEvent, useHandler } from './Hooks';
@@ -10,7 +10,7 @@ export interface ScrollHandler<TContext extends Context>
10
10
  (event: NativeScrollEvent, context?: TContext): void;
11
11
  }
12
12
 
13
- interface ScrollEvent extends NativeScrollEvent {
13
+ interface ScrollEvent extends NativeScrollEvent, NativeEvent<ScrollEvent> {
14
14
  eventName: string;
15
15
  }
16
16
  export interface ScrollHandlers<TContext extends Context> {
@@ -25,7 +25,7 @@ export interface ScrollHandlers<TContext extends Context> {
25
25
  export function useAnimatedScrollHandler<TContext extends Context>(
26
26
  handlers: ScrollHandlers<TContext> | ScrollHandler<TContext>,
27
27
  dependencies?: DependencyList
28
- ): RefObject<WorkletEventHandler> {
28
+ ): RefObject<WorkletEventHandler<ScrollEvent>> {
29
29
  // case when handlers is a function
30
30
  const scrollHandlers: ScrollHandlers<TContext> =
31
31
  typeof handlers === 'function' ? { onScroll: handlers } : handlers;