react-native-reanimated 2.5.0 → 2.8.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 (221) hide show
  1. package/Common/cpp/SharedItems/ShareableValue.cpp +2 -2
  2. package/Common/cpp/Tools/RuntimeDecorator.cpp +0 -14
  3. package/RNReanimated.podspec +15 -6
  4. package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  5. package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
  6. package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
  7. package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
  8. package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
  10. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  11. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  12. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  13. package/android/.gradle/checksums/checksums.lock +0 -0
  14. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  15. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  16. package/android/build.gradle +13 -23
  17. package/android/react-native-reanimated-64-hermes.aar +0 -0
  18. package/android/react-native-reanimated-64-jsc.aar +0 -0
  19. package/android/react-native-reanimated-65-hermes.aar +0 -0
  20. package/android/react-native-reanimated-65-jsc.aar +0 -0
  21. package/android/react-native-reanimated-66-hermes.aar +0 -0
  22. package/android/react-native-reanimated-66-jsc.aar +0 -0
  23. package/android/react-native-reanimated-67-hermes.aar +0 -0
  24. package/android/react-native-reanimated-67-jsc.aar +0 -0
  25. package/android/react-native-reanimated-68-hermes.aar +0 -0
  26. package/android/react-native-reanimated-68-jsc.aar +0 -0
  27. package/android/src/main/cpp/NativeProxy.cpp +22 -12
  28. package/android/src/main/cpp/headers/NativeProxy.h +2 -0
  29. package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +11 -8
  30. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +13 -6
  31. package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
  32. package/ios/LayoutReanimation/REAAnimationsManager.m +2 -2
  33. package/ios/LayoutReanimation/REASnapshot.m +1 -1
  34. package/ios/LayoutReanimation/REAUIManager.h +1 -1
  35. package/ios/LayoutReanimation/REAUIManager.mm +4 -5
  36. package/ios/Nodes/REAAlwaysNode.h +1 -1
  37. package/ios/Nodes/REAAlwaysNode.m +5 -5
  38. package/ios/Nodes/REABezierNode.h +1 -1
  39. package/ios/Nodes/REABezierNode.m +4 -5
  40. package/ios/Nodes/REABlockNode.h +1 -1
  41. package/ios/Nodes/REABlockNode.m +2 -2
  42. package/ios/Nodes/REACallFuncNode.h +1 -1
  43. package/ios/Nodes/REACallFuncNode.m +5 -5
  44. package/ios/Nodes/REAClockNodes.h +1 -1
  45. package/ios/Nodes/REAClockNodes.m +4 -4
  46. package/ios/Nodes/REAConcatNode.h +1 -1
  47. package/ios/Nodes/REAConcatNode.m +3 -3
  48. package/ios/Nodes/REACondNode.h +1 -1
  49. package/ios/Nodes/REACondNode.m +3 -3
  50. package/ios/Nodes/READebugNode.h +1 -1
  51. package/ios/Nodes/READebugNode.m +3 -3
  52. package/ios/Nodes/REAEventNode.h +1 -2
  53. package/ios/Nodes/REAEventNode.m +3 -3
  54. package/ios/Nodes/REAFunctionNode.h +1 -1
  55. package/ios/Nodes/REAFunctionNode.m +3 -3
  56. package/ios/Nodes/REAJSCallNode.h +1 -1
  57. package/ios/Nodes/REAJSCallNode.m +3 -3
  58. package/ios/Nodes/REANode.m +2 -2
  59. package/ios/Nodes/REAOperatorNode.h +1 -1
  60. package/ios/Nodes/REAOperatorNode.m +2 -3
  61. package/ios/Nodes/REAParamNode.h +1 -1
  62. package/ios/Nodes/REAParamNode.m +4 -4
  63. package/ios/Nodes/REAPropsNode.h +1 -1
  64. package/ios/Nodes/REAPropsNode.m +4 -6
  65. package/ios/Nodes/REASetNode.h +1 -1
  66. package/ios/Nodes/REASetNode.m +4 -4
  67. package/ios/Nodes/REAStyleNode.h +1 -1
  68. package/ios/Nodes/REAStyleNode.m +2 -3
  69. package/ios/Nodes/REATransformNode.h +1 -1
  70. package/ios/Nodes/REATransformNode.m +2 -2
  71. package/ios/Nodes/REAValueNode.h +1 -3
  72. package/ios/Nodes/REAValueNode.m +1 -1
  73. package/ios/REAEventDispatcher.m +1 -1
  74. package/ios/REAModule.h +1 -1
  75. package/ios/REAModule.m +4 -5
  76. package/ios/REANodesManager.h +1 -2
  77. package/ios/REANodesManager.m +22 -24
  78. package/ios/Transitioning/RCTConvert+REATransition.h +1 -2
  79. package/ios/Transitioning/RCTConvert+REATransition.m +1 -1
  80. package/ios/Transitioning/REAAllTransitions.h +1 -1
  81. package/ios/Transitioning/REAAllTransitions.m +2 -3
  82. package/ios/Transitioning/REATransition.h +2 -3
  83. package/ios/Transitioning/REATransition.m +3 -4
  84. package/ios/Transitioning/REATransitionAnimation.m +1 -2
  85. package/ios/Transitioning/REATransitionManager.m +2 -4
  86. package/ios/Transitioning/REATransitionValues.m +2 -3
  87. package/ios/native/NativeMethods.h +1 -3
  88. package/ios/native/NativeMethods.mm +1 -1
  89. package/ios/native/NativeProxy.h +2 -2
  90. package/ios/native/NativeProxy.mm +20 -17
  91. package/ios/native/REAIOSErrorHandler.h +2 -4
  92. package/ios/native/REAIOSErrorHandler.mm +1 -1
  93. package/ios/native/REAIOSLogger.h +1 -3
  94. package/ios/native/REAIOSLogger.mm +1 -1
  95. package/ios/native/REAIOSScheduler.h +1 -3
  96. package/ios/native/REAIOSScheduler.mm +2 -2
  97. package/ios/native/REAInitializer.h +0 -7
  98. package/ios/native/REAInitializer.mm +2 -2
  99. package/ios/native/UIResponder+Reanimated.mm +3 -3
  100. package/ios/sensor/ReanimatedSensor.h +5 -1
  101. package/ios/sensor/ReanimatedSensor.m +49 -1
  102. package/ios/sensor/ReanimatedSensorContainer.h +1 -2
  103. package/ios/sensor/ReanimatedSensorContainer.m +2 -3
  104. package/lib/Animated.js +0 -9
  105. package/lib/ConfigHelper.js +0 -1
  106. package/lib/index.js +0 -9
  107. package/lib/reanimated2/Easing.js +9 -3
  108. package/lib/reanimated2/core.js +0 -36
  109. package/lib/reanimated2/globals.d.ts +1 -2
  110. package/lib/reanimated2/interpolateColor.js +11 -11
  111. package/lib/reanimated2/js-reanimated/index.js +3 -3
  112. package/lib/types/lib/ConfigHelper.d.ts +12 -0
  113. package/lib/types/lib/ReanimatedEventEmitter.d.ts +3 -0
  114. package/lib/types/lib/ReanimatedModule.d.ts +2 -0
  115. package/lib/types/lib/ReanimatedModule.macos.d.ts +2 -0
  116. package/lib/types/lib/ReanimatedModule.native.d.ts +2 -0
  117. package/lib/types/lib/ReanimatedModule.windows.d.ts +2 -0
  118. package/lib/types/lib/ReanimatedModuleCompat.d.ts +14 -0
  119. package/lib/types/lib/createAnimatedComponent.d.ts +33 -0
  120. package/lib/types/lib/reanimated2/Bezier.d.ts +6 -0
  121. package/lib/types/lib/reanimated2/Colors.d.ts +31 -0
  122. package/lib/types/lib/reanimated2/Easing.d.ts +172 -0
  123. package/lib/types/lib/reanimated2/NativeMethods.d.ts +14 -0
  124. package/lib/types/lib/reanimated2/NativeReanimated/NativeReanimated.d.ts +20 -0
  125. package/lib/types/lib/reanimated2/NativeReanimated/index.d.ts +3 -0
  126. package/lib/types/lib/reanimated2/PlatformChecker.d.ts +5 -0
  127. package/lib/types/lib/reanimated2/PropAdapters.d.ts +4 -0
  128. package/lib/types/lib/reanimated2/UpdateProps.d.ts +9 -0
  129. package/lib/types/lib/reanimated2/ViewDescriptorsSet.d.ts +20 -0
  130. package/lib/types/lib/reanimated2/WorkletEventHandler.d.ts +13 -0
  131. package/lib/types/lib/reanimated2/__mocks__/MutableValue.d.ts +5 -0
  132. package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.d.ts +13 -0
  133. package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.native.d.ts +13 -0
  134. package/lib/types/lib/reanimated2/animation/commonTypes.d.ts +27 -0
  135. package/lib/types/lib/reanimated2/animation/decay.d.ts +19 -0
  136. package/lib/types/lib/reanimated2/animation/delay.d.ts +7 -0
  137. package/lib/types/lib/reanimated2/animation/index.d.ts +9 -0
  138. package/lib/types/lib/reanimated2/animation/repeat.d.ts +12 -0
  139. package/lib/types/lib/reanimated2/animation/sequence.d.ts +7 -0
  140. package/lib/types/lib/reanimated2/animation/spring.d.ts +22 -0
  141. package/lib/types/lib/reanimated2/animation/styleAnimation.d.ts +7 -0
  142. package/lib/types/lib/reanimated2/animation/timing.d.ts +21 -0
  143. package/lib/types/lib/reanimated2/animation/util.d.ts +9 -0
  144. package/lib/types/lib/reanimated2/commonTypes.d.ts +79 -0
  145. package/lib/types/lib/reanimated2/component/FlatList.d.ts +9 -0
  146. package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +8 -0
  147. package/lib/types/lib/reanimated2/component/index.d.ts +9 -0
  148. package/lib/types/lib/reanimated2/core.d.ts +24 -0
  149. package/lib/types/lib/reanimated2/hook/Hooks.d.ts +5 -0
  150. package/lib/types/lib/reanimated2/hook/commonTypes.d.ts +14 -0
  151. package/lib/types/lib/reanimated2/hook/index.d.ts +10 -0
  152. package/lib/types/lib/reanimated2/hook/useAnimatedGestureHandler.d.ts +35 -0
  153. package/lib/types/lib/reanimated2/hook/useAnimatedReaction.d.ts +12 -0
  154. package/lib/types/lib/reanimated2/hook/useAnimatedRef.d.ts +3 -0
  155. package/lib/types/lib/reanimated2/hook/useAnimatedScrollHandler.d.ts +21 -0
  156. package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +18 -0
  157. package/lib/types/lib/reanimated2/hook/useAnimatedStyle.d.ts +11 -0
  158. package/lib/types/lib/reanimated2/hook/useDerivedValue.d.ts +4 -0
  159. package/lib/types/lib/reanimated2/hook/useSharedValue.d.ts +2 -0
  160. package/lib/types/lib/reanimated2/hook/utils.d.ts +28 -0
  161. package/lib/types/lib/reanimated2/index.d.ts +12 -0
  162. package/lib/types/lib/reanimated2/interpolateColor.d.ts +26 -0
  163. package/lib/types/lib/reanimated2/interpolation.d.ts +14 -0
  164. package/lib/types/lib/reanimated2/jestUtils.d.ts +12 -0
  165. package/lib/types/lib/reanimated2/js-reanimated/JSReanimated.d.ts +30 -0
  166. package/lib/types/lib/reanimated2/js-reanimated/Mapper.d.ts +14 -0
  167. package/lib/types/lib/reanimated2/js-reanimated/MapperRegistry.d.ts +14 -0
  168. package/lib/types/lib/reanimated2/js-reanimated/MutableValue.d.ts +14 -0
  169. package/lib/types/lib/reanimated2/js-reanimated/commonTypes.d.ts +44 -0
  170. package/lib/types/lib/reanimated2/js-reanimated/index.d.ts +15 -0
  171. package/lib/types/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +1 -0
  172. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +22 -0
  173. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +38 -0
  174. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +25 -0
  175. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +77 -0
  176. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/index.d.ts +4 -0
  177. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +62 -0
  178. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +4 -0
  179. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +42 -0
  180. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +50 -0
  181. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +18 -0
  182. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +10 -0
  183. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +18 -0
  184. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +34 -0
  185. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +34 -0
  186. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +18 -0
  187. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +66 -0
  188. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +10 -0
  189. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +19 -0
  190. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +13 -0
  191. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +6 -0
  192. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +6 -0
  193. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +7 -0
  194. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +9 -0
  195. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +6 -0
  196. package/lib/types/lib/reanimated2/layoutReanimation/index.d.ts +4 -0
  197. package/lib/types/lib/reanimated2/mock.d.ts +55 -0
  198. package/lib/types/lib/reanimated2/platform-specific/RNRenderer.d.ts +1 -0
  199. package/lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
  200. package/lib/types/lib/reanimated2/utils.d.ts +7 -0
  201. package/lib/types/lib/setAndForwardRef.d.ts +40 -0
  202. package/lib/types/react-native-reanimated-tests.d.ts +1 -0
  203. package/package.json +7 -9
  204. package/plugin.js +26 -32
  205. package/react-native-reanimated.d.ts +39 -30
  206. package/src/Animated.js +0 -9
  207. package/src/ConfigHelper.ts +0 -1
  208. package/src/createAnimatedComponent.tsx +1 -1
  209. package/src/reanimated2/Easing.ts +9 -3
  210. package/src/reanimated2/commonTypes.ts +0 -1
  211. package/src/reanimated2/component/FlatList.tsx +1 -1
  212. package/src/reanimated2/core.ts +0 -47
  213. package/src/reanimated2/globals.d.ts +1 -2
  214. package/src/reanimated2/hook/useAnimatedSensor.ts +1 -3
  215. package/src/reanimated2/interpolateColor.ts +11 -11
  216. package/src/reanimated2/jestUtils.ts +11 -0
  217. package/src/reanimated2/js-reanimated/index.ts +3 -3
  218. package/android/expo/linking.gradle +0 -46
  219. package/android/expo/src/main/java/com/swmansion/reanimated/EXReanimatedAdapter.java +0 -12
  220. package/android/expo/src/main/java/expo/modules/adapters/reanimated/EXReanimatedPackage.java +0 -26
  221. package/expo-module.config.json +0 -3
@@ -53,7 +53,10 @@ function cubic(t) {
53
53
  */
54
54
  function poly(n) {
55
55
  'worklet';
56
- return (t) => Math.pow(t, n);
56
+ return (t) => {
57
+ 'worklet';
58
+ return Math.pow(t, n);
59
+ };
57
60
  }
58
61
  /**
59
62
  * A sinusoidal function.
@@ -110,7 +113,10 @@ function elastic(bounciness = 1) {
110
113
  */
111
114
  function back(s = 1.70158) {
112
115
  'worklet';
113
- return (t) => t * t * ((s + 1) * t - s);
116
+ return (t) => {
117
+ 'worklet';
118
+ return t * t * ((s + 1) * t - s);
119
+ };
114
120
  }
115
121
  /**
116
122
  * Provides a simple bouncing effect.
@@ -224,7 +230,7 @@ function createChecker(worklet, workletName, prevArgs) {
224
230
  }
225
231
  // @ts-ignore this is implicitly any - TODO
226
232
  const res = worklet.apply(this, arguments);
227
- if (!_WORKLET && res && typeof res === 'function' && res.__worklet) {
233
+ if (!_WORKLET && res && typeof res === 'function' && res.__workletHash) {
228
234
  return createChecker(res, workletName, arguments);
229
235
  }
230
236
  return res;
@@ -2,9 +2,6 @@
2
2
  import NativeReanimatedModule from './NativeReanimated';
3
3
  import { Platform } from 'react-native';
4
4
  import { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';
5
- global.__reanimatedWorkletInit = function (worklet) {
6
- worklet.__worklet = true;
7
- };
8
5
  if (global._setGlobalConsole === undefined) {
9
6
  // it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1
10
7
  global._setGlobalConsole = () => {
@@ -31,39 +28,6 @@ export const isConfiguredCheck = () => {
31
28
  throw new Error('If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation');
32
29
  }
33
30
  };
34
- function _toArrayReanimated(object) {
35
- 'worklet';
36
- if (Array.isArray(object)) {
37
- return object;
38
- }
39
- if (typeof Symbol !== 'undefined' &&
40
- (typeof Symbol === 'function' ? Symbol.iterator : '@@iterator') in
41
- Object(object)) {
42
- return Array.from(object);
43
- }
44
- throw new Error('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
45
- }
46
- function _mergeObjectsReanimated() {
47
- 'worklet';
48
- // we can't use rest parameters in worklets at the moment
49
- // eslint-disable-next-line prefer-rest-params
50
- const arr = Array.from(arguments);
51
- return Object.assign.apply(null, [arr[0], ...arr.slice(1)]);
52
- }
53
- global.__reanimatedWorkletInit = function (worklet) {
54
- worklet.__worklet = true;
55
- if (worklet._closure) {
56
- const closure = worklet._closure;
57
- Object.keys(closure).forEach((key) => {
58
- if (key === '_toConsumableArray') {
59
- closure[key] = _toArrayReanimated;
60
- }
61
- if (key === '_objectSpread') {
62
- closure[key] = _mergeObjectsReanimated;
63
- }
64
- });
65
- }
66
- };
67
31
  function pushFrame(frame) {
68
32
  NativeReanimatedModule.pushFrame(frame);
69
33
  }
@@ -1,4 +1,4 @@
1
- import { AnimatedStyle, StyleProps, WorkletFunction } from './commonTypes';
1
+ import { AnimatedStyle, StyleProps } from './commonTypes';
2
2
  import { ReanimatedConsole } from './core';
3
3
  import { MeasuredDimensions } from './NativeMethods';
4
4
  import { NativeReanimated } from './NativeReanimated/NativeReanimated';
@@ -32,7 +32,6 @@ declare global {
32
32
  };
33
33
  namespace NodeJS {
34
34
  interface Global {
35
- __reanimatedWorkletInit: (worklet: WorkletFunction) => void;
36
35
  _setGlobalConsole: (console?: ReanimatedConsole) => void;
37
36
  _log: (s: string) => void;
38
37
  _setGestureState: () => void;
@@ -27,13 +27,13 @@ const getInterpolateRGB = (colors) => {
27
27
  const a = [];
28
28
  for (let i = 0; i < colors.length; ++i) {
29
29
  const color = colors[i];
30
- const proocessedColor = processColor(color);
30
+ const processedColor = processColor(color);
31
31
  // explicit check in case if processedColor is 0
32
- if (proocessedColor !== null && proocessedColor !== undefined) {
33
- r.push(red(proocessedColor));
34
- g.push(green(proocessedColor));
35
- b.push(blue(proocessedColor));
36
- a.push(opacity(proocessedColor));
32
+ if (processedColor !== null && processedColor !== undefined) {
33
+ r.push(red(processedColor));
34
+ g.push(green(processedColor));
35
+ b.push(blue(processedColor));
36
+ a.push(opacity(processedColor));
37
37
  }
38
38
  }
39
39
  return { r, g, b, a };
@@ -45,11 +45,11 @@ const getInterpolateHSV = (colors) => {
45
45
  const v = [];
46
46
  for (let i = 0; i < colors.length; ++i) {
47
47
  const color = colors[i];
48
- const proocessedColor = RGBtoHSV(processColor(color));
49
- if (proocessedColor) {
50
- h.push(proocessedColor.h);
51
- s.push(proocessedColor.s);
52
- v.push(proocessedColor.v);
48
+ const processedColor = RGBtoHSV(processColor(color));
49
+ if (processedColor) {
50
+ h.push(processedColor.h);
51
+ s.push(processedColor.s);
52
+ v.push(processedColor.v);
53
53
  }
54
54
  }
55
55
  return { h, s, v };
@@ -7,7 +7,7 @@ if (shouldBeUseWeb()) {
7
7
  // noop
8
8
  };
9
9
  global._measure = () => {
10
- console.warn("[Reanimated] You can't use 'measue' method with Chrome Debugger or with web version");
10
+ console.warn("[Reanimated] You can't use `measure` with Chrome Debugger or with web version");
11
11
  return {
12
12
  x: 0,
13
13
  y: 0,
@@ -18,10 +18,10 @@ if (shouldBeUseWeb()) {
18
18
  };
19
19
  };
20
20
  global._scrollTo = () => {
21
- console.warn("[Reanimated] You can't use 'scrollTo' method with Chrome Debugger or with web version");
21
+ console.warn("[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version");
22
22
  };
23
23
  global._setGestureState = () => {
24
- console.warn("[Reanimated] You can't use 'setGestureState' method with Chrome Debugger or with web version");
24
+ console.warn("[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version");
25
25
  };
26
26
  }
27
27
  export const _updatePropsJS = (updates, viewRef) => {
@@ -0,0 +1,12 @@
1
+ export declare function addWhitelistedNativeProps(props: Record<string, boolean>): void;
2
+ export declare function addWhitelistedUIProps(props: Record<string, boolean>): void;
3
+ interface ViewConfig {
4
+ uiViewClassName: string;
5
+ validAttributes: Record<string, unknown>;
6
+ }
7
+ /**
8
+ * updates UI props whitelist for given view host instance
9
+ * this will work just once for every view name
10
+ */
11
+ export declare function adaptViewConfig(viewConfig: ViewConfig): void;
12
+ export {};
@@ -0,0 +1,3 @@
1
+ import { NativeEventEmitter } from 'react-native';
2
+ declare const _default: NativeEventEmitter;
3
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import ReanimatedModuleCompat from './ReanimatedModuleCompat';
2
+ export default ReanimatedModuleCompat;
@@ -0,0 +1,2 @@
1
+ import ReanimatedModuleCompat from './ReanimatedModuleCompat';
2
+ export default ReanimatedModuleCompat;
@@ -0,0 +1,2 @@
1
+ declare let exportedModule: any;
2
+ export default exportedModule;
@@ -0,0 +1,2 @@
1
+ import ReanimatedModuleCompat from './ReanimatedModuleCompat';
2
+ export default ReanimatedModuleCompat;
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ disconnectNodeFromView(): Promise<void>;
3
+ attachEvent(_viewTag: number, _eventName: string, _nodeID: number): Promise<void>;
4
+ detachEvent(_viewTag: number, _eventName: string, _nodeID: number): Promise<void>;
5
+ createNode(_nodeID: number, _config: Record<string, unknown>): Promise<void>;
6
+ dropNode(_nodeID: number): Promise<void>;
7
+ configureProps(_nativeProps: string[], _uiProps: string[]): Promise<void>;
8
+ disconnectNodes(): Promise<void>;
9
+ addListener(): Promise<void>;
10
+ removeListeners(): Promise<void>;
11
+ removeAllListeners(): Promise<void>;
12
+ animateNextTransition(): Promise<void>;
13
+ };
14
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import { Component, ComponentType, Ref } from 'react';
2
+ import './reanimated2/layoutReanimation/LayoutAnimationRepository';
3
+ import { BaseAnimationBuilder, EntryExitAnimationFunction, ILayoutAnimationBuilder } from './reanimated2/layoutReanimation';
4
+ import { SharedValue, StyleProps } from './reanimated2/commonTypes';
5
+ import { ViewDescriptorsSet, ViewRefSet } from './reanimated2/ViewDescriptorsSet';
6
+ declare type NestedArray<T> = T | NestedArray<T>[];
7
+ interface AnimatedProps extends Record<string, unknown> {
8
+ viewDescriptors?: ViewDescriptorsSet;
9
+ viewsRef?: ViewRefSet<unknown>;
10
+ initial?: SharedValue<StyleProps>;
11
+ }
12
+ export declare type AnimatedComponentProps<P extends Record<string, unknown>> = P & {
13
+ forwardedRef?: Ref<Component>;
14
+ style?: NestedArray<StyleProps>;
15
+ animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;
16
+ animatedStyle?: StyleProps;
17
+ layout?: BaseAnimationBuilder | ILayoutAnimationBuilder | typeof BaseAnimationBuilder;
18
+ entering?: BaseAnimationBuilder | typeof BaseAnimationBuilder | EntryExitAnimationFunction | Keyframe;
19
+ exiting?: BaseAnimationBuilder | typeof BaseAnimationBuilder | EntryExitAnimationFunction | Keyframe;
20
+ };
21
+ declare type Options<P> = {
22
+ setNativeProps: (ref: ComponentRef, props: P) => void;
23
+ };
24
+ interface ComponentRef extends Component {
25
+ setNativeProps?: (props: Record<string, unknown>) => void;
26
+ getScrollableNode?: () => ComponentRef;
27
+ }
28
+ export interface InitialComponentProps extends Record<string, unknown> {
29
+ ref?: Ref<Component>;
30
+ collapsable?: boolean;
31
+ }
32
+ export default function createAnimatedComponent(Component: ComponentType<InitialComponentProps>, options?: Options<InitialComponentProps>): ComponentType<AnimatedComponentProps<InitialComponentProps>>;
33
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * https://github.com/gre/bezier-easing
3
+ * BezierEasing - use bezier curve for transition easing function
4
+ * by Gaëtan Renaudeau 2014 - 2015 – MIT License
5
+ */
6
+ export declare function Bezier(mX1: number, mY1: number, mX2: number, mY2: number): (x: number) => number;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copied from:
3
+ * react-native/Libraries/StyleSheet/normalizeColor.js
4
+ * react-native/Libraries/StyleSheet/processColor.js
5
+ * https://github.com/wcandillon/react-native-redash/blob/master/src/Colors.ts
6
+ */
7
+ interface RGB {
8
+ r: number;
9
+ g: number;
10
+ b: number;
11
+ }
12
+ interface HSV {
13
+ h: number;
14
+ s: number;
15
+ v: number;
16
+ }
17
+ export declare const opacity: (c: number) => number;
18
+ export declare const red: (c: number) => number;
19
+ export declare const green: (c: number) => number;
20
+ export declare const blue: (c: number) => number;
21
+ export declare const rgbaColor: (r: number, g: number, b: number, alpha?: number) => number | string;
22
+ export declare function RGBtoHSV(rgb: RGB): HSV;
23
+ export declare function RGBtoHSV(r: number, g: number, b: number): HSV;
24
+ export declare const hsvToColor: (h: number, s: number, v: number) => number | string;
25
+ export declare function processColorInitially(color: unknown): number | null | undefined;
26
+ export declare function isColor(value: unknown): boolean;
27
+ export declare function processColor(color: unknown): number | null | undefined;
28
+ export declare type ParsedColorArray = [number, number, number, number];
29
+ export declare function convertToHSVA(color: unknown): ParsedColorArray;
30
+ export declare function toRGBA(HSVA: ParsedColorArray): string;
31
+ export {};
@@ -0,0 +1,172 @@
1
+ /**
2
+ * The `Easing` module implements common easing functions. This module is used
3
+ * by [Animate.timing()](docs/animate.html#timing) to convey physically
4
+ * believable motion in animations.
5
+ *
6
+ * You can find a visualization of some common easing functions at
7
+ * http://easings.net/
8
+ *
9
+ * ### Predefined animations
10
+ *
11
+ * The `Easing` module provides several predefined animations through the
12
+ * following methods:
13
+ *
14
+ * - [`back`](docs/easing.html#back) provides a simple animation where the
15
+ * object goes slightly back before moving forward
16
+ * - [`bounce`](docs/easing.html#bounce) provides a bouncing animation
17
+ * - [`ease`](docs/easing.html#ease) provides a simple inertial animation
18
+ * - [`elastic`](docs/easing.html#elastic) provides a simple spring interaction
19
+ *
20
+ * ### Standard functions
21
+ *
22
+ * Three standard easing functions are provided:
23
+ *
24
+ * - [`linear`](docs/easing.html#linear)
25
+ * - [`quad`](docs/easing.html#quad)
26
+ * - [`cubic`](docs/easing.html#cubic)
27
+ *
28
+ * The [`poly`](docs/easing.html#poly) function can be used to implement
29
+ * quartic, quintic, and other higher power functions.
30
+ *
31
+ * ### Additional functions
32
+ *
33
+ * Additional mathematical functions are provided by the following methods:
34
+ *
35
+ * - [`bezier`](docs/easing.html#bezier) provides a cubic bezier curve
36
+ * - [`circle`](docs/easing.html#circle) provides a circular function
37
+ * - [`sin`](docs/easing.html#sin) provides a sinusoidal function
38
+ * - [`exp`](docs/easing.html#exp) provides an exponential function
39
+ *
40
+ * The following helpers are used to modify other easing functions.
41
+ *
42
+ * - [`in`](docs/easing.html#in) runs an easing function forwards
43
+ * - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical
44
+ * - [`out`](docs/easing.html#out) runs an easing function backwards
45
+ */
46
+ export declare type EasingFn = (t: number) => number;
47
+ export declare type EasingFactoryFn = {
48
+ factory: () => EasingFn;
49
+ };
50
+ /**
51
+ * A linear function, `f(t) = t`. Position correlates to elapsed time one to
52
+ * one.
53
+ *
54
+ * http://cubic-bezier.com/#0,0,1,1
55
+ */
56
+ declare function linear(t: number): number;
57
+ /**
58
+ * A simple inertial interaction, similar to an object slowly accelerating to
59
+ * speed.
60
+ *
61
+ * http://cubic-bezier.com/#.42,0,1,1
62
+ */
63
+ declare function ease(t: number): number;
64
+ /**
65
+ * A quadratic function, `f(t) = t * t`. Position equals the square of elapsed
66
+ * time.
67
+ *
68
+ * http://easings.net/#easeInQuad
69
+ */
70
+ declare function quad(t: number): number;
71
+ /**
72
+ * A cubic function, `f(t) = t * t * t`. Position equals the cube of elapsed
73
+ * time.
74
+ *
75
+ * http://easings.net/#easeInCubic
76
+ */
77
+ declare function cubic(t: number): number;
78
+ /**
79
+ * A power function. Position is equal to the Nth power of elapsed time.
80
+ *
81
+ * n = 4: http://easings.net/#easeInQuart
82
+ * n = 5: http://easings.net/#easeInQuint
83
+ */
84
+ declare function poly(n: number): EasingFn;
85
+ /**
86
+ * A sinusoidal function.
87
+ *
88
+ * http://easings.net/#easeInSine
89
+ */
90
+ declare function sin(t: number): number;
91
+ /**
92
+ * A circular function.
93
+ *
94
+ * http://easings.net/#easeInCirc
95
+ */
96
+ declare function circle(t: number): number;
97
+ /**
98
+ * An exponential function.
99
+ *
100
+ * http://easings.net/#easeInExpo
101
+ */
102
+ declare function exp(t: number): number;
103
+ /**
104
+ * A simple elastic interaction, similar to a spring oscillating back and
105
+ * forth.
106
+ *
107
+ * Default bounciness is 1, which overshoots a little bit once. 0 bounciness
108
+ * doesn't overshoot at all, and bounciness of N > 1 will overshoot about N
109
+ * times.
110
+ *
111
+ * http://easings.net/#easeInElastic
112
+ */
113
+ declare function elastic(bounciness?: number): EasingFn;
114
+ /**
115
+ * Use with `Animated.parallel()` to create a simple effect where the object
116
+ * animates back slightly as the animation starts.
117
+ *
118
+ * Wolfram Plot:
119
+ *
120
+ * - http://tiny.cc/back_default (s = 1.70158, default)
121
+ */
122
+ declare function back(s?: number): (t: number) => number;
123
+ /**
124
+ * Provides a simple bouncing effect.
125
+ *
126
+ * http://easings.net/#easeInBounce
127
+ */
128
+ declare function bounce(t: number): number;
129
+ /**
130
+ * Provides a cubic bezier curve, equivalent to CSS Transitions'
131
+ * `transition-timing-function`.
132
+ *
133
+ * A useful tool to visualize cubic bezier curves can be found at
134
+ * http://cubic-bezier.com/
135
+ */
136
+ declare function bezier(x1: number, y1: number, x2: number, y2: number): {
137
+ factory: () => (x: number) => number;
138
+ };
139
+ declare function bezierFn(x1: number, y1: number, x2: number, y2: number): (x: number) => number;
140
+ /**
141
+ * Runs an easing function forwards.
142
+ */
143
+ declare function in_(easing: EasingFn): EasingFn;
144
+ /**
145
+ * Runs an easing function backwards.
146
+ */
147
+ declare function out(easing: EasingFn): EasingFn;
148
+ /**
149
+ * Makes any easing function symmetrical. The easing function will run
150
+ * forwards for half of the duration, then backwards for the rest of the
151
+ * duration.
152
+ */
153
+ declare function inOut(easing: EasingFn): EasingFn;
154
+ export declare const Easing: {
155
+ linear: typeof linear;
156
+ ease: typeof ease;
157
+ quad: typeof quad;
158
+ cubic: typeof cubic;
159
+ poly: typeof poly;
160
+ sin: typeof sin;
161
+ circle: typeof circle;
162
+ exp: typeof exp;
163
+ elastic: typeof elastic;
164
+ back: typeof back;
165
+ bounce: typeof bounce;
166
+ bezier: typeof bezier;
167
+ bezierFn: typeof bezierFn;
168
+ in: typeof in_;
169
+ out: typeof out;
170
+ inOut: typeof inOut;
171
+ };
172
+ export {};
@@ -0,0 +1,14 @@
1
+ import { Component } from 'react';
2
+ import { RefObjectFunction } from './commonTypes';
3
+ export declare function getTag(view: null | number | React.Component<any, any> | React.ComponentClass<any>): null | number;
4
+ export interface MeasuredDimensions {
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ pageX: number;
10
+ pageY: number;
11
+ }
12
+ export declare function measure(animatedRef: RefObjectFunction<Component>): MeasuredDimensions;
13
+ export declare function scrollTo(animatedRef: RefObjectFunction<Component>, x: number, y: number, animated: boolean): void;
14
+ export declare function setGestureState(handlerTag: number, newState: number): void;
@@ -0,0 +1,20 @@
1
+ import { SharedValue, SensorValue3D, SensorValueRotation } from '../commonTypes';
2
+ import { Descriptor } from '../hook/commonTypes';
3
+ export declare class NativeReanimated {
4
+ native: boolean;
5
+ private InnerNativeModule;
6
+ constructor(native?: boolean);
7
+ installCoreFunctions(valueSetter: <T>(value: T) => void): void;
8
+ makeShareable<T>(value: T): T;
9
+ makeMutable<T>(value: T): SharedValue<T>;
10
+ makeRemote<T>(object?: {}): T;
11
+ registerSensor(sensorType: number, interval: number, sensorData: SensorValue3D | SensorValueRotation): any;
12
+ unregisterSensor(sensorId: number): any;
13
+ startMapper(mapper: () => void, inputs: any[] | undefined, outputs: any[] | undefined, updater: () => void, viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>): number;
14
+ stopMapper(mapperId: number): void;
15
+ registerEventHandler<T>(eventHash: string, eventHandler: (event: T) => void): string;
16
+ unregisterEventHandler(id: string): void;
17
+ getViewProp<T>(viewTag: string, propName: string, callback?: (result: T) => void): Promise<T>;
18
+ enableLayoutAnimations(flag: boolean): void;
19
+ configureProps(uiProps: string[], nativeProps: string[]): void;
20
+ }
@@ -0,0 +1,3 @@
1
+ import { NativeReanimated } from './NativeReanimated';
2
+ declare const _default: NativeReanimated;
3
+ export default _default;
@@ -0,0 +1,5 @@
1
+ export declare function isJest(): boolean;
2
+ export declare function isChromeDebugger(): boolean;
3
+ export declare function isWeb(): boolean;
4
+ export declare function shouldBeUseWeb(): boolean;
5
+ export declare function nativeShouldBeMock(): boolean;
@@ -0,0 +1,4 @@
1
+ import { AdapterWorkletFunction } from './commonTypes';
2
+ export declare function createAnimatedPropAdapter(adapter: AdapterWorkletFunction, nativeProps?: string[]): AdapterWorkletFunction;
3
+ export declare const SVGAdapter: AdapterWorkletFunction;
4
+ export declare const TextInputAdapter: AdapterWorkletFunction;
@@ -0,0 +1,9 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { AnimatedStyle, SharedValue, StyleProps } from './commonTypes';
3
+ import { Descriptor } from './hook/commonTypes';
4
+ import { ViewRefSet } from './ViewDescriptorsSet';
5
+ export declare const colorProps: string[];
6
+ export declare const ColorProperties: string[];
7
+ export declare const updateProps: (viewDescriptor: SharedValue<Descriptor[]>, updates: StyleProps | AnimatedStyle, maybeViewRef: ViewRefSet<any> | undefined) => void;
8
+ export declare const updatePropsJestWrapper: (viewDescriptors: SharedValue<Descriptor[]>, updates: AnimatedStyle, maybeViewRef: ViewRefSet<any> | undefined, animatedStyle: MutableRefObject<AnimatedStyle>, adapters: ((updates: AnimatedStyle) => void)[]) => void;
9
+ export default updateProps;
@@ -0,0 +1,20 @@
1
+ import { SharedValue } from './commonTypes';
2
+ import { Descriptor } from './hook/commonTypes';
3
+ export interface ViewRefSet<T> {
4
+ items: Set<T>;
5
+ add: (item: T) => void;
6
+ remove: (item: T) => void;
7
+ }
8
+ export interface ViewDescriptorsSet {
9
+ batchToRemove: Set<number>;
10
+ tags: Set<number>;
11
+ waitForInsertSync: boolean;
12
+ waitForRemoveSync: boolean;
13
+ sharableViewDescriptors: SharedValue<Descriptor[]>;
14
+ items: Descriptor[];
15
+ add: (item: Descriptor) => void;
16
+ remove: (viewTag: number) => void;
17
+ rebuildsharableViewDescriptors: (sharableViewDescriptor: SharedValue<Descriptor[]>) => void;
18
+ }
19
+ export declare function makeViewDescriptorsSet(): ViewDescriptorsSet;
20
+ export declare function makeViewsRefSet<T>(): ViewRefSet<T>;
@@ -0,0 +1,13 @@
1
+ import { NativeEvent } from './commonTypes';
2
+ export default class WorkletEventHandler<T extends NativeEvent<T>> {
3
+ worklet: (event: T) => void;
4
+ eventNames: string[];
5
+ reattachNeeded: boolean;
6
+ listeners: Record<string, (event: T) => void>;
7
+ viewTag: number | undefined;
8
+ registrations: string[];
9
+ constructor(worklet: (event: T) => void, eventNames?: string[]);
10
+ updateWorklet(newWorklet: (event: T) => void): void;
11
+ registerForEvents(viewTag: number, fallbackEventName?: string): void;
12
+ unregisterFromEvents(): void;
13
+ }
@@ -0,0 +1,5 @@
1
+ export default class MutableValue {
2
+ constructor(value: any);
3
+ get value(): any;
4
+ set value(nextValue: any);
5
+ }
@@ -0,0 +1,13 @@
1
+ import MutableValue from './MutableValue';
2
+ declare const _default: {
3
+ installCoreFunctions: () => void;
4
+ makeShareable: (worklet: any) => any;
5
+ makeMutable: (init: any) => MutableValue;
6
+ makeRemote: () => void;
7
+ startMapper: () => void;
8
+ stopMapper: () => void;
9
+ registerEventHandler: () => void;
10
+ unregisterEventHandler: () => void;
11
+ getViewProp: () => void;
12
+ };
13
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import MutableValue from './MutableValue';
2
+ declare const _default: {
3
+ installCoreFunctions: () => void;
4
+ makeShareable: (worklet: any) => any;
5
+ makeMutable: (init: any) => MutableValue;
6
+ makeRemote: () => void;
7
+ startMapper: () => void;
8
+ stopMapper: () => void;
9
+ registerEventHandler: () => void;
10
+ unregisterEventHandler: () => void;
11
+ getViewProp: () => void;
12
+ };
13
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import { AnimatedStyle, StyleProps, AnimatableValue, AnimationObject, Animation, Timestamp, AnimationCallback } from '../commonTypes';
2
+ export interface HigherOrderAnimation {
3
+ isHigherOrder?: boolean;
4
+ }
5
+ export declare type NextAnimation<T extends AnimationObject> = T | (() => T);
6
+ export interface DelayAnimation extends Animation<DelayAnimation>, HigherOrderAnimation {
7
+ startTime: Timestamp;
8
+ started: boolean;
9
+ previousAnimation: DelayAnimation | null;
10
+ current: AnimatableValue;
11
+ }
12
+ export interface RepeatAnimation extends Animation<RepeatAnimation>, HigherOrderAnimation {
13
+ reps: number;
14
+ startValue: AnimatableValue;
15
+ toValue?: AnimatableValue;
16
+ previousAnimation?: RepeatAnimation;
17
+ }
18
+ export interface SequenceAnimation extends Animation<SequenceAnimation>, HigherOrderAnimation {
19
+ animationIndex: number;
20
+ }
21
+ export interface StyleLayoutAnimation extends HigherOrderAnimation {
22
+ current: StyleProps;
23
+ styleAnimations: AnimatedStyle;
24
+ onFrame: (animation: StyleLayoutAnimation, timestamp: Timestamp) => boolean;
25
+ onStart: (nextAnimation: StyleLayoutAnimation, current: AnimatedStyle, timestamp: Timestamp, previousAnimation: StyleLayoutAnimation) => void;
26
+ callback?: AnimationCallback;
27
+ }
@@ -0,0 +1,19 @@
1
+ import { Animation, AnimationCallback, AnimationObject, AnimatableValue, Timestamp } from '../commonTypes';
2
+ interface DecayConfig {
3
+ deceleration?: number;
4
+ velocityFactor?: number;
5
+ clamp?: number[];
6
+ velocity?: number;
7
+ }
8
+ export interface DecayAnimation extends Animation<DecayAnimation> {
9
+ lastTimestamp: Timestamp;
10
+ startTimestamp: Timestamp;
11
+ initialVelocity: number;
12
+ velocity: number;
13
+ current: AnimatableValue;
14
+ }
15
+ export interface InnerDecayAnimation extends Omit<DecayAnimation, 'current'>, AnimationObject {
16
+ current: number;
17
+ }
18
+ export declare function withDecay(userConfig: DecayConfig, callback?: AnimationCallback): Animation<DecayAnimation>;
19
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Animation } from '../commonTypes';
2
+ import { NextAnimation, DelayAnimation } from './commonTypes';
3
+ export declare function withDelay(delayMs: number, _nextAnimation: NextAnimation<DelayAnimation>): Animation<DelayAnimation>;
4
+ /**
5
+ * @deprecated Kept for backward compatibility. Will be removed soon.
6
+ */
7
+ export declare function delay(delayMs: number, _nextAnimation: NextAnimation<DelayAnimation>): Animation<DelayAnimation>;