react-native-reanimated 2.7.0 → 2.9.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.
- package/Common/cpp/Tools/RuntimeDecorator.cpp +17 -11
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/CMakeLists.txt +21 -8
- package/android/build.gradle +23 -8
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/react-native-reanimated-69-hermes.aar +0 -0
- package/android/react-native-reanimated-69-jsc.aar +0 -0
- package/android/rnVersionPatch/69/.gitkeep +0 -0
- package/android/src/main/cpp/NativeProxy.cpp +35 -14
- package/android/src/main/cpp/headers/NativeProxy.h +2 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +24 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +7 -5
- package/ios/native/NativeProxy.mm +6 -2
- package/ios/native/REAInitializer.mm +11 -1
- package/ios/sensor/ReanimatedSensor.m +2 -2
- package/lib/Animated.js +8 -30
- package/lib/index.js +5 -30
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +1 -1
- package/lib/reanimated2/animation/sequence.js +0 -3
- package/lib/reanimated2/component/FlatList.js +3 -3
- package/lib/reanimated2/component/Image.js +4 -0
- package/lib/reanimated2/component/ScrollView.js +4 -0
- package/lib/reanimated2/component/Text.js +4 -0
- package/lib/reanimated2/component/View.js +4 -0
- package/lib/reanimated2/core.js +0 -5
- package/lib/reanimated2/hook/utils.js +0 -5
- package/lib/reanimated2/js-reanimated/global.js +25 -0
- package/lib/reanimated2/js-reanimated/index.js +0 -24
- package/lib/reanimated2/mock.js +6 -0
- package/lib/types/lib/Animated.d.ts +8 -0
- package/lib/types/lib/index.d.ts +4 -0
- package/lib/types/lib/reanimated2/component/Image.d.ts +3 -0
- package/lib/types/lib/reanimated2/component/ScrollView.d.ts +3 -0
- package/lib/types/lib/reanimated2/component/Text.d.ts +3 -0
- package/lib/types/lib/reanimated2/component/View.d.ts +3 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +1 -3
- package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +1 -0
- package/lib/types/lib/reanimated2/mock.d.ts +6 -0
- package/package.json +15 -9
- package/plugin.js +36 -21
- package/react-native-reanimated.d.ts +16 -7
- package/src/Animated.ts +13 -0
- package/src/index.ts +7 -0
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +1 -1
- package/src/reanimated2/animation/sequence.ts +0 -5
- package/src/reanimated2/component/FlatList.tsx +3 -6
- package/src/reanimated2/component/Image.ts +6 -0
- package/src/reanimated2/component/ScrollView.ts +6 -0
- package/src/reanimated2/component/Text.ts +6 -0
- package/src/reanimated2/component/View.ts +6 -0
- package/src/reanimated2/core.ts +0 -5
- package/src/reanimated2/hook/useAnimatedSensor.ts +1 -3
- package/src/reanimated2/hook/utils.ts +0 -6
- package/src/reanimated2/js-reanimated/global.ts +33 -0
- package/src/reanimated2/js-reanimated/index.ts +0 -31
- package/src/reanimated2/mock.ts +6 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/lib/reanimated2/component/WrappedComponents.js +0 -9
- package/lib/reanimated2/component/index.js +0 -4
- package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +0 -8
- package/lib/types/lib/reanimated2/component/index.d.ts +0 -9
- package/src/Animated.js +0 -31
- package/src/reanimated2/component/WrappedComponents.ts +0 -11
- package/src/reanimated2/component/index.ts +0 -9
|
@@ -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;
|
package/lib/reanimated2/mock.js
CHANGED
|
@@ -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';
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.1",
|
|
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/
|
|
38
|
-
"module": "lib/
|
|
39
|
-
"react-native": "src/
|
|
40
|
-
"source": "src/
|
|
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,6 +74,7 @@
|
|
|
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",
|
|
78
79
|
"@babel/preset-typescript": "^7.16.7",
|
|
79
80
|
"@types/invariant": "^2.2.35",
|
|
@@ -121,11 +122,11 @@
|
|
|
121
122
|
"lint-staged": "^11.2.0",
|
|
122
123
|
"madge": "^5.0.1",
|
|
123
124
|
"prettier": "^2.5.1",
|
|
124
|
-
"react": "
|
|
125
|
-
"react-native": "0.
|
|
125
|
+
"react": "18.0.0",
|
|
126
|
+
"react-native": "0.69.1",
|
|
126
127
|
"react-native-codegen": "^0.0.7",
|
|
127
128
|
"react-native-gesture-handler": "^1.6.1",
|
|
128
|
-
"react-test-renderer": "
|
|
129
|
+
"react-test-renderer": "18.0.0",
|
|
129
130
|
"release-it": "^13.7.2",
|
|
130
131
|
"typescript": "^4.1.3"
|
|
131
132
|
},
|
|
@@ -154,5 +155,10 @@
|
|
|
154
155
|
"commonjs",
|
|
155
156
|
"module"
|
|
156
157
|
]
|
|
157
|
-
}
|
|
158
|
+
},
|
|
159
|
+
"sideEffects": [
|
|
160
|
+
"./lib/reanimated2/core",
|
|
161
|
+
"./lib/reanimated2/js-reanimated/global",
|
|
162
|
+
"./lib/index"
|
|
163
|
+
]
|
|
158
164
|
}
|
package/plugin.js
CHANGED
|
@@ -14,7 +14,6 @@ const functionArgsToWorkletize = new Map([
|
|
|
14
14
|
['useAnimatedScrollHandler', [0]],
|
|
15
15
|
['useAnimatedReaction', [0, 1]],
|
|
16
16
|
['useWorkletCallback', [0]],
|
|
17
|
-
['createWorklet', [0]],
|
|
18
17
|
// animations' callbacks
|
|
19
18
|
['withTiming', [2]],
|
|
20
19
|
['withSpring', [2]],
|
|
@@ -331,7 +330,7 @@ function makeWorkletName(t, fun) {
|
|
|
331
330
|
return '_f'; // fallback for ArrowFunctionExpression and unnamed FunctionExpression
|
|
332
331
|
}
|
|
333
332
|
|
|
334
|
-
function makeWorklet(t, fun,
|
|
333
|
+
function makeWorklet(t, fun, state) {
|
|
335
334
|
// Returns a new FunctionExpression which is a workletized version of provided
|
|
336
335
|
// FunctionDeclaration, FunctionExpression, ArrowFunctionExpression or ObjectMethod.
|
|
337
336
|
|
|
@@ -358,7 +357,7 @@ function makeWorklet(t, fun, fileName) {
|
|
|
358
357
|
'\n(' + (t.isObjectMethod(fun) ? 'function ' : '') + fun.toString() + '\n)';
|
|
359
358
|
|
|
360
359
|
const transformed = transformSync(code, {
|
|
361
|
-
filename:
|
|
360
|
+
filename: state.file.opts.filename,
|
|
362
361
|
presets: ['@babel/preset-typescript'],
|
|
363
362
|
plugins: [
|
|
364
363
|
'@babel/plugin-transform-shorthand-properties',
|
|
@@ -445,11 +444,17 @@ function makeWorklet(t, fun, fileName) {
|
|
|
445
444
|
);
|
|
446
445
|
const workletHash = hash(funString);
|
|
447
446
|
|
|
447
|
+
let location = state.file.opts.filename;
|
|
448
|
+
if (state.opts.relativeSourceLocation) {
|
|
449
|
+
const path = require('path');
|
|
450
|
+
location = path.relative(state.cwd, location);
|
|
451
|
+
}
|
|
452
|
+
|
|
448
453
|
const loc = fun && fun.node && fun.node.loc && fun.node.loc.start;
|
|
449
454
|
if (loc) {
|
|
450
455
|
const { line, column } = loc;
|
|
451
456
|
if (typeof line === 'number' && typeof column === 'number') {
|
|
452
|
-
|
|
457
|
+
location = `${location} (${line}:${column})`;
|
|
453
458
|
}
|
|
454
459
|
}
|
|
455
460
|
|
|
@@ -490,7 +495,7 @@ function makeWorklet(t, fun, fileName) {
|
|
|
490
495
|
t.identifier('__location'),
|
|
491
496
|
false
|
|
492
497
|
),
|
|
493
|
-
t.stringLiteral(
|
|
498
|
+
t.stringLiteral(location)
|
|
494
499
|
)
|
|
495
500
|
),
|
|
496
501
|
];
|
|
@@ -518,7 +523,7 @@ function makeWorklet(t, fun, fileName) {
|
|
|
518
523
|
return newFun;
|
|
519
524
|
}
|
|
520
525
|
|
|
521
|
-
function processWorkletFunction(t, fun,
|
|
526
|
+
function processWorkletFunction(t, fun, state) {
|
|
522
527
|
// Replaces FunctionDeclaration, FunctionExpression or ArrowFunctionExpression
|
|
523
528
|
// with a workletized version of itself.
|
|
524
529
|
|
|
@@ -526,7 +531,7 @@ function processWorkletFunction(t, fun, fileName) {
|
|
|
526
531
|
return;
|
|
527
532
|
}
|
|
528
533
|
|
|
529
|
-
const newFun = makeWorklet(t, fun,
|
|
534
|
+
const newFun = makeWorklet(t, fun, state);
|
|
530
535
|
|
|
531
536
|
const replacement = t.callExpression(newFun, []);
|
|
532
537
|
|
|
@@ -546,14 +551,14 @@ function processWorkletFunction(t, fun, fileName) {
|
|
|
546
551
|
);
|
|
547
552
|
}
|
|
548
553
|
|
|
549
|
-
function processWorkletObjectMethod(t, path,
|
|
554
|
+
function processWorkletObjectMethod(t, path, state) {
|
|
550
555
|
// Replaces ObjectMethod with a workletized version of itself.
|
|
551
556
|
|
|
552
557
|
if (!t.isFunctionParent(path)) {
|
|
553
558
|
return;
|
|
554
559
|
}
|
|
555
560
|
|
|
556
|
-
const newFun = makeWorklet(t, path,
|
|
561
|
+
const newFun = makeWorklet(t, path, state);
|
|
557
562
|
|
|
558
563
|
const replacement = t.objectProperty(
|
|
559
564
|
t.identifier(path.node.key.name),
|
|
@@ -563,7 +568,7 @@ function processWorkletObjectMethod(t, path, fileName) {
|
|
|
563
568
|
path.replaceWith(replacement);
|
|
564
569
|
}
|
|
565
570
|
|
|
566
|
-
function processIfWorkletNode(t, fun,
|
|
571
|
+
function processIfWorkletNode(t, fun, state) {
|
|
567
572
|
fun.traverse({
|
|
568
573
|
DirectiveLiteral(path) {
|
|
569
574
|
const value = path.node.value;
|
|
@@ -581,14 +586,14 @@ function processIfWorkletNode(t, fun, fileName) {
|
|
|
581
586
|
directive.value.value === 'worklet'
|
|
582
587
|
)
|
|
583
588
|
) {
|
|
584
|
-
processWorkletFunction(t, fun,
|
|
589
|
+
processWorkletFunction(t, fun, state);
|
|
585
590
|
}
|
|
586
591
|
}
|
|
587
592
|
},
|
|
588
593
|
});
|
|
589
594
|
}
|
|
590
595
|
|
|
591
|
-
function processIfGestureHandlerEventCallbackFunctionNode(t, fun,
|
|
596
|
+
function processIfGestureHandlerEventCallbackFunctionNode(t, fun, state) {
|
|
592
597
|
// Auto-workletizes React Native Gesture Handler callback functions.
|
|
593
598
|
// Detects `Gesture.Tap().onEnd(<fun>)` or similar, but skips `something.onEnd(<fun>)`.
|
|
594
599
|
// Supports method chaining as well, e.g. `Gesture.Tap().onStart(<fun1>).onUpdate(<fun2>).onEnd(<fun3>)`.
|
|
@@ -641,7 +646,7 @@ function processIfGestureHandlerEventCallbackFunctionNode(t, fun, fileName) {
|
|
|
641
646
|
t.isCallExpression(fun.parent) &&
|
|
642
647
|
isGestureObjectEventCallbackMethod(t, fun.parent.callee)
|
|
643
648
|
) {
|
|
644
|
-
processWorkletFunction(t, fun,
|
|
649
|
+
processWorkletFunction(t, fun, state);
|
|
645
650
|
}
|
|
646
651
|
}
|
|
647
652
|
|
|
@@ -697,7 +702,7 @@ function isGestureObject(t, node) {
|
|
|
697
702
|
);
|
|
698
703
|
}
|
|
699
704
|
|
|
700
|
-
function processWorklets(t, path,
|
|
705
|
+
function processWorklets(t, path, state) {
|
|
701
706
|
const name =
|
|
702
707
|
path.node.callee.type === 'MemberExpression'
|
|
703
708
|
? path.node.callee.property.name
|
|
@@ -709,17 +714,17 @@ function processWorklets(t, path, fileName) {
|
|
|
709
714
|
const properties = path.get('arguments.0.properties');
|
|
710
715
|
for (const property of properties) {
|
|
711
716
|
if (t.isObjectMethod(property)) {
|
|
712
|
-
processWorkletObjectMethod(t, property,
|
|
717
|
+
processWorkletObjectMethod(t, property, state);
|
|
713
718
|
} else {
|
|
714
719
|
const value = property.get('value');
|
|
715
|
-
processWorkletFunction(t, value,
|
|
720
|
+
processWorkletFunction(t, value, state);
|
|
716
721
|
}
|
|
717
722
|
}
|
|
718
723
|
} else {
|
|
719
724
|
const indexes = functionArgsToWorkletize.get(name);
|
|
720
725
|
if (Array.isArray(indexes)) {
|
|
721
726
|
indexes.forEach((index) => {
|
|
722
|
-
processWorkletFunction(t, path.get(`arguments.${index}`),
|
|
727
|
+
processWorkletFunction(t, path.get(`arguments.${index}`), state);
|
|
723
728
|
});
|
|
724
729
|
}
|
|
725
730
|
}
|
|
@@ -751,6 +756,16 @@ function isPossibleOptimization(fun) {
|
|
|
751
756
|
return flags;
|
|
752
757
|
}
|
|
753
758
|
|
|
759
|
+
const pluginProposalExportNamespaceFrom =
|
|
760
|
+
require('@babel/plugin-proposal-export-namespace-from').default;
|
|
761
|
+
const apiMock = {
|
|
762
|
+
assertVersion: () => {
|
|
763
|
+
// do nothing.
|
|
764
|
+
},
|
|
765
|
+
};
|
|
766
|
+
const ExportNamedDeclarationFn =
|
|
767
|
+
pluginProposalExportNamespaceFrom(apiMock).visitor.ExportNamedDeclaration;
|
|
768
|
+
|
|
754
769
|
module.exports = function ({ types: t }) {
|
|
755
770
|
return {
|
|
756
771
|
pre() {
|
|
@@ -764,16 +779,16 @@ module.exports = function ({ types: t }) {
|
|
|
764
779
|
visitor: {
|
|
765
780
|
CallExpression: {
|
|
766
781
|
enter(path, state) {
|
|
767
|
-
processWorklets(t, path, state
|
|
782
|
+
processWorklets(t, path, state);
|
|
768
783
|
},
|
|
769
784
|
},
|
|
770
785
|
'FunctionDeclaration|FunctionExpression|ArrowFunctionExpression': {
|
|
771
786
|
enter(path, state) {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
processIfGestureHandlerEventCallbackFunctionNode(t, path, fileName);
|
|
787
|
+
processIfWorkletNode(t, path, state);
|
|
788
|
+
processIfGestureHandlerEventCallbackFunctionNode(t, path, state);
|
|
775
789
|
},
|
|
776
790
|
},
|
|
791
|
+
ExportNamedDeclaration: ExportNamedDeclarationFn,
|
|
777
792
|
},
|
|
778
793
|
};
|
|
779
794
|
};
|
|
@@ -156,7 +156,7 @@ declare module 'react-native-reanimated' {
|
|
|
156
156
|
: Record<string, unknown>;
|
|
157
157
|
|
|
158
158
|
export type AnimateProps<P extends object> = {
|
|
159
|
-
[K in keyof P]: P[K] | AnimatedNode<P[K]>;
|
|
159
|
+
[K in keyof Omit<P, 'style'>]: P[K] | AnimatedNode<P[K]>;
|
|
160
160
|
} & {
|
|
161
161
|
style?: StyleProp<AnimateStyle<StylesOrDefault<P>>>;
|
|
162
162
|
} & {
|
|
@@ -498,10 +498,17 @@ declare module 'react-native-reanimated' {
|
|
|
498
498
|
interval: number;
|
|
499
499
|
};
|
|
500
500
|
|
|
501
|
+
export type AnimatedSensor = {
|
|
502
|
+
sensor: SensorValue3D | SensorValueRotation | null;
|
|
503
|
+
unregister: () => void;
|
|
504
|
+
isAvailable: boolean;
|
|
505
|
+
config: SensorConfig;
|
|
506
|
+
};
|
|
507
|
+
|
|
501
508
|
export function useAnimatedSensor(
|
|
502
509
|
sensorType: SensorType,
|
|
503
510
|
userConfig?: SensorConfig
|
|
504
|
-
);
|
|
511
|
+
): AnimatedSensor;
|
|
505
512
|
|
|
506
513
|
export interface ExitAnimationsValues {
|
|
507
514
|
currentOriginX: number;
|
|
@@ -614,14 +621,19 @@ declare module 'react-native-reanimated' {
|
|
|
614
621
|
callback?: AnimationCallback
|
|
615
622
|
): number;
|
|
616
623
|
export function cancelAnimation<T>(sharedValue: SharedValue<T>): void;
|
|
617
|
-
export function withDelay<T extends AnimatableValue>(
|
|
624
|
+
export function withDelay<T extends AnimatableValue>(
|
|
625
|
+
delayMS: number,
|
|
626
|
+
delayedAnimation: T
|
|
627
|
+
): T;
|
|
618
628
|
export function withRepeat<T extends AnimatableValue>(
|
|
619
629
|
animation: T,
|
|
620
630
|
numberOfReps?: number,
|
|
621
631
|
reverse?: boolean,
|
|
622
632
|
callback?: AnimationCallback
|
|
623
633
|
): T;
|
|
624
|
-
export function withSequence<T extends AnimatableValue>(
|
|
634
|
+
export function withSequence<T extends AnimatableValue>(
|
|
635
|
+
...animations: [T, ...T[]]
|
|
636
|
+
): T;
|
|
625
637
|
|
|
626
638
|
// reanimated2 functions
|
|
627
639
|
export function runOnUI<A extends any[], R>(
|
|
@@ -638,9 +650,6 @@ declare module 'react-native-reanimated' {
|
|
|
638
650
|
): PropsAdapterFunction;
|
|
639
651
|
|
|
640
652
|
export function processColor(color: number | string): number;
|
|
641
|
-
export function createWorklet<A extends any[], R>(
|
|
642
|
-
fn: (...args: A) => R
|
|
643
|
-
): (...args: Parameters<typeof fn>) => R;
|
|
644
653
|
|
|
645
654
|
export function interpolateColor<T extends string | number>(
|
|
646
655
|
value: number,
|
package/src/Animated.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as createAnimatedComponent } from './createAnimatedComponent';
|
|
2
|
+
export {
|
|
3
|
+
addWhitelistedNativeProps,
|
|
4
|
+
addWhitelistedUIProps,
|
|
5
|
+
} from './ConfigHelper';
|
|
6
|
+
|
|
7
|
+
export { default as Text } from './reanimated2/component/Text';
|
|
8
|
+
export { default as View } from './reanimated2/component/View';
|
|
9
|
+
export { default as ScrollView } from './reanimated2/component/ScrollView';
|
|
10
|
+
export { default as Image } from './reanimated2/component/Image';
|
|
11
|
+
export { default as FlatList } from './reanimated2/component/FlatList';
|
|
12
|
+
// @ts-ignore backward compatibility with treeshaking
|
|
13
|
+
export * from './reanimated1';
|
package/src/index.ts
ADDED
|
@@ -11,7 +11,7 @@ export class NativeReanimated {
|
|
|
11
11
|
private InnerNativeModule: any;
|
|
12
12
|
|
|
13
13
|
constructor(native = true) {
|
|
14
|
-
if (global.__reanimatedModuleProxy === undefined) {
|
|
14
|
+
if (global.__reanimatedModuleProxy === undefined && native) {
|
|
15
15
|
const { ReanimatedModule } = NativeModules;
|
|
16
16
|
ReanimatedModule?.installTurboModule();
|
|
17
17
|
}
|
|
@@ -63,11 +63,6 @@ export function withSequence(
|
|
|
63
63
|
now: Timestamp,
|
|
64
64
|
previousAnimation: SequenceAnimation
|
|
65
65
|
): void {
|
|
66
|
-
if (animations.length === 1) {
|
|
67
|
-
throw Error(
|
|
68
|
-
'withSequence() animation require more than one animation as argument'
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
66
|
animation.animationIndex = 0;
|
|
72
67
|
if (previousAnimation === undefined) {
|
|
73
68
|
previousAnimation = animations[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlatList, FlatListProps, LayoutChangeEvent } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import ReanimatedView from './View';
|
|
4
4
|
import createAnimatedComponent from '../../createAnimatedComponent';
|
|
5
5
|
import { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/commonTypes';
|
|
6
6
|
|
|
@@ -11,12 +11,9 @@ const createCellRenderer = (itemLayoutAnimation?: ILayoutAnimationBuilder) => {
|
|
|
11
11
|
onLayout: (event: LayoutChangeEvent) => void;
|
|
12
12
|
}> = (props) => {
|
|
13
13
|
return (
|
|
14
|
-
<
|
|
15
|
-
layout={itemLayoutAnimation}
|
|
16
|
-
onLayout={props.onLayout}
|
|
17
|
-
>
|
|
14
|
+
<ReanimatedView layout={itemLayoutAnimation} onLayout={props.onLayout}>
|
|
18
15
|
{props.children}
|
|
19
|
-
</
|
|
16
|
+
</ReanimatedView>
|
|
20
17
|
);
|
|
21
18
|
};
|
|
22
19
|
|
package/src/reanimated2/core.ts
CHANGED
|
@@ -333,11 +333,6 @@ if (!isWeb() && isConfigured()) {
|
|
|
333
333
|
info: runOnJS(capturableConsole.info),
|
|
334
334
|
};
|
|
335
335
|
_setGlobalConsole(console);
|
|
336
|
-
if (global.performance == null) {
|
|
337
|
-
global.performance = {
|
|
338
|
-
now: global._chronoNow,
|
|
339
|
-
} as any; // due to conflict with lib.dom.d.ts -> Performance
|
|
340
|
-
}
|
|
341
336
|
})();
|
|
342
337
|
}
|
|
343
338
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// In order to keep bundle size down, we treat this file as a polyfill for Web.
|
|
2
|
+
|
|
3
|
+
import { shouldBeUseWeb } from '../PlatformChecker';
|
|
4
|
+
|
|
5
|
+
if (shouldBeUseWeb()) {
|
|
6
|
+
global._frameTimestamp = null;
|
|
7
|
+
global._setGlobalConsole = (_val) => {
|
|
8
|
+
// noop
|
|
9
|
+
};
|
|
10
|
+
global._measure = () => {
|
|
11
|
+
console.warn(
|
|
12
|
+
"[Reanimated] You can't use `measure` with Chrome Debugger or with web version"
|
|
13
|
+
);
|
|
14
|
+
return {
|
|
15
|
+
x: 0,
|
|
16
|
+
y: 0,
|
|
17
|
+
width: 0,
|
|
18
|
+
height: 0,
|
|
19
|
+
pageX: 0,
|
|
20
|
+
pageY: 0,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
global._scrollTo = () => {
|
|
24
|
+
console.warn(
|
|
25
|
+
"[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version"
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
global._setGestureState = () => {
|
|
29
|
+
console.warn(
|
|
30
|
+
"[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version"
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import JSReanimated from './JSReanimated';
|
|
2
|
-
import { shouldBeUseWeb } from '../PlatformChecker';
|
|
3
2
|
import { AnimatedStyle, StyleProps } from '../commonTypes';
|
|
4
3
|
|
|
5
4
|
const reanimatedJS = new JSReanimated();
|
|
@@ -13,36 +12,6 @@ interface JSReanimatedComponent {
|
|
|
13
12
|
};
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
if (shouldBeUseWeb()) {
|
|
17
|
-
global._frameTimestamp = null;
|
|
18
|
-
global._setGlobalConsole = (_val) => {
|
|
19
|
-
// noop
|
|
20
|
-
};
|
|
21
|
-
global._measure = () => {
|
|
22
|
-
console.warn(
|
|
23
|
-
"[Reanimated] You can't use `measure` with Chrome Debugger or with web version"
|
|
24
|
-
);
|
|
25
|
-
return {
|
|
26
|
-
x: 0,
|
|
27
|
-
y: 0,
|
|
28
|
-
width: 0,
|
|
29
|
-
height: 0,
|
|
30
|
-
pageX: 0,
|
|
31
|
-
pageY: 0,
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
global._scrollTo = () => {
|
|
35
|
-
console.warn(
|
|
36
|
-
"[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version"
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
global._setGestureState = () => {
|
|
40
|
-
console.warn(
|
|
41
|
-
"[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version"
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
15
|
export const _updatePropsJS = (
|
|
47
16
|
updates: StyleProps | AnimatedStyle,
|
|
48
17
|
viewRef: { _component?: JSReanimatedComponent }
|
package/src/reanimated2/mock.ts
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Image, ScrollView, Text, View } from 'react-native';
|
|
2
|
-
import createAnimatedComponent from '../../createAnimatedComponent';
|
|
3
|
-
const WrappedComponents = {
|
|
4
|
-
View: createAnimatedComponent(View),
|
|
5
|
-
Text: createAnimatedComponent(Text),
|
|
6
|
-
Image: createAnimatedComponent(Image),
|
|
7
|
-
ScrollView: createAnimatedComponent(ScrollView),
|
|
8
|
-
};
|
|
9
|
-
export default WrappedComponents;
|