react-native-reanimated 2.13.0 → 2.14.1

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 (173) hide show
  1. package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
  2. package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
  3. package/RNReanimated.podspec +2 -1
  4. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  5. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  6. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  7. package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  8. package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
  9. package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  10. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  11. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  12. package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
  13. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  14. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  15. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  16. package/android/.gradle/file-system.probe +0 -0
  17. package/android/CMakeLists.txt +191 -188
  18. package/android/build.gradle +386 -316
  19. package/android/react-native-reanimated-67-hermes.aar +0 -0
  20. package/android/react-native-reanimated-67-jsc.aar +0 -0
  21. package/android/react-native-reanimated-68-hermes.aar +0 -0
  22. package/android/react-native-reanimated-68-jsc.aar +0 -0
  23. package/android/react-native-reanimated-69-hermes.aar +0 -0
  24. package/android/react-native-reanimated-69-jsc.aar +0 -0
  25. package/android/react-native-reanimated-70-hermes.aar +0 -0
  26. package/android/react-native-reanimated-70-jsc.aar +0 -0
  27. package/android/react-native-reanimated-71-hermes.aar +0 -0
  28. package/android/react-native-reanimated-71-jsc.aar +0 -0
  29. package/android/src/main/cpp/NativeProxy.cpp +8 -0
  30. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
  31. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +1 -1
  32. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
  33. package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
  34. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
  35. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
  36. package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +3 -30
  37. package/ios/REAModule.mm +2 -0
  38. package/ios/native/REAInitializer.mm +4 -0
  39. package/lib/createAnimatedComponent.js +6 -1
  40. package/lib/reanimated2/Colors.js +27 -11
  41. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +4 -0
  42. package/lib/reanimated2/animation/util.js +15 -15
  43. package/lib/reanimated2/globals.d.ts +2 -0
  44. package/lib/reanimated2/interpolateColor.js +79 -20
  45. package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -18
  46. package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -10
  47. package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +15 -10
  48. package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -10
  49. package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +24 -18
  50. package/lib/reanimated2/platform-specific/checkVersion.js +24 -0
  51. package/lib/reanimated2/platform-specific/checkVersion.web.js +6 -0
  52. package/lib/types/{Animated.d.ts → lib/Animated.d.ts} +0 -0
  53. package/lib/types/{ConfigHelper.d.ts → lib/ConfigHelper.d.ts} +0 -0
  54. package/lib/types/{ReanimatedEventEmitter.d.ts → lib/ReanimatedEventEmitter.d.ts} +0 -0
  55. package/lib/types/{ReanimatedModule.d.ts → lib/ReanimatedModule.d.ts} +0 -0
  56. package/lib/types/{ReanimatedModule.macos.d.ts → lib/ReanimatedModule.macos.d.ts} +0 -0
  57. package/lib/types/{ReanimatedModule.native.d.ts → lib/ReanimatedModule.native.d.ts} +0 -0
  58. package/lib/types/{ReanimatedModule.windows.d.ts → lib/ReanimatedModule.windows.d.ts} +0 -0
  59. package/lib/types/{ReanimatedModuleCompat.d.ts → lib/ReanimatedModuleCompat.d.ts} +0 -0
  60. package/lib/types/{createAnimatedComponent.d.ts → lib/createAnimatedComponent.d.ts} +0 -0
  61. package/lib/types/{index.d.ts → lib/index.d.ts} +0 -0
  62. package/lib/types/{index.web.d.ts → lib/index.web.d.ts} +0 -0
  63. package/lib/types/{reanimated2 → lib/reanimated2}/Bezier.d.ts +0 -0
  64. package/lib/types/{reanimated2 → lib/reanimated2}/Colors.d.ts +5 -3
  65. package/lib/types/{reanimated2 → lib/reanimated2}/Easing.d.ts +0 -0
  66. package/lib/types/{reanimated2 → lib/reanimated2}/NativeMethods.d.ts +0 -0
  67. package/lib/types/{reanimated2 → lib/reanimated2}/NativeReanimated/NativeReanimated.d.ts +0 -0
  68. package/lib/types/{reanimated2 → lib/reanimated2}/NativeReanimated/index.d.ts +0 -0
  69. package/lib/types/{reanimated2 → lib/reanimated2}/PlatformChecker.d.ts +0 -0
  70. package/lib/types/{reanimated2 → lib/reanimated2}/PropAdapters.d.ts +0 -0
  71. package/lib/types/{reanimated2 → lib/reanimated2}/UpdateProps.d.ts +0 -0
  72. package/lib/types/{reanimated2 → lib/reanimated2}/ViewDescriptorsSet.d.ts +0 -0
  73. package/lib/types/{reanimated2 → lib/reanimated2}/WorkletEventHandler.d.ts +0 -0
  74. package/lib/types/{reanimated2 → lib/reanimated2}/__mocks__/MutableValue.d.ts +0 -0
  75. package/lib/types/{reanimated2 → lib/reanimated2}/__mocks__/NativeReanimated.d.ts +0 -0
  76. package/lib/types/{reanimated2 → lib/reanimated2}/animation/commonTypes.d.ts +0 -0
  77. package/lib/types/{reanimated2 → lib/reanimated2}/animation/decay.d.ts +0 -0
  78. package/lib/types/{reanimated2 → lib/reanimated2}/animation/delay.d.ts +0 -0
  79. package/lib/types/{reanimated2 → lib/reanimated2}/animation/index.d.ts +0 -0
  80. package/lib/types/{reanimated2 → lib/reanimated2}/animation/repeat.d.ts +0 -0
  81. package/lib/types/{reanimated2 → lib/reanimated2}/animation/sequence.d.ts +0 -0
  82. package/lib/types/{reanimated2 → lib/reanimated2}/animation/spring.d.ts +0 -0
  83. package/lib/types/{reanimated2 → lib/reanimated2}/animation/styleAnimation.d.ts +0 -0
  84. package/lib/types/{reanimated2 → lib/reanimated2}/animation/timing.d.ts +0 -0
  85. package/lib/types/{reanimated2 → lib/reanimated2}/animation/util.d.ts +0 -0
  86. package/lib/types/{reanimated2 → lib/reanimated2}/commonTypes.d.ts +0 -0
  87. package/lib/types/{reanimated2 → lib/reanimated2}/component/FlatList.d.ts +0 -0
  88. package/lib/types/{reanimated2 → lib/reanimated2}/component/Image.d.ts +0 -0
  89. package/lib/types/{reanimated2 → lib/reanimated2}/component/ScrollView.d.ts +0 -0
  90. package/lib/types/{reanimated2 → lib/reanimated2}/component/Text.d.ts +0 -0
  91. package/lib/types/{reanimated2 → lib/reanimated2}/component/View.d.ts +0 -0
  92. package/lib/types/{reanimated2 → lib/reanimated2}/core.d.ts +0 -0
  93. package/lib/types/{reanimated2 → lib/reanimated2}/frameCallback/FrameCallbackRegistryJS.d.ts +0 -0
  94. package/lib/types/{reanimated2 → lib/reanimated2}/frameCallback/FrameCallbackRegistryUI.d.ts +0 -0
  95. package/lib/types/{reanimated2 → lib/reanimated2}/hook/Hooks.d.ts +0 -0
  96. package/lib/types/{reanimated2 → lib/reanimated2}/hook/commonTypes.d.ts +0 -0
  97. package/lib/types/{reanimated2 → lib/reanimated2}/hook/index.d.ts +0 -0
  98. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedGestureHandler.d.ts +0 -0
  99. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedKeyboard.d.ts +0 -0
  100. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedReaction.d.ts +0 -0
  101. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedRef.d.ts +0 -0
  102. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedScrollHandler.d.ts +0 -0
  103. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedSensor.d.ts +0 -0
  104. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedStyle.d.ts +0 -0
  105. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useDerivedValue.d.ts +0 -0
  106. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useFrameCallback.d.ts +0 -0
  107. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useScrollViewOffset.d.ts +0 -0
  108. package/lib/types/{reanimated2 → lib/reanimated2}/hook/useSharedValue.d.ts +0 -0
  109. package/lib/types/{reanimated2 → lib/reanimated2}/hook/utils.d.ts +0 -0
  110. package/lib/types/{reanimated2 → lib/reanimated2}/index.d.ts +0 -0
  111. package/lib/types/{reanimated2 → lib/reanimated2}/interpolateColor.d.ts +8 -2
  112. package/lib/types/{reanimated2 → lib/reanimated2}/interpolation.d.ts +0 -0
  113. package/lib/types/{reanimated2 → lib/reanimated2}/jestUtils.d.ts +0 -0
  114. package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/JSReanimated.d.ts +0 -0
  115. package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/Mapper.d.ts +0 -0
  116. package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/MapperRegistry.d.ts +0 -0
  117. package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/MutableValue.d.ts +0 -0
  118. package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/commonTypes.d.ts +0 -0
  119. package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/global.d.ts +0 -0
  120. package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/index.d.ts +0 -0
  121. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/LayoutAnimationRepository.d.ts +0 -0
  122. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -0
  123. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -0
  124. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -0
  125. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/commonTypes.d.ts +4 -0
  126. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/index.d.ts +0 -0
  127. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -0
  128. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Default.d.ts +0 -0
  129. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Fade.d.ts +0 -0
  130. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Flip.d.ts +0 -0
  131. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -0
  132. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -0
  133. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Roll.d.ts +0 -0
  134. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -0
  135. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Slide.d.ts +0 -0
  136. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -0
  137. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -0
  138. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/index.d.ts +0 -0
  139. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -0
  140. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -0
  141. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -0
  142. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -0
  143. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -0
  144. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -0
  145. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/index.d.ts +0 -0
  146. package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/index.d.ts +0 -0
  147. package/lib/types/{reanimated2 → lib/reanimated2}/mock.d.ts +0 -0
  148. package/lib/types/{reanimated2 → lib/reanimated2}/platform-specific/RNRenderer.d.ts +0 -0
  149. package/lib/types/{reanimated2 → lib/reanimated2}/platform-specific/RNRenderer.web.d.ts +0 -0
  150. package/lib/types/lib/reanimated2/platform-specific/checkVersion.d.ts +4 -0
  151. package/lib/types/lib/reanimated2/platform-specific/checkVersion.web.d.ts +5 -0
  152. package/lib/types/{reanimated2 → lib/reanimated2}/utils.d.ts +0 -0
  153. package/lib/types/{setAndForwardRef.d.ts → lib/setAndForwardRef.d.ts} +0 -0
  154. package/package.json +6 -6
  155. package/plugin.js +7 -3
  156. package/react-native-reanimated.d.ts +11 -2
  157. package/scripts/reanimated_utils.rb +7 -3
  158. package/src/createAnimatedComponent.tsx +8 -1
  159. package/src/reanimated2/Colors.ts +38 -11
  160. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +4 -0
  161. package/src/reanimated2/animation/util.ts +26 -15
  162. package/src/reanimated2/globals.d.ts +2 -0
  163. package/src/reanimated2/interpolateColor.ts +105 -21
  164. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +4 -0
  165. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
  166. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
  167. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
  168. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
  169. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
  170. package/src/reanimated2/platform-specific/checkVersion.ts +28 -0
  171. package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
  172. package/android/react-native-reanimated-66-hermes.aar +0 -0
  173. package/android/react-native-reanimated-66-jsc.aar +0 -0
@@ -1,6 +1,4 @@
1
- import { Dimensions } from 'react-native';
2
1
  import { ComplexAnimationBuilder } from '../animationBuilder';
3
- const { width, height } = Dimensions.get('window');
4
2
  export class ZoomIn extends ComplexAnimationBuilder {
5
3
  constructor() {
6
4
  super(...arguments);
@@ -64,7 +62,7 @@ export class ZoomInLeft extends ComplexAnimationBuilder {
64
62
  const delay = this.getDelay();
65
63
  const callback = this.callbackV;
66
64
  const initialValues = this.initialValues;
67
- return () => {
65
+ return (values) => {
68
66
  'worklet';
69
67
  return {
70
68
  animations: {
@@ -73,7 +71,7 @@ export class ZoomInLeft extends ComplexAnimationBuilder {
73
71
  { scale: delayFunction(delay, animation(1, config)) },
74
72
  ],
75
73
  },
76
- initialValues: Object.assign({ transform: [{ translateX: -width }, { scale: 0 }] }, initialValues),
74
+ initialValues: Object.assign({ transform: [{ translateX: -values.windowWidth }, { scale: 0 }] }, initialValues),
77
75
  callback: callback,
78
76
  };
79
77
  };
@@ -92,7 +90,7 @@ export class ZoomInRight extends ComplexAnimationBuilder {
92
90
  const delay = this.getDelay();
93
91
  const callback = this.callbackV;
94
92
  const initialValues = this.initialValues;
95
- return () => {
93
+ return (values) => {
96
94
  'worklet';
97
95
  return {
98
96
  animations: {
@@ -101,7 +99,7 @@ export class ZoomInRight extends ComplexAnimationBuilder {
101
99
  { scale: delayFunction(delay, animation(1, config)) },
102
100
  ],
103
101
  },
104
- initialValues: Object.assign({ transform: [{ translateX: width }, { scale: 0 }] }, initialValues),
102
+ initialValues: Object.assign({ transform: [{ translateX: values.windowWidth }, { scale: 0 }] }, initialValues),
105
103
  callback: callback,
106
104
  };
107
105
  };
@@ -120,7 +118,7 @@ export class ZoomInUp extends ComplexAnimationBuilder {
120
118
  const delay = this.getDelay();
121
119
  const callback = this.callbackV;
122
120
  const initialValues = this.initialValues;
123
- return () => {
121
+ return (values) => {
124
122
  'worklet';
125
123
  return {
126
124
  animations: {
@@ -129,7 +127,7 @@ export class ZoomInUp extends ComplexAnimationBuilder {
129
127
  { scale: delayFunction(delay, animation(1, config)) },
130
128
  ],
131
129
  },
132
- initialValues: Object.assign({ transform: [{ translateY: -height }, { scale: 0 }] }, initialValues),
130
+ initialValues: Object.assign({ transform: [{ translateY: -values.windowHeight }, { scale: 0 }] }, initialValues),
133
131
  callback: callback,
134
132
  };
135
133
  };
@@ -148,7 +146,7 @@ export class ZoomInDown extends ComplexAnimationBuilder {
148
146
  const delay = this.getDelay();
149
147
  const callback = this.callbackV;
150
148
  const initialValues = this.initialValues;
151
- return () => {
149
+ return (values) => {
152
150
  'worklet';
153
151
  return {
154
152
  animations: {
@@ -157,7 +155,7 @@ export class ZoomInDown extends ComplexAnimationBuilder {
157
155
  { scale: delayFunction(delay, animation(1, config)) },
158
156
  ],
159
157
  },
160
- initialValues: Object.assign({ transform: [{ translateY: height }, { scale: 0 }] }, initialValues),
158
+ initialValues: Object.assign({ transform: [{ translateY: values.windowHeight }, { scale: 0 }] }, initialValues),
161
159
  callback: callback,
162
160
  };
163
161
  };
@@ -286,12 +284,14 @@ export class ZoomOutLeft extends ComplexAnimationBuilder {
286
284
  const delay = this.getDelay();
287
285
  const callback = this.callbackV;
288
286
  const initialValues = this.initialValues;
289
- return () => {
287
+ return (values) => {
290
288
  'worklet';
291
289
  return {
292
290
  animations: {
293
291
  transform: [
294
- { translateX: delayFunction(delay, animation(-width, config)) },
292
+ {
293
+ translateX: delayFunction(delay, animation(-values.windowWidth, config)),
294
+ },
295
295
  { scale: delayFunction(delay, animation(0, config)) },
296
296
  ],
297
297
  },
@@ -314,12 +314,14 @@ export class ZoomOutRight extends ComplexAnimationBuilder {
314
314
  const delay = this.getDelay();
315
315
  const callback = this.callbackV;
316
316
  const initialValues = this.initialValues;
317
- return () => {
317
+ return (values) => {
318
318
  'worklet';
319
319
  return {
320
320
  animations: {
321
321
  transform: [
322
- { translateX: delayFunction(delay, animation(width, config)) },
322
+ {
323
+ translateX: delayFunction(delay, animation(values.windowWidth, config)),
324
+ },
323
325
  { scale: delayFunction(delay, animation(0, config)) },
324
326
  ],
325
327
  },
@@ -342,12 +344,14 @@ export class ZoomOutUp extends ComplexAnimationBuilder {
342
344
  const delay = this.getDelay();
343
345
  const callback = this.callbackV;
344
346
  const initialValues = this.initialValues;
345
- return () => {
347
+ return (values) => {
346
348
  'worklet';
347
349
  return {
348
350
  animations: {
349
351
  transform: [
350
- { translateY: delayFunction(delay, animation(-height, config)) },
352
+ {
353
+ translateY: delayFunction(delay, animation(-values.windowHeight, config)),
354
+ },
351
355
  { scale: delayFunction(delay, animation(0, config)) },
352
356
  ],
353
357
  },
@@ -370,12 +374,14 @@ export class ZoomOutDown extends ComplexAnimationBuilder {
370
374
  const delay = this.getDelay();
371
375
  const callback = this.callbackV;
372
376
  const initialValues = this.initialValues;
373
- return () => {
377
+ return (values) => {
374
378
  'worklet';
375
379
  return {
376
380
  animations: {
377
381
  transform: [
378
- { translateY: delayFunction(delay, animation(height, config)) },
382
+ {
383
+ translateY: delayFunction(delay, animation(values.windowHeight, config)),
384
+ },
379
385
  { scale: delayFunction(delay, animation(0, config)) },
380
386
  ],
381
387
  },
@@ -0,0 +1,24 @@
1
+ import { version as jsVersion } from '../../../package.json';
2
+ /**
3
+ * Checks that native and js versions of reanimated match.
4
+ */
5
+ export function checkVersion() {
6
+ const cppVersion = global._REANIMATED_VERSION_CPP;
7
+ const ok = (() => {
8
+ if (jsVersion.match(/^\d+\.\d+\.\d+$/) &&
9
+ cppVersion.match(/^\d+\.\d+\.\d+$/)) {
10
+ // x.y.z, compare only major and minor, skip patch
11
+ const [jsMajor, jsMinor] = jsVersion.split('.');
12
+ const [cppMajor, cppMinor] = cppVersion.split('.');
13
+ return jsMajor === cppMajor && jsMinor === cppMinor;
14
+ }
15
+ else {
16
+ // alpha, beta or rc, compare everything
17
+ return jsVersion === cppVersion;
18
+ }
19
+ })();
20
+ if (!ok) {
21
+ console.error(`[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`);
22
+ // TODO: detect Expo managed workflow
23
+ }
24
+ }
@@ -0,0 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/no-empty-function */
2
+ /**
3
+ * Checks that native and js versions of reanimated match.
4
+ * Stubbed for web, where this check is unnecessary.
5
+ */
6
+ export function checkVersion() { }
File without changes
File without changes
File without changes
@@ -21,11 +21,13 @@ export declare const blue: (c: number) => number;
21
21
  export declare const rgbaColor: (r: number, g: number, b: number, alpha?: number) => number | string;
22
22
  export declare function RGBtoHSV(rgb: RGB): HSV;
23
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;
24
+ export declare const hsvToColor: (h: number, s: number, v: number, a: number) => number | string;
25
25
  export declare function processColorInitially(color: unknown): number | null | undefined;
26
26
  export declare function isColor(value: unknown): boolean;
27
27
  export declare function processColor(color: unknown): number | null | undefined;
28
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;
29
+ export declare function convertToRGBA(color: unknown): ParsedColorArray;
30
+ export declare function rgbaArrayToRGBAColor(RGBA: ParsedColorArray): string;
31
+ export declare function toLinearSpace(RGBA: ParsedColorArray, gamma?: number): ParsedColorArray;
32
+ export declare function toGammaSpace(RGBA: ParsedColorArray, gamma?: number): ParsedColorArray;
31
33
  export {};
@@ -1,4 +1,8 @@
1
1
  import { SharedValue } from './commonTypes';
2
+ export declare type InterpolationOptions = {
3
+ gamma?: number;
4
+ useCorrectedHSVInterpolation?: boolean;
5
+ };
2
6
  interface InterpolateRGB {
3
7
  r: number[];
4
8
  g: number[];
@@ -9,8 +13,9 @@ interface InterpolateHSV {
9
13
  h: number[];
10
14
  s: number[];
11
15
  v: number[];
16
+ a: number[];
12
17
  }
13
- export declare const interpolateColor: (value: number, inputRange: readonly number[], outputRange: readonly (string | number)[], colorSpace?: 'RGB' | 'HSV') => string | number;
18
+ export declare const interpolateColor: (value: number, inputRange: readonly number[], outputRange: readonly (string | number)[], colorSpace?: 'RGB' | 'HSV', options?: InterpolationOptions) => string | number;
14
19
  export declare enum ColorSpace {
15
20
  RGB = 0,
16
21
  HSV = 1
@@ -20,7 +25,8 @@ export interface InterpolateConfig {
20
25
  outputRange: readonly (string | number)[];
21
26
  colorSpace: ColorSpace;
22
27
  cache: SharedValue<InterpolateRGB | InterpolateHSV | null>;
28
+ options: InterpolationOptions;
23
29
  }
24
- export declare function useInterpolateConfig(inputRange: readonly number[], outputRange: readonly (string | number)[], colorSpace?: ColorSpace): SharedValue<InterpolateConfig>;
30
+ export declare function useInterpolateConfig(inputRange: readonly number[], outputRange: readonly (string | number)[], colorSpace?: ColorSpace, options?: InterpolationOptions): SharedValue<InterpolateConfig>;
25
31
  export declare const interpolateSharableColor: (value: number, interpolateConfig: SharedValue<InterpolateConfig>) => string | number;
26
32
  export {};
@@ -17,6 +17,8 @@ export interface EntryAnimationsValues {
17
17
  targetHeight: number;
18
18
  targetGlobalOriginX: number;
19
19
  targetGlobalOriginY: number;
20
+ windowWidth: number;
21
+ windowHeight: number;
20
22
  }
21
23
  export interface ExitAnimationsValues {
22
24
  currentOriginX: number;
@@ -25,6 +27,8 @@ export interface ExitAnimationsValues {
25
27
  currentHeight: number;
26
28
  currentGlobalOriginX: number;
27
29
  currentGlobalOriginY: number;
30
+ windowWidth: number;
31
+ windowHeight: number;
28
32
  }
29
33
  export declare type EntryExitAnimationFunction = (targetValues: EntryAnimationsValues | ExitAnimationsValues) => LayoutAnimation;
30
34
  export declare type AnimationConfigFunction<T> = (targetValues: T) => LayoutAnimation;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Checks that native and js versions of reanimated match.
3
+ */
4
+ export declare function checkVersion(): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Checks that native and js versions of reanimated match.
3
+ * Stubbed for web, where this check is unnecessary.
4
+ */
5
+ export declare function checkVersion(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "2.13.0",
3
+ "version": "2.14.1",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
6
  "test": "yarn run format:js && yarn run lint:js && yarn run test:unit",
@@ -77,7 +77,7 @@
77
77
  "dependencies": {
78
78
  "@babel/plugin-transform-object-assign": "^7.16.7",
79
79
  "@babel/preset-typescript": "^7.16.7",
80
- "@types/invariant": "^2.2.35",
80
+ "convert-source-map": "^1.7.0",
81
81
  "invariant": "^2.2.4",
82
82
  "lodash.isequal": "^4.5.0",
83
83
  "setimmediate": "^1.0.5",
@@ -101,8 +101,9 @@
101
101
  "@types/babel__core": "^7.1.18",
102
102
  "@types/babel__generator": "^7.6.4",
103
103
  "@types/babel__traverse": "^7.14.2",
104
+ "@types/invariant": "^2.2.35",
104
105
  "@types/jest": "^27.4.0",
105
- "@types/react-native": "^0.69.5",
106
+ "@types/react": "^18.0.26",
106
107
  "@typescript-eslint/eslint-plugin": "^5.11.0",
107
108
  "@typescript-eslint/parser": "^5.11.0",
108
109
  "babel-eslint": "^10.1.0",
@@ -123,10 +124,9 @@
123
124
  "madge": "^5.0.1",
124
125
  "prettier": "^2.5.1",
125
126
  "react": "17.0.2",
126
- "react-native": "0.70",
127
+ "react-native": "0.71.0-rc.5",
127
128
  "react-native-builder-bob": "^0.18.3",
128
- "react-native-codegen": "^0.0.7",
129
- "react-native-gesture-handler": "^1.6.1",
129
+ "react-native-gesture-handler": "^2.4.2",
130
130
  "react-test-renderer": "17.0.2",
131
131
  "release-it": "^13.7.2",
132
132
  "typescript": "^4.1.3"
package/plugin.js CHANGED
@@ -705,10 +705,14 @@ function isGestureObject(t, node) {
705
705
  }
706
706
 
707
707
  function processWorklets(t, path, state) {
708
+ const callee =
709
+ path.node.callee.type === 'SequenceExpression'
710
+ ? path.node.callee.expressions[path.node.callee.expressions.length - 1]
711
+ : path.node.callee;
712
+
708
713
  const name =
709
- path.node.callee.type === 'MemberExpression'
710
- ? path.node.callee.property.name
711
- : path.node.callee.name;
714
+ callee.type === 'MemberExpression' ? callee.property.name : callee.name;
715
+
712
716
  if (
713
717
  objectHooks.has(name) &&
714
718
  path.get('arguments.0').type === 'ObjectExpression'
@@ -713,11 +713,19 @@ declare module 'react-native-reanimated' {
713
713
 
714
714
  export function processColor(color: number | string): number;
715
715
 
716
+ export type InterpolationOptions = {
717
+ gamma?: number;
718
+ useCorrectedHSVInterpolation?: boolean;
719
+ };
720
+
721
+ export function isColor(value: unknown): boolean;
722
+
716
723
  export function interpolateColor<T extends string | number>(
717
724
  value: number,
718
725
  inputRange: readonly number[],
719
726
  outputRange: readonly T[],
720
- colorSpace?: 'RGB' | 'HSV'
727
+ colorSpace?: 'RGB' | 'HSV',
728
+ options?: InterpolationOptions
721
729
  ): T;
722
730
 
723
731
  export enum ColorSpace {
@@ -748,7 +756,8 @@ declare module 'react-native-reanimated' {
748
756
  export function useInterpolateConfig(
749
757
  inputRange: readonly number[],
750
758
  outputRange: readonly (string | number)[],
751
- colorSpace?: ColorSpace
759
+ colorSpace?: ColorSpace,
760
+ options?: InterpolationOptions
752
761
  ): SharedValue<InterpolateConfig>;
753
762
 
754
763
  export function interpolateSharableColor(