react-native-reanimated 2.6.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/Common/cpp/SharedItems/ShareableValue.cpp +2 -2
  2. package/Common/cpp/Tools/RuntimeDecorator.cpp +17 -25
  3. package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
  5. package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
  6. package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
  7. package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  11. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  12. package/android/.gradle/checksums/checksums.lock +0 -0
  13. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  14. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  15. package/android/CMakeLists.txt +19 -8
  16. package/android/build.gradle +22 -8
  17. package/android/react-native-reanimated-65-hermes.aar +0 -0
  18. package/android/react-native-reanimated-65-jsc.aar +0 -0
  19. package/android/react-native-reanimated-66-hermes.aar +0 -0
  20. package/android/react-native-reanimated-66-jsc.aar +0 -0
  21. package/android/react-native-reanimated-67-hermes.aar +0 -0
  22. package/android/react-native-reanimated-67-jsc.aar +0 -0
  23. package/android/react-native-reanimated-68-hermes.aar +0 -0
  24. package/android/react-native-reanimated-68-jsc.aar +0 -0
  25. package/android/react-native-reanimated-69-hermes.aar +0 -0
  26. package/android/react-native-reanimated-69-jsc.aar +0 -0
  27. package/android/rnVersionPatch/69/.gitkeep +0 -0
  28. package/android/src/main/cpp/NativeProxy.cpp +35 -14
  29. package/android/src/main/cpp/headers/NativeProxy.h +2 -0
  30. package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +11 -8
  31. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +13 -6
  32. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +24 -1
  33. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +7 -5
  34. package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
  35. package/ios/LayoutReanimation/REAAnimationsManager.m +2 -2
  36. package/ios/LayoutReanimation/REASnapshot.m +1 -1
  37. package/ios/LayoutReanimation/REAUIManager.h +1 -1
  38. package/ios/LayoutReanimation/REAUIManager.mm +4 -5
  39. package/ios/Nodes/REAAlwaysNode.h +1 -1
  40. package/ios/Nodes/REAAlwaysNode.m +5 -5
  41. package/ios/Nodes/REABezierNode.h +1 -1
  42. package/ios/Nodes/REABezierNode.m +4 -5
  43. package/ios/Nodes/REABlockNode.h +1 -1
  44. package/ios/Nodes/REABlockNode.m +2 -2
  45. package/ios/Nodes/REACallFuncNode.h +1 -1
  46. package/ios/Nodes/REACallFuncNode.m +5 -5
  47. package/ios/Nodes/REAClockNodes.h +1 -1
  48. package/ios/Nodes/REAClockNodes.m +4 -4
  49. package/ios/Nodes/REAConcatNode.h +1 -1
  50. package/ios/Nodes/REAConcatNode.m +3 -3
  51. package/ios/Nodes/REACondNode.h +1 -1
  52. package/ios/Nodes/REACondNode.m +3 -3
  53. package/ios/Nodes/READebugNode.h +1 -1
  54. package/ios/Nodes/READebugNode.m +3 -3
  55. package/ios/Nodes/REAEventNode.h +1 -2
  56. package/ios/Nodes/REAEventNode.m +3 -3
  57. package/ios/Nodes/REAFunctionNode.h +1 -1
  58. package/ios/Nodes/REAFunctionNode.m +3 -3
  59. package/ios/Nodes/REAJSCallNode.h +1 -1
  60. package/ios/Nodes/REAJSCallNode.m +3 -3
  61. package/ios/Nodes/REANode.m +2 -2
  62. package/ios/Nodes/REAOperatorNode.h +1 -1
  63. package/ios/Nodes/REAOperatorNode.m +2 -3
  64. package/ios/Nodes/REAParamNode.h +1 -1
  65. package/ios/Nodes/REAParamNode.m +4 -4
  66. package/ios/Nodes/REAPropsNode.h +1 -1
  67. package/ios/Nodes/REAPropsNode.m +4 -6
  68. package/ios/Nodes/REASetNode.h +1 -1
  69. package/ios/Nodes/REASetNode.m +4 -4
  70. package/ios/Nodes/REAStyleNode.h +1 -1
  71. package/ios/Nodes/REAStyleNode.m +2 -3
  72. package/ios/Nodes/REATransformNode.h +1 -1
  73. package/ios/Nodes/REATransformNode.m +2 -2
  74. package/ios/Nodes/REAValueNode.h +1 -3
  75. package/ios/Nodes/REAValueNode.m +1 -1
  76. package/ios/REAEventDispatcher.m +1 -1
  77. package/ios/REAModule.h +1 -1
  78. package/ios/REAModule.m +4 -5
  79. package/ios/REANodesManager.h +1 -2
  80. package/ios/REANodesManager.m +21 -23
  81. package/ios/Transitioning/RCTConvert+REATransition.h +1 -2
  82. package/ios/Transitioning/RCTConvert+REATransition.m +1 -1
  83. package/ios/Transitioning/REAAllTransitions.h +1 -1
  84. package/ios/Transitioning/REAAllTransitions.m +2 -3
  85. package/ios/Transitioning/REATransition.h +2 -3
  86. package/ios/Transitioning/REATransition.m +3 -4
  87. package/ios/Transitioning/REATransitionAnimation.m +1 -2
  88. package/ios/Transitioning/REATransitionManager.m +2 -4
  89. package/ios/Transitioning/REATransitionValues.m +2 -3
  90. package/ios/native/NativeMethods.h +1 -3
  91. package/ios/native/NativeMethods.mm +1 -1
  92. package/ios/native/NativeProxy.h +2 -2
  93. package/ios/native/NativeProxy.mm +20 -17
  94. package/ios/native/REAIOSErrorHandler.h +2 -4
  95. package/ios/native/REAIOSErrorHandler.mm +1 -1
  96. package/ios/native/REAIOSLogger.h +1 -3
  97. package/ios/native/REAIOSLogger.mm +1 -1
  98. package/ios/native/REAIOSScheduler.h +1 -3
  99. package/ios/native/REAIOSScheduler.mm +2 -2
  100. package/ios/native/REAInitializer.h +0 -7
  101. package/ios/native/REAInitializer.mm +13 -3
  102. package/ios/native/UIResponder+Reanimated.mm +3 -3
  103. package/ios/sensor/ReanimatedSensor.h +1 -1
  104. package/ios/sensor/ReanimatedSensor.m +3 -3
  105. package/ios/sensor/ReanimatedSensorContainer.h +1 -1
  106. package/ios/sensor/ReanimatedSensorContainer.m +2 -2
  107. package/lib/Animated.js +8 -30
  108. package/lib/ConfigHelper.js +0 -1
  109. package/lib/index.js +5 -30
  110. package/lib/reanimated2/Easing.js +9 -3
  111. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +1 -1
  112. package/lib/reanimated2/animation/sequence.js +0 -3
  113. package/lib/reanimated2/component/FlatList.js +3 -3
  114. package/lib/reanimated2/component/Image.js +4 -0
  115. package/lib/reanimated2/component/ScrollView.js +4 -0
  116. package/lib/reanimated2/component/Text.js +4 -0
  117. package/lib/reanimated2/component/View.js +4 -0
  118. package/lib/reanimated2/core.js +0 -41
  119. package/lib/reanimated2/globals.d.ts +1 -2
  120. package/lib/reanimated2/hook/utils.js +0 -5
  121. package/lib/reanimated2/js-reanimated/global.js +25 -0
  122. package/lib/reanimated2/js-reanimated/index.js +0 -24
  123. package/lib/reanimated2/mock.js +6 -0
  124. package/lib/types/lib/Animated.d.ts +8 -0
  125. package/lib/types/lib/index.d.ts +4 -0
  126. package/lib/types/lib/reanimated2/commonTypes.d.ts +0 -1
  127. package/lib/types/lib/reanimated2/component/Image.d.ts +3 -0
  128. package/lib/types/lib/reanimated2/component/ScrollView.d.ts +3 -0
  129. package/lib/types/lib/reanimated2/component/Text.d.ts +3 -0
  130. package/lib/types/lib/reanimated2/component/View.d.ts +3 -0
  131. package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +1 -3
  132. package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +1 -0
  133. package/lib/types/lib/reanimated2/mock.d.ts +6 -0
  134. package/package.json +18 -14
  135. package/plugin.js +36 -33
  136. package/react-native-reanimated.d.ts +16 -7
  137. package/src/Animated.ts +13 -0
  138. package/src/ConfigHelper.ts +0 -1
  139. package/src/index.ts +7 -0
  140. package/src/reanimated2/Easing.ts +9 -3
  141. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +1 -1
  142. package/src/reanimated2/animation/sequence.ts +0 -5
  143. package/src/reanimated2/commonTypes.ts +0 -1
  144. package/src/reanimated2/component/FlatList.tsx +3 -6
  145. package/src/reanimated2/component/Image.ts +6 -0
  146. package/src/reanimated2/component/ScrollView.ts +6 -0
  147. package/src/reanimated2/component/Text.ts +6 -0
  148. package/src/reanimated2/component/View.ts +6 -0
  149. package/src/reanimated2/core.ts +0 -52
  150. package/src/reanimated2/globals.d.ts +1 -2
  151. package/src/reanimated2/hook/useAnimatedSensor.ts +1 -3
  152. package/src/reanimated2/hook/utils.ts +0 -6
  153. package/src/reanimated2/js-reanimated/global.ts +33 -0
  154. package/src/reanimated2/js-reanimated/index.ts +0 -31
  155. package/src/reanimated2/mock.ts +6 -0
  156. package/android/react-native-reanimated-64-hermes.aar +0 -0
  157. package/android/react-native-reanimated-64-jsc.aar +0 -0
  158. package/lib/reanimated2/component/WrappedComponents.js +0 -9
  159. package/lib/reanimated2/component/index.js +0 -4
  160. package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +0 -8
  161. package/lib/types/lib/reanimated2/component/index.d.ts +0 -9
  162. package/src/Animated.js +0 -31
  163. package/src/reanimated2/component/WrappedComponents.ts +0 -11
  164. package/src/reanimated2/component/index.ts +0 -9
@@ -1,6 +1,6 @@
1
- #import "REAInitializer.h"
2
- #import "REAUIManager.h"
3
- #import "UIResponder+Reanimated.h"
1
+ #import <RNReanimated/REAInitializer.h>
2
+ #import <RNReanimated/REAUIManager.h>
3
+ #import <RNReanimated/UIResponder+Reanimated.h>
4
4
 
5
5
  #if __has_include(<reacthermes/HermesExecutorFactory.h>)
6
6
  #import <reacthermes/HermesExecutorFactory.h>
@@ -1,7 +1,7 @@
1
1
  #if __has_include(<CoreMotion/CoreMotion.h>)
2
2
  #import <CoreMotion/CoreMotion.h>
3
3
  #endif
4
- #import "ReanimatedSensorType.h"
4
+ #import <RNReanimated/ReanimatedSensorType.h>
5
5
 
6
6
  @interface ReanimatedSensor : NSObject {
7
7
  ReanimatedSensorType _sensorType;
@@ -1,4 +1,4 @@
1
- #import "ReanimatedSensor.h"
1
+ #import <RNReanimated/ReanimatedSensor.h>
2
2
 
3
3
  #if __has_include(<CoreMotion/CoreMotion.h>)
4
4
  @implementation ReanimatedSensor
@@ -141,9 +141,9 @@
141
141
  attitude.quaternion.y,
142
142
  attitude.quaternion.z,
143
143
  attitude.quaternion.w,
144
- attitude.pitch,
145
- attitude.roll,
146
144
  attitude.yaw,
145
+ attitude.pitch,
146
+ attitude.roll
147
147
  };
148
148
  self->_setter(data);
149
149
  self->_lastTimestamp = currentTime;
@@ -1,4 +1,4 @@
1
- #import "ReanimatedSensorType.h"
1
+ #import <RNReanimated/ReanimatedSensorType.h>
2
2
 
3
3
  @interface ReanimatedSensorContainer : NSObject {
4
4
  NSNumber *_nextSensorId;
@@ -1,6 +1,6 @@
1
- #import "ReanimatedSensorContainer.h"
2
1
  #import <Foundation/Foundation.h>
3
- #import "ReanimatedSensor.h"
2
+ #import <RNReanimated/ReanimatedSensor.h>
3
+ #import <RNReanimated/ReanimatedSensorContainer.h>
4
4
 
5
5
  static NSNumber *_nextSensorId = nil;
6
6
 
package/lib/Animated.js CHANGED
@@ -1,31 +1,9 @@
1
- import { LogBox } from 'react-native';
2
- import createAnimatedComponent from './createAnimatedComponent';
3
- import {
4
- addWhitelistedNativeProps,
5
- addWhitelistedUIProps,
6
- } from './ConfigHelper';
7
- import * as reanimated1 from './reanimated1';
8
- import ReanimatedComponents from './reanimated2/component';
9
-
10
- const Animated = {
11
- // components
12
- ...ReanimatedComponents,
13
- createAnimatedComponent,
14
- // configuration
15
- addWhitelistedNativeProps,
16
- addWhitelistedUIProps,
17
- // reanimated 1
18
- ...reanimated1,
19
- };
20
-
21
- export * from './reanimated2';
1
+ export { default as createAnimatedComponent } from './createAnimatedComponent';
2
+ export { addWhitelistedNativeProps, addWhitelistedUIProps, } from './ConfigHelper';
3
+ export { default as Text } from './reanimated2/component/Text';
4
+ export { default as View } from './reanimated2/component/View';
5
+ export { default as ScrollView } from './reanimated2/component/ScrollView';
6
+ export { default as Image } from './reanimated2/component/Image';
7
+ export { default as FlatList } from './reanimated2/component/FlatList';
8
+ // @ts-ignore backward compatibility with treeshaking
22
9
  export * from './reanimated1';
23
- export default Animated;
24
-
25
- // I think we can ignore this message as long as Gesture Handler doesn't
26
- // try to load the Reanimated module. I figured it should be here instead of
27
- // RNGH because this prevents the message from being displayed for all
28
- // versions of RNGH.
29
- LogBox.ignoreLogs([
30
- 'RCTBridge required dispatch_sync to load RNGestureHandlerModule. This may lead to deadlocks',
31
- ]);
@@ -76,7 +76,6 @@ let NATIVE_THREAD_PROPS_WHITELIST = {
76
76
  borderTopLeftRadius: true,
77
77
  borderTopRightRadius: true,
78
78
  borderTopStartRadius: true,
79
- opacity: true,
80
79
  elevation: true,
81
80
  fontSize: true,
82
81
  lineHeight: true,
package/lib/index.js CHANGED
@@ -1,31 +1,6 @@
1
- import { LogBox } from 'react-native';
2
- import createAnimatedComponent from './createAnimatedComponent';
3
- import {
4
- addWhitelistedNativeProps,
5
- addWhitelistedUIProps,
6
- } from './ConfigHelper';
7
- import * as reanimated1 from './reanimated1';
8
- import ReanimatedComponents from './reanimated2/component';
9
-
10
- const Animated = {
11
- // components
12
- ...ReanimatedComponents,
13
- createAnimatedComponent,
14
- // configuration
15
- addWhitelistedNativeProps,
16
- addWhitelistedUIProps,
17
- // reanimated 1
18
- ...reanimated1,
19
- };
20
-
21
- export * from './reanimated2';
1
+ // tree-shaken side effects
2
+ import './reanimated2/js-reanimated/global';
3
+ // @ts-ignore backward compatibility with treeshaking
22
4
  export * from './reanimated1';
23
- export default Animated;
24
-
25
- // I think we can ignore this message as long as Gesture Handler doesn't
26
- // try to load the Reanimated module. I figured it should be here instead of
27
- // RNGH because this prevents the message from being displayed for all
28
- // versions of RNGH.
29
- LogBox.ignoreLogs([
30
- 'RCTBridge required dispatch_sync to load RNGestureHandlerModule. This may lead to deadlocks',
31
- ]);
5
+ export * from './reanimated2';
6
+ export * as default from './Animated';
@@ -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;
@@ -1,7 +1,7 @@
1
1
  import { NativeModules } from 'react-native';
2
2
  export class NativeReanimated {
3
3
  constructor(native = true) {
4
- if (global.__reanimatedModuleProxy === undefined) {
4
+ if (global.__reanimatedModuleProxy === undefined && native) {
5
5
  const { ReanimatedModule } = NativeModules;
6
6
  ReanimatedModule === null || ReanimatedModule === void 0 ? void 0 : ReanimatedModule.installTurboModule();
7
7
  }
@@ -43,9 +43,6 @@ export function withSequence(..._animations) {
43
43
  return false;
44
44
  }
45
45
  function onStart(animation, value, now, previousAnimation) {
46
- if (animations.length === 1) {
47
- throw Error('withSequence() animation require more than one animation as argument');
48
- }
49
46
  animation.animationIndex = 0;
50
47
  if (previousAnimation === undefined) {
51
48
  previousAnimation = animations[animations.length - 1];
@@ -11,14 +11,14 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from 'react';
13
13
  import { FlatList } from 'react-native';
14
- import WrappedComponents from './WrappedComponents';
14
+ import ReanimatedView from './View';
15
15
  import createAnimatedComponent from '../../createAnimatedComponent';
16
16
  const AnimatedFlatList = createAnimatedComponent(FlatList);
17
17
  const createCellRenderer = (itemLayoutAnimation) => {
18
18
  const cellRenderer = (props) => {
19
- return (<WrappedComponents.View layout={itemLayoutAnimation} onLayout={props.onLayout}>
19
+ return (<ReanimatedView layout={itemLayoutAnimation} onLayout={props.onLayout}>
20
20
  {props.children}
21
- </WrappedComponents.View>);
21
+ </ReanimatedView>);
22
22
  };
23
23
  return cellRenderer;
24
24
  };
@@ -0,0 +1,4 @@
1
+ import { Image } from 'react-native';
2
+ import createAnimatedComponent from '../../createAnimatedComponent';
3
+ const AnimatedImage = createAnimatedComponent(Image);
4
+ export default AnimatedImage;
@@ -0,0 +1,4 @@
1
+ import { ScrollView } from 'react-native';
2
+ import createAnimatedComponent from '../../createAnimatedComponent';
3
+ const AnimatedScrollView = createAnimatedComponent(ScrollView);
4
+ export default AnimatedScrollView;
@@ -0,0 +1,4 @@
1
+ import { Text } from 'react-native';
2
+ import createAnimatedComponent from '../../createAnimatedComponent';
3
+ const AnimatedText = createAnimatedComponent(Text);
4
+ export default AnimatedText;
@@ -0,0 +1,4 @@
1
+ import { View } from 'react-native';
2
+ import createAnimatedComponent from '../../createAnimatedComponent';
3
+ const AnimatedView = createAnimatedComponent(View);
4
+ export default AnimatedView;
@@ -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
  }
@@ -274,11 +238,6 @@ if (!isWeb() && isConfigured()) {
274
238
  info: runOnJS(capturableConsole.info),
275
239
  };
276
240
  _setGlobalConsole(console);
277
- if (global.performance == null) {
278
- global.performance = {
279
- now: global._chronoNow,
280
- }; // due to conflict with lib.dom.d.ts -> Performance
281
- }
282
241
  })();
283
242
  }
284
243
  let featuresConfig = {
@@ -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;
@@ -12,11 +12,6 @@ export function useEvent(handler, eventNames = [], rebuild = false) {
12
12
  else if (rebuild) {
13
13
  initRef.current.updateWorklet(handler);
14
14
  }
15
- useEffect(() => {
16
- return () => {
17
- initRef.current = null;
18
- };
19
- }, []);
20
15
  return initRef;
21
16
  }
22
17
  export function useHandler(handlers, dependencies) {
@@ -0,0 +1,25 @@
1
+ // In order to keep bundle size down, we treat this file as a polyfill for Web.
2
+ import { shouldBeUseWeb } from '../PlatformChecker';
3
+ if (shouldBeUseWeb()) {
4
+ global._frameTimestamp = null;
5
+ global._setGlobalConsole = (_val) => {
6
+ // noop
7
+ };
8
+ global._measure = () => {
9
+ console.warn("[Reanimated] You can't use `measure` with Chrome Debugger or with web version");
10
+ return {
11
+ x: 0,
12
+ y: 0,
13
+ width: 0,
14
+ height: 0,
15
+ pageX: 0,
16
+ pageY: 0,
17
+ };
18
+ };
19
+ global._scrollTo = () => {
20
+ console.warn("[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version");
21
+ };
22
+ global._setGestureState = () => {
23
+ console.warn("[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version");
24
+ };
25
+ }
@@ -1,29 +1,5 @@
1
1
  import JSReanimated from './JSReanimated';
2
- import { shouldBeUseWeb } from '../PlatformChecker';
3
2
  const reanimatedJS = new JSReanimated();
4
- if (shouldBeUseWeb()) {
5
- global._frameTimestamp = null;
6
- global._setGlobalConsole = (_val) => {
7
- // noop
8
- };
9
- global._measure = () => {
10
- console.warn("[Reanimated] You can't use `measure` with Chrome Debugger or with web version");
11
- return {
12
- x: 0,
13
- y: 0,
14
- width: 0,
15
- height: 0,
16
- pageX: 0,
17
- pageY: 0,
18
- };
19
- };
20
- global._scrollTo = () => {
21
- console.warn("[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version");
22
- };
23
- global._setGestureState = () => {
24
- console.warn("[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version");
25
- };
26
- }
27
3
  export const _updatePropsJS = (updates, viewRef) => {
28
4
  if (viewRef._component) {
29
5
  const component = viewRef._component;
@@ -64,6 +64,12 @@ const ReanimatedV2 = {
64
64
  out: ID,
65
65
  inOut: ID,
66
66
  },
67
+ Extrapolation: {
68
+ EXTEND: 'extend',
69
+ CLAMP: 'clamp',
70
+ IDENTITY: 'identity',
71
+ },
67
72
  runOnJS: (fn) => fn,
73
+ runOnUI: (fn) => fn,
68
74
  };
69
75
  module.exports = Object.assign({}, ReanimatedV2);
@@ -0,0 +1,8 @@
1
+ export { default as createAnimatedComponent } from './createAnimatedComponent';
2
+ export { addWhitelistedNativeProps, addWhitelistedUIProps, } from './ConfigHelper';
3
+ export { default as Text } from './reanimated2/component/Text';
4
+ export { default as View } from './reanimated2/component/View';
5
+ export { default as ScrollView } from './reanimated2/component/ScrollView';
6
+ export { default as Image } from './reanimated2/component/Image';
7
+ export { default as FlatList } from './reanimated2/component/FlatList';
8
+ export * from './reanimated1';
@@ -0,0 +1,4 @@
1
+ import './reanimated2/js-reanimated/global';
2
+ export * from './reanimated1';
3
+ export * from './reanimated2';
4
+ export * as default from './Animated';
@@ -17,7 +17,6 @@ export interface WorkletFunction {
17
17
  _closure?: Context;
18
18
  __workletHash?: number;
19
19
  __optimalization?: number;
20
- __worklet?: boolean;
21
20
  }
22
21
  export interface BasicWorkletFunction<T> extends WorkletFunction {
23
22
  (): T;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const AnimatedImage: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
3
+ export default AnimatedImage;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const AnimatedScrollView: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
3
+ export default AnimatedScrollView;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const AnimatedText: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
3
+ export default AnimatedText;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const AnimatedView: import("react").ComponentType<import("../../createAnimatedComponent").AnimatedComponentProps<import("../../createAnimatedComponent").InitialComponentProps>>;
3
+ export default AnimatedView;
@@ -13,8 +13,6 @@ export declare type AnimatedSensor = {
13
13
  sensor: SensorValue3D | SensorValueRotation | null;
14
14
  unregister: () => void;
15
15
  isAvailable: boolean;
16
- config: {
17
- interval: number;
18
- };
16
+ config: SensorConfig;
19
17
  };
20
18
  export declare function useAnimatedSensor(sensorType: SensorType, userConfig?: SensorConfig): AnimatedSensor;
@@ -51,5 +51,11 @@ declare const ReanimatedV2: {
51
51
  out: (t: any) => any;
52
52
  inOut: (t: any) => any;
53
53
  };
54
+ Extrapolation: {
55
+ EXTEND: string;
56
+ CLAMP: string;
57
+ IDENTITY: string;
58
+ };
54
59
  runOnJS: (fn: any) => any;
60
+ runOnUI: (fn: any) => any;
55
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "2.6.0",
3
+ "version": "2.9.0",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
6
  "start": "node node_modules/react-native/local-cli/cli.js start",
@@ -34,10 +34,10 @@
34
34
  "clean:deep": "cd android && rm -rf .cxx .gradle build && cd ../Example/android && rm -rf .gradle build app/build && cd ../.. && yarn clean",
35
35
  "reset:deep": "yarn clean:deep && yarn setup"
36
36
  },
37
- "main": "lib/Animated.js",
38
- "module": "lib/Animated",
39
- "react-native": "src/Animated",
40
- "source": "src/Animated",
37
+ "main": "lib/index.js",
38
+ "module": "lib/index",
39
+ "react-native": "src/index",
40
+ "source": "src/index",
41
41
  "types": "react-native-reanimated.d.ts",
42
42
  "files": [
43
43
  "Common/",
@@ -74,25 +74,24 @@
74
74
  },
75
75
  "homepage": "https://github.com/software-mansion/react-native-reanimated#readme",
76
76
  "dependencies": {
77
+ "@babel/plugin-proposal-export-namespace-from": "^7.17.12",
77
78
  "@babel/plugin-transform-object-assign": "^7.16.7",
79
+ "@babel/preset-typescript": "^7.16.7",
78
80
  "@types/invariant": "^2.2.35",
79
81
  "invariant": "^2.2.4",
80
82
  "lodash.isequal": "^4.5.0",
81
- "react-native-screens": "^3.11.1",
82
83
  "setimmediate": "^1.0.5",
83
84
  "string-hash-64": "^1.0.3"
84
85
  },
85
86
  "peerDependencies": {
86
- "@babel/preset-typescript": "*",
87
+ "@babel/core": "^7.0.0-0",
87
88
  "react": "*",
88
- "react-native": "*",
89
- "react-native-gesture-handler": "*"
89
+ "react-native": "*"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@babel/core": "^7.17.2",
93
93
  "@babel/plugin-proposal-class-properties": "^7.16.7",
94
94
  "@babel/preset-env": "^7.16.11",
95
- "@babel/preset-typescript": "^7.16.7",
96
95
  "@react-native-community/bob": "^0.17.1",
97
96
  "@react-native-community/eslint-config": "^0.0.5",
98
97
  "@testing-library/jest-native": "^4.0.4",
@@ -123,11 +122,11 @@
123
122
  "lint-staged": "^11.2.0",
124
123
  "madge": "^5.0.1",
125
124
  "prettier": "^2.5.1",
126
- "react": "17.0.2",
127
- "react-native": "0.68.0",
125
+ "react": "18.0.0",
126
+ "react-native": "0.69.1",
128
127
  "react-native-codegen": "^0.0.7",
129
128
  "react-native-gesture-handler": "^1.6.1",
130
- "react-test-renderer": "17.0.2",
129
+ "react-test-renderer": "18.0.0",
131
130
  "release-it": "^13.7.2",
132
131
  "typescript": "^4.1.3"
133
132
  },
@@ -156,5 +155,10 @@
156
155
  "commonjs",
157
156
  "module"
158
157
  ]
159
- }
158
+ },
159
+ "sideEffects": [
160
+ "./lib/reanimated2/core",
161
+ "./lib/reanimated2/js-reanimated/global",
162
+ "./lib/index"
163
+ ]
160
164
  }