react-native-reanimated 3.0.0-rc.7 → 3.0.0-rc.8
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/AnimatedSensor/AnimatedSensorModule.cpp +32 -37
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +4 -3
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +161 -165
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +36 -34
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +22 -34
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +13 -14
- package/Common/cpp/SharedItems/RuntimeManager.h +1 -34
- package/Common/cpp/SharedItems/Shareables.cpp +142 -0
- package/Common/cpp/SharedItems/Shareables.h +455 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +54 -26
- package/Common/cpp/Tools/RuntimeDecorator.h +11 -2
- package/Common/cpp/Tools/Scheduler.cpp +10 -0
- package/Common/cpp/Tools/SingleInstanceChecker.h +1 -1
- package/android/src/main/cpp/LayoutAnimations.cpp +6 -16
- package/android/src/main/cpp/LayoutAnimations.h +4 -4
- package/android/src/main/cpp/NativeProxy.cpp +50 -63
- package/ios/native/NativeProxy.mm +26 -42
- package/lib/commonjs/createAnimatedComponent.js +7 -11
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +27 -55
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -3
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +7 -0
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +111 -209
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +15 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +18 -8
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +27 -36
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +24 -50
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +8 -33
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +16 -100
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +5 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +91 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +186 -0
- package/lib/commonjs/reanimated2/mappers.js.map +1 -0
- package/lib/commonjs/reanimated2/mutables.js +173 -0
- package/lib/commonjs/reanimated2/mutables.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +153 -0
- package/lib/commonjs/reanimated2/shareables.js.map +1 -0
- package/lib/commonjs/reanimated2/threads.js +58 -0
- package/lib/commonjs/reanimated2/threads.js.map +1 -0
- package/lib/commonjs/reanimated2/time.js +55 -0
- package/lib/commonjs/reanimated2/time.js.map +1 -0
- package/lib/commonjs/reanimated2/valueSetter.js +81 -0
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
- package/lib/module/createAnimatedComponent.js +7 -12
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +24 -25
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +27 -53
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +4 -3
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +7 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/core.js +66 -188
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +16 -6
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +17 -8
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +29 -34
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +26 -52
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +8 -31
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +16 -95
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +5 -0
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +84 -0
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/index.js +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +173 -0
- package/lib/module/reanimated2/mappers.js.map +1 -0
- package/lib/module/reanimated2/mutables.js +149 -0
- package/lib/module/reanimated2/mutables.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +133 -0
- package/lib/module/reanimated2/shareables.js.map +1 -0
- package/lib/module/reanimated2/threads.js +45 -0
- package/lib/module/reanimated2/threads.js.map +1 -0
- package/lib/module/reanimated2/time.js +37 -0
- package/lib/module/reanimated2/time.js.map +1 -0
- package/lib/module/reanimated2/valueSetter.js +66 -0
- package/lib/module/reanimated2/valueSetter.js.map +1 -0
- package/package.json +1 -1
- package/plugin.js +31 -15
- package/src/createAnimatedComponent.tsx +8 -24
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +34 -53
- package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
- package/src/reanimated2/WorkletEventHandler.ts +4 -11
- package/src/reanimated2/animation/util.ts +1 -0
- package/src/reanimated2/commonTypes.ts +29 -4
- package/src/reanimated2/core.ts +103 -230
- package/src/reanimated2/globals.d.ts +26 -26
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +18 -9
- package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
- package/src/reanimated2/hook/useAnimatedSensor.ts +33 -31
- package/src/reanimated2/hook/useAnimatedStyle.ts +26 -64
- package/src/reanimated2/hook/useSharedValue.ts +6 -3
- package/src/reanimated2/hook/utils.ts +1 -1
- package/src/reanimated2/interpolateColor.ts +2 -2
- package/src/reanimated2/jestUtils.ts +14 -29
- package/src/reanimated2/js-reanimated/JSReanimated.ts +19 -93
- package/src/reanimated2/js-reanimated/index.ts +4 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +7 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/animationsManager.ts +94 -0
- package/src/reanimated2/layoutReanimation/index.ts +1 -1
- package/src/reanimated2/mappers.ts +179 -0
- package/src/reanimated2/mutables.ts +151 -0
- package/src/reanimated2/shareables.ts +121 -0
- package/src/reanimated2/threads.ts +46 -0
- package/src/reanimated2/time.ts +30 -0
- package/src/reanimated2/valueSetter.ts +64 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -127
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +0 -56
- package/Common/cpp/Registries/MapperRegistry.cpp +0 -147
- package/Common/cpp/Registries/MapperRegistry.h +0 -29
- package/Common/cpp/Registries/WorkletsCache.cpp +0 -45
- package/Common/cpp/Registries/WorkletsCache.h +0 -24
- package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
- package/Common/cpp/SharedItems/FrozenObject.h +0 -36
- package/Common/cpp/SharedItems/HostFunctionHandler.h +0 -28
- package/Common/cpp/SharedItems/MutableValue.cpp +0 -134
- package/Common/cpp/SharedItems/MutableValue.h +0 -54
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
- package/Common/cpp/SharedItems/MutableValueSetterProxy.h +0 -25
- package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
- package/Common/cpp/SharedItems/RemoteObject.h +0 -35
- package/Common/cpp/SharedItems/ShareableValue.cpp +0 -529
- package/Common/cpp/SharedItems/ShareableValue.h +0 -63
- package/Common/cpp/SharedItems/ValueWrapper.h +0 -183
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
- package/Common/cpp/Tools/JSIStoreValueUser.h +0 -37
- package/Common/cpp/Tools/Mapper.cpp +0 -86
- package/Common/cpp/Tools/Mapper.h +0 -51
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -58
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -52
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -49
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTimestamp = getTimestamp;
|
|
7
|
+
Object.defineProperty(exports, "stopMapper", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _mappers.stopMapper;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
var _NativeReanimated = _interopRequireDefault(require("./NativeReanimated"));
|
|
15
|
+
|
|
16
|
+
var _reactNative = require("react-native");
|
|
17
|
+
|
|
18
|
+
var _PlatformChecker = require("./PlatformChecker");
|
|
19
|
+
|
|
20
|
+
var _mappers = require("./mappers");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
let _getTimestamp;
|
|
25
|
+
|
|
26
|
+
if ((0, _PlatformChecker.nativeShouldBeMock)()) {
|
|
27
|
+
_getTimestamp = () => {
|
|
28
|
+
return _NativeReanimated.default.getTimestamp();
|
|
29
|
+
};
|
|
30
|
+
} else {
|
|
31
|
+
_getTimestamp = () => {
|
|
32
|
+
'worklet';
|
|
33
|
+
|
|
34
|
+
if (_frameTimestamp) {
|
|
35
|
+
return _frameTimestamp;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (_eventTimestamp) {
|
|
39
|
+
return _eventTimestamp;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return _getCurrentTime();
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getTimestamp() {
|
|
47
|
+
'worklet';
|
|
48
|
+
|
|
49
|
+
if (_reactNative.Platform.OS === 'web') {
|
|
50
|
+
return _NativeReanimated.default.getTimestamp();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return _getTimestamp();
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_getTimestamp","nativeShouldBeMock","NativeReanimatedModule","getTimestamp","_frameTimestamp","_eventTimestamp","_getCurrentTime","Platform","OS"],"sources":["time.ts"],"sourcesContent":["import NativeReanimatedModule from './NativeReanimated';\nimport { Platform } from 'react-native';\nimport { nativeShouldBeMock } from './PlatformChecker';\nexport { stopMapper } from './mappers';\n\nlet _getTimestamp: () => number;\nif (nativeShouldBeMock()) {\n _getTimestamp = () => {\n return NativeReanimatedModule.getTimestamp();\n };\n} else {\n _getTimestamp = () => {\n 'worklet';\n if (_frameTimestamp) {\n return _frameTimestamp;\n }\n if (_eventTimestamp) {\n return _eventTimestamp;\n }\n return _getCurrentTime();\n };\n}\n\nexport function getTimestamp(): number {\n 'worklet';\n if (Platform.OS === 'web') {\n return NativeReanimatedModule.getTimestamp();\n }\n return _getTimestamp();\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,IAAIA,aAAJ;;AACA,IAAI,IAAAC,mCAAA,GAAJ,EAA0B;EACxBD,aAAa,GAAG,MAAM;IACpB,OAAOE,yBAAA,CAAuBC,YAAvB,EAAP;EACD,CAFD;AAGD,CAJD,MAIO;EACLH,aAAa,GAAG,MAAM;IACpB;;IACA,IAAII,eAAJ,EAAqB;MACnB,OAAOA,eAAP;IACD;;IACD,IAAIC,eAAJ,EAAqB;MACnB,OAAOA,eAAP;IACD;;IACD,OAAOC,eAAe,EAAtB;EACD,CATD;AAUD;;AAEM,SAASH,YAAT,GAAgC;EACrC;;EACA,IAAII,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;IACzB,OAAON,yBAAA,CAAuBC,YAAvB,EAAP;EACD;;EACD,OAAOH,aAAa,EAApB;AACD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "stopMapper", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _mappers.stopMapper;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.valueSetter = valueSetter;
|
|
13
|
+
|
|
14
|
+
var _time = require("./time");
|
|
15
|
+
|
|
16
|
+
var _mappers = require("./mappers");
|
|
17
|
+
|
|
18
|
+
function valueSetter(sv, value) {
|
|
19
|
+
'worklet';
|
|
20
|
+
|
|
21
|
+
const previousAnimation = sv._animation;
|
|
22
|
+
|
|
23
|
+
if (previousAnimation) {
|
|
24
|
+
previousAnimation.cancelled = true;
|
|
25
|
+
sv._animation = null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (typeof value === 'function' || value !== null && typeof value === 'object' && value.onFrame !== undefined) {
|
|
29
|
+
const animation = typeof value === 'function' ? value() : value; // prevent setting again to the same value
|
|
30
|
+
// and triggering the mappers that treat this value as an input
|
|
31
|
+
// this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)
|
|
32
|
+
// built in animations that are not higher order(withTiming, withSpring) hold target value in .current
|
|
33
|
+
|
|
34
|
+
if (sv._value === animation.current && !animation.isHigherOrder) {
|
|
35
|
+
animation.callback && animation.callback(true);
|
|
36
|
+
return;
|
|
37
|
+
} // animated set
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const initializeAnimation = timestamp => {
|
|
41
|
+
animation.onStart(animation, sv.value, timestamp, previousAnimation);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const currentTimestamp = (0, _time.getTimestamp)();
|
|
45
|
+
initializeAnimation(currentTimestamp);
|
|
46
|
+
|
|
47
|
+
const step = timestamp => {
|
|
48
|
+
if (animation.cancelled) {
|
|
49
|
+
animation.callback && animation.callback(false
|
|
50
|
+
/* finished */
|
|
51
|
+
);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const finished = animation.onFrame(animation, timestamp);
|
|
56
|
+
animation.finished = true;
|
|
57
|
+
animation.timestamp = timestamp;
|
|
58
|
+
sv._value = animation.current;
|
|
59
|
+
|
|
60
|
+
if (finished) {
|
|
61
|
+
animation.callback && animation.callback(true
|
|
62
|
+
/* finished */
|
|
63
|
+
);
|
|
64
|
+
} else {
|
|
65
|
+
requestAnimationFrame(step);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
sv._animation = animation;
|
|
70
|
+
step(currentTimestamp);
|
|
71
|
+
} else {
|
|
72
|
+
// prevent setting again to the same value
|
|
73
|
+
// and triggering the mappers that treat this value as an input
|
|
74
|
+
if (sv._value === value) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
sv._value = value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=valueSetter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["valueSetter","sv","value","previousAnimation","_animation","cancelled","onFrame","undefined","animation","_value","current","isHigherOrder","callback","initializeAnimation","timestamp","onStart","currentTimestamp","getTimestamp","step","finished","requestAnimationFrame"],"sources":["valueSetter.ts"],"sourcesContent":["import { AnimationObject, AnimatableValue } from './commonTypes';\nimport { Descriptor } from './hook/commonTypes';\nimport { getTimestamp } from './time';\nexport { stopMapper } from './mappers';\n\nexport function valueSetter(sv: any, value: any): void {\n 'worklet';\n const previousAnimation = sv._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n sv._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame !== undefined)\n ) {\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n // this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)\n // built in animations that are not higher order(withTiming, withSpring) hold target value in .current\n if (sv._value === animation.current && !animation.isHigherOrder) {\n animation.callback && animation.callback(true);\n return;\n }\n // animated set\n const initializeAnimation = (timestamp: number) => {\n animation.onStart(animation, sv.value, timestamp, previousAnimation);\n };\n const currentTimestamp = getTimestamp();\n initializeAnimation(currentTimestamp);\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.finished = true;\n animation.timestamp = timestamp;\n sv._value = animation.current;\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestAnimationFrame(step);\n }\n };\n\n sv._animation = animation;\n\n step(currentTimestamp);\n } else {\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n if (sv._value === value) {\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6BM,SAA7B,CAAjB;MACAN,SAAS,CAACW,QAAV,GAAqB,IAArB;MACAX,SAAS,CAACM,SAAV,GAAsBA,SAAtB;MACAb,EAAE,CAACQ,MAAH,GAAYD,SAAS,CAACE,OAAtB;;MACA,IAAIS,QAAJ,EAAc;QACZX,SAAS,CAACI,QAAV,IAAsBJ,SAAS,CAACI,QAAV,CAAmB;QAAK;QAAxB,CAAtB;MACD,CAFD,MAEO;QACLQ,qBAAqB,CAACF,IAAD,CAArB;MACD;IACF,CAdD;;IAgBAjB,EAAE,CAACG,UAAH,GAAgBI,SAAhB;IAEAU,IAAI,CAACF,gBAAD,CAAJ;EACD,CA3CD,MA2CO;IACL;IACA;IACA,IAAIf,EAAE,CAACQ,MAAH,KAAcP,KAAlB,EAAyB;MACvB;IACD;;IACDD,EAAE,CAACQ,MAAH,GAAYP,KAAZ;EACD;AACF"}
|
|
@@ -6,14 +6,15 @@ import React from 'react';
|
|
|
6
6
|
import { findNodeHandle, Platform, StyleSheet } from 'react-native';
|
|
7
7
|
import WorkletEventHandler from './reanimated2/WorkletEventHandler';
|
|
8
8
|
import setAndForwardRef from './setAndForwardRef';
|
|
9
|
-
import './reanimated2/layoutReanimation/
|
|
9
|
+
import './reanimated2/layoutReanimation/animationsManager';
|
|
10
10
|
import invariant from 'invariant';
|
|
11
11
|
import { adaptViewConfig } from './ConfigHelper';
|
|
12
12
|
import { RNRenderer } from './reanimated2/platform-specific/RNRenderer';
|
|
13
|
-
import {
|
|
13
|
+
import { configureLayoutAnimations, enableLayoutAnimations, runOnUI } from './reanimated2/core';
|
|
14
14
|
import { isJest, isChromeDebugger, shouldBeUseWeb } from './reanimated2/PlatformChecker';
|
|
15
15
|
import { initialUpdaterRun } from './reanimated2/animation';
|
|
16
16
|
import { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';
|
|
17
|
+
import { makeShareableShadowNodeWrapper } from './reanimated2/shareables';
|
|
17
18
|
|
|
18
19
|
function dummyListener() {// empty listener we use to assign to listener properties for which animated
|
|
19
20
|
// event is used.
|
|
@@ -96,8 +97,6 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
96
97
|
|
|
97
98
|
_defineProperty(this, "initialStyle", {});
|
|
98
99
|
|
|
99
|
-
_defineProperty(this, "sv", void 0);
|
|
100
|
-
|
|
101
100
|
_defineProperty(this, "_component", null);
|
|
102
101
|
|
|
103
102
|
_defineProperty(this, "_setComponentRef", setAndForwardRef({
|
|
@@ -117,15 +116,15 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
if (layout) {
|
|
120
|
-
configureLayoutAnimations(tag, 'layout', maybeBuild(layout)
|
|
119
|
+
configureLayoutAnimations(tag, 'layout', maybeBuild(layout));
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
if (entering) {
|
|
124
|
-
configureLayoutAnimations(tag, 'entering', maybeBuild(entering)
|
|
123
|
+
configureLayoutAnimations(tag, 'entering', maybeBuild(entering));
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
if (exiting) {
|
|
128
|
-
configureLayoutAnimations(tag, 'exiting', maybeBuild(exiting)
|
|
127
|
+
configureLayoutAnimations(tag, 'exiting', maybeBuild(exiting));
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
|
|
@@ -140,16 +139,12 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
140
139
|
value: {}
|
|
141
140
|
};
|
|
142
141
|
}
|
|
143
|
-
|
|
144
|
-
this.sv = makeMutable({});
|
|
145
142
|
}
|
|
146
143
|
|
|
147
144
|
componentWillUnmount() {
|
|
148
145
|
this._detachNativeEvents();
|
|
149
146
|
|
|
150
147
|
this._detachStyles();
|
|
151
|
-
|
|
152
|
-
this.sv = null;
|
|
153
148
|
}
|
|
154
149
|
|
|
155
150
|
componentDidMount() {
|
|
@@ -295,7 +290,7 @@ export default function createAnimatedComponent(Component, options) {
|
|
|
295
290
|
}
|
|
296
291
|
|
|
297
292
|
if (global._IS_FABRIC) {
|
|
298
|
-
shadowNodeWrapper = getShadowNodeWrapperFromRef(this);
|
|
293
|
+
shadowNodeWrapper = makeShareableShadowNodeWrapper(getShadowNodeWrapperFromRef(this));
|
|
299
294
|
}
|
|
300
295
|
}
|
|
301
296
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","findNodeHandle","Platform","StyleSheet","WorkletEventHandler","setAndForwardRef","invariant","adaptViewConfig","RNRenderer","makeMutable","configureLayoutAnimations","enableLayoutAnimations","runOnUI","isJest","isChromeDebugger","shouldBeUseWeb","initialUpdaterRun","getShadowNodeWrapperFromRef","dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","prototype","isReactComponent","AnimatedComponent","constructor","props","getForwardedRef","forwardedRef","setLocalRef","ref","tag","layout","entering","exiting","sv","_component","animatedStyle","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","registerForEvents","unregisterFromEvents","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","shadowNodeWrapper","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","updater","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/LayoutAnimationRepository';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n makeMutable,\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n sv: SharedValue<null | Record<string, unknown>> | null;\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n this.sv = makeMutable({});\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this.sv = null;\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n const { layout, entering, exiting } = this.props;\n if ((layout || entering || exiting) && tag != null) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(\n tag,\n 'layout',\n maybeBuild(layout),\n this.sv\n );\n }\n if (entering) {\n configureLayoutAnimations(\n tag,\n 'entering',\n maybeBuild(entering),\n this.sv\n );\n }\n if (exiting) {\n configureLayoutAnimations(\n tag,\n 'exiting',\n maybeBuild(exiting),\n this.sv\n );\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAuE,OAAvE;AACA,SAASC,cAAT,EAAyBC,QAAzB,EAAmCC,UAAnC,QAAqD,cAArD;AACA,OAAOC,mBAAP,MAAgC,mCAAhC;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAO,2DAAP;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SAASC,eAAT,QAAgC,gBAAhC;AACA,SAASC,UAAT,QAA2B,4CAA3B;AACA,SACEC,WADF,EAEEC,yBAFF,EAGEC,sBAHF,EAIEC,OAJF,QA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,MAQO;YACLqC,KAAK,CAACV,GAAD,CAAL,GAAa3B,aAAb;UACD;QACF,CAfM,MAeA,IACL2B,GAAG,KAAK,6BAAR,IACA,CAAC/B,gBAAgB,EAFZ,EAGL;UACAyC,KAAK,CAACV,GAAD,CAAL,GAAavB,KAAb;QACD;MACF;;MACD,OAAOiC,KAAP;IACD;;IAEDwE,MAAM,GAAG;MACP,MAAMxE,KAAK,GAAG,KAAKyD,uBAAL,CAA6B,KAAKzD,KAAlC,CAAd;;MACA,IAAI1C,MAAM,EAAV,EAAc;QACZ0C,KAAK,CAACW,aAAN,GAAsB,KAAKA,aAA3B;MACD;;MAED,IAAI,KAAKmD,cAAT,EAAyB;QACvB,KAAKA,cAAL,GAAsB,KAAtB;MACD;;MAED,MAAMW,aAAa,GAAG9H,QAAQ,CAAC+H,MAAT,CAAgB;QACpCC,GAAG,EAAE,EAD+B;QAEpCC,OAAO,EAAE;UAAEC,WAAW,EAAE;QAAf;MAF2B,CAAhB,CAAtB;MAIA,oBACE,oBAAC,SAAD,eAAe7E,KAAf;QAAsB,GAAG,EAAE,KAAK8E;MAAhC,GAAsDL,aAAtD,EADF;IAGD;;EA/WD;;EAV4D,gBAQxD3E,iBARwD;;EA4X9DA,iBAAiB,CAACiF,WAAlB,GAAiC,qBAC/BrF,SAAS,CAACqF,WAAV,IAAyBrF,SAAS,CAAC4D,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAO7G,KAAK,CAACuI,UAAN,CAA4B,CAAChF,KAAD,EAAQI,GAAR,KAAgB;IACjD,oBACE,oBAAC,iBAAD,eACMJ,KADN,EAEOI,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
|
|
1
|
+
{"version":3,"names":["React","findNodeHandle","Platform","StyleSheet","WorkletEventHandler","setAndForwardRef","invariant","adaptViewConfig","RNRenderer","configureLayoutAnimations","enableLayoutAnimations","runOnUI","isJest","isChromeDebugger","shouldBeUseWeb","initialUpdaterRun","getShadowNodeWrapperFromRef","makeShareableShadowNodeWrapper","dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","prototype","isReactComponent","AnimatedComponent","constructor","props","getForwardedRef","forwardedRef","setLocalRef","ref","tag","layout","entering","exiting","_component","animatedStyle","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","registerForEvents","unregisterFromEvents","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","shadowNodeWrapper","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","updater","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/animationsManager';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\nimport { makeShareableShadowNodeWrapper } from './reanimated2/shareables';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = makeShareableShadowNodeWrapper(\n getShadowNodeWrapperFromRef(this)\n );\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n const { layout, entering, exiting } = this.props;\n if ((layout || entering || exiting) && tag != null) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(tag, 'layout', maybeBuild(layout));\n }\n if (entering) {\n configureLayoutAnimations(tag, 'entering', maybeBuild(entering));\n }\n if (exiting) {\n configureLayoutAnimations(tag, 'exiting', maybeBuild(exiting));\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAuE,OAAvE;AACA,SAASC,cAAT,EAAyBC,QAAzB,EAAmCC,UAAnC,QAAqD,cAArD;AACA,OAAOC,mBAAP,MAAgC,mCAAhC;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAO,mDAAP;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SAASC,eAAT,QAAgC,gBAAhC;AACA,SAASC,UAAT,QAA2B,4CAA3B;AACA,SACEC,yBADF,EAEEC,sBAFF,EAGEC,OAHF,QAIO,oBAJP;AAKA,SACEC,MADF,EAEEC,gBAFF,EAGEC,cAHF,QAIO,+BAJP;AAKA,SAASC,iBAAT,QAAkC,yBAAlC;AAgBA,SAASC,2BAAT,QAA4C,2BAA5C;AACA,SAASC,8BAAT,QAA+C,0BAA/C;;AAEA,SAASC,aAAT,GAAyB,CACvB;EACA;AACD;;AAED,SAASC,UAAT,CACEC,wBADF,EAKsC;EACpC,MAAMC,kBAAkB,GACtBC,KADyB,IAGzB,WAAWF,wBAAX,IACA,OAAOA,wBAAwB,CAACG,KAAhC,KAA0C,UAJ5C;;EAMA,IAAIF,kBAAkB,CAACD,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AAC8H,MAAT,CAAgB;QACpCC,GAAG,EAAE,EAD+B;QAEpCC,OAAO,EAAE;UAAEC,WAAW,EAAE;QAAf;MAF2B,CAAhB,CAAtB;MAIA,oBACE,oBAAC,SAAD,eAAe5E,KAAf;QAAsB,GAAG,EAAE,KAAK6E;MAAhC,GAAsDL,aAAtD,EADF;IAGD;;EA/VD;;EAV4D,gBAQxD1E,iBARwD;;EA4W9DA,iBAAiB,CAACgF,WAAlB,GAAiC,qBAC/BpF,SAAS,CAACoF,WAAV,IAAyBpF,SAAS,CAAC2D,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAO5G,KAAK,CAACsI,UAAN,CAA4B,CAAC/E,KAAD,EAAQI,GAAR,KAAgB;IACjD,oBACE,oBAAC,iBAAD,eACMJ,KADN,EAEOI,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
|
|
@@ -45,41 +45,40 @@ export class NativeReanimated {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
getTimestamp() {
|
|
49
|
+
throw new Error('stub implementation, used on the web only');
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
return this.InnerNativeModule.
|
|
52
|
+
installCoreFunctions(valueUnpacker) {
|
|
53
|
+
return this.InnerNativeModule.installCoreFunctions(valueUnpacker);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
return this.InnerNativeModule.
|
|
56
|
+
makeShareableClone(value) {
|
|
57
|
+
return this.InnerNativeModule.makeShareableClone(value);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return this.InnerNativeModule.makeRemote(object);
|
|
60
|
+
makeSynchronizedDataHolder(valueRef) {
|
|
61
|
+
return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
return this.InnerNativeModule.
|
|
64
|
+
getDataSynchronously(ref) {
|
|
65
|
+
return this.InnerNativeModule.getDataSynchronously(ref);
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
updateDataSynchronously(ref, value) {
|
|
69
|
+
this.InnerNativeModule.updateDataSynchronously(ref, value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
scheduleOnUI(shareable) {
|
|
73
|
+
return this.InnerNativeModule.scheduleOnUI(shareable);
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
let outputs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
76
|
-
let updater = arguments.length > 3 ? arguments[3] : undefined;
|
|
77
|
-
let viewDescriptors = arguments.length > 4 ? arguments[4] : undefined;
|
|
78
|
-
return this.InnerNativeModule.startMapper(mapper, inputs, outputs, updater, viewDescriptors);
|
|
76
|
+
registerSensor(sensorType, interval, handler) {
|
|
77
|
+
return this.InnerNativeModule.registerSensor(sensorType, interval, handler);
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
return this.InnerNativeModule.
|
|
80
|
+
unregisterSensor(sensorId) {
|
|
81
|
+
return this.InnerNativeModule.unregisterSensor(sensorId);
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
registerEventHandler(eventHash, eventHandler) {
|
|
@@ -94,8 +93,8 @@ export class NativeReanimated {
|
|
|
94
93
|
return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
configureLayoutAnimation(viewTag, type, config
|
|
98
|
-
this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config
|
|
96
|
+
configureLayoutAnimation(viewTag, type, config) {
|
|
97
|
+
this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config);
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
enableLayoutAnimations(flag) {
|
|
@@ -106,8 +105,8 @@ export class NativeReanimated {
|
|
|
106
105
|
this.InnerNativeModule.configureProps(uiProps, nativeProps);
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
subscribeForKeyboardEvents(
|
|
110
|
-
return this.InnerNativeModule.subscribeForKeyboardEvents(
|
|
108
|
+
subscribeForKeyboardEvents(handler) {
|
|
109
|
+
return this.InnerNativeModule.subscribeForKeyboardEvents(handler);
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
unsubscribeFromKeyboardEvents(listenerId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","version","jsVersion","NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","installTurboModule","InnerNativeModule","checkVersion","cppVersion","_REANIMATED_VERSION_CPP","ok","match","jsMajor","jsMinor","split","cppMajor","cppMinor","console","error","
|
|
1
|
+
{"version":3,"names":["NativeModules","version","jsVersion","NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","installTurboModule","InnerNativeModule","checkVersion","cppVersion","_REANIMATED_VERSION_CPP","ok","match","jsMajor","jsMinor","split","cppMajor","cppMinor","console","error","getTimestamp","Error","installCoreFunctions","valueUnpacker","makeShareableClone","value","makeSynchronizedDataHolder","valueRef","getDataSynchronously","ref","updateDataSynchronously","scheduleOnUI","shareable","registerSensor","sensorType","interval","handler","unregisterSensor","sensorId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { ShareableRef, ShareableSyncDataHolderRef } from '../commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\nimport { version as jsVersion } from '../../../package.json';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n this.checkVersion();\n }\n }\n\n checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[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.`\n );\n // TODO: detect Expo managed workflow\n }\n }\n\n getTimestamp(): number {\n throw new Error('stub implementation, used on the web only');\n }\n\n installCoreFunctions(valueUnpacker: <T>(value: T) => T): void {\n return this.InnerNativeModule.installCoreFunctions(valueUnpacker);\n }\n\n makeShareableClone<T>(value: T): ShareableRef<T> {\n return this.InnerNativeModule.makeShareableClone(value);\n }\n\n makeSynchronizedDataHolder<T>(\n valueRef: ShareableRef<T>\n ): ShareableSyncDataHolderRef<T> {\n return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);\n }\n\n getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T {\n return this.InnerNativeModule.getDataSynchronously(ref);\n }\n\n updateDataSynchronously<T>(\n ref: ShareableSyncDataHolderRef<T>,\n value: T\n ): void {\n this.InnerNativeModule.updateDataSynchronously(ref, value);\n }\n\n scheduleOnUI<T>(shareable: ShareableRef<T>) {\n return this.InnerNativeModule.scheduleOnUI(shareable);\n }\n\n registerSensor<T>(\n sensorType: number,\n interval: number,\n handler: ShareableRef<T>\n ) {\n return this.InnerNativeModule.registerSensor(sensorType, interval, handler);\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: ShareableRef<T>\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: ShareableRef<Keyframe | LayoutAnimationFunction>\n ) {\n this.InnerNativeModule.configureLayoutAnimation(viewTag, type, config);\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(handler: ShareableRef<number>): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(handler);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,cAA9B;AAGA,SAASC,OAAO,IAAIC,SAApB,QAAqC,uBAArC;AAEA,OAAO,MAAMC,gBAAN,CAAuB;EAI5BC,WAAW,GAAgB;IAAA,IAAfC,MAAe,uEAAN,IAAM;;IAAA;;IAAA;;IACzB,IAAIC,MAAM,CAACC,uBAAP,KAAmCC,SAAnC,IAAgDH,MAApD,EAA4D;MAC1D,MAAM;QAAEI;MAAF,IAAuBT,aAA7B;MACAS,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,Y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AAvB,CAA8CC,IAA9C;EACD;;EAEDC,cAAc,CAACC,OAAD,EAAoBC,WAApB,EAAiD;IAC7D,KAAKhD,iBAAL,CAAuB8C,cAAvB,CAAsCC,OAAtC,EAA+CC,WAA/C;EACD;;EAEDC,0BAA0B,CAACpB,OAAD,EAAwC;IAChE,OAAO,KAAK7B,iBAAL,CAAuBiD,0BAAvB,CAAkDpB,OAAlD,CAAP;EACD;;EAEDqB,6BAA6B,CAACC,UAAD,EAA2B;IACtD,KAAKnD,iBAAL,CAAuBkD,6BAAvB,CAAqDC,UAArD;EACD;;AA9H2B"}
|
|
@@ -1,65 +1,39 @@
|
|
|
1
1
|
import { useRef } from 'react';
|
|
2
2
|
import { makeMutable } from './core';
|
|
3
|
-
import { shouldBeUseWeb } from './PlatformChecker';
|
|
4
|
-
const scheduleUpdates = shouldBeUseWeb() ? requestAnimationFrame : setImmediate;
|
|
5
3
|
export function makeViewDescriptorsSet() {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
const sharableViewDescriptors = makeMutable([]);
|
|
5
|
+
const data = {
|
|
6
|
+
sharableViewDescriptors,
|
|
7
|
+
add: item => {
|
|
8
|
+
sharableViewDescriptors.modify(descriptors => {
|
|
9
|
+
'worklet';
|
|
10
|
+
|
|
11
|
+
const index = descriptors.findIndex(descriptor => descriptor.tag === item.tag);
|
|
12
|
+
|
|
13
|
+
if (index !== -1) {
|
|
14
|
+
descriptors[index] = item;
|
|
15
|
+
} else {
|
|
16
|
+
descriptors.push(item);
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
data.sharableViewDescriptors.value = data.items;
|
|
28
|
-
data.waitForInsertSync = false;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
remove: viewTag => {
|
|
33
|
-
data.batchToRemove.add(viewTag);
|
|
19
|
+
return descriptors;
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
remove: viewTag => {
|
|
23
|
+
sharableViewDescriptors.modify(descriptors => {
|
|
24
|
+
'worklet';
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
data.waitForRemoveSync = true;
|
|
37
|
-
scheduleUpdates(() => {
|
|
38
|
-
const items = [];
|
|
26
|
+
const index = descriptors.findIndex(descriptor => descriptor.tag === viewTag);
|
|
39
27
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
data.tags.delete(item.tag);
|
|
43
|
-
} else {
|
|
44
|
-
items.push(item);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
data.items = items;
|
|
49
|
-
data.sharableViewDescriptors.value = items;
|
|
50
|
-
data.batchToRemove = new Set();
|
|
51
|
-
data.waitForRemoveSync = false;
|
|
52
|
-
});
|
|
28
|
+
if (index !== -1) {
|
|
29
|
+
descriptors.splice(index, 1);
|
|
53
30
|
}
|
|
54
|
-
},
|
|
55
|
-
rebuildsharableViewDescriptors: sharableViewDescriptors => {
|
|
56
|
-
data.sharableViewDescriptors = sharableViewDescriptors;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
ref.current = data;
|
|
60
|
-
}
|
|
61
31
|
|
|
62
|
-
|
|
32
|
+
return descriptors;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
63
37
|
}
|
|
64
38
|
export function makeViewsRefSet() {
|
|
65
39
|
const ref = useRef(null);
|