react-native-reanimated 3.4.1 → 3.4.2
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/lib/module/Animated.js +60 -1
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +8 -0
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js +2 -2
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/animation/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/index.js +1 -1
- package/lib/module/reanimated2/animation/index.js.map +1 -1
- package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +2 -2
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +6 -0
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +4 -19
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +3 -1
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/helperTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js +2 -27
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +1 -1
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mock.js +26 -0
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +0 -1
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js +3 -0
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +0 -1
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/setAndForwardRef.js.map +1 -1
- package/lib/typescript/Animated.d.ts +68 -3
- package/lib/typescript/createAnimatedComponent.d.ts +1 -26
- package/lib/typescript/reanimated2/Easing.d.ts +17 -9
- package/lib/typescript/reanimated2/UpdateProps.d.ts +5 -5
- package/lib/typescript/reanimated2/animation/commonTypes.d.ts +4 -3
- package/lib/typescript/reanimated2/animation/decay.d.ts +2 -4
- package/lib/typescript/reanimated2/animation/index.d.ts +3 -3
- package/lib/typescript/reanimated2/animation/springUtils.d.ts +1 -0
- package/lib/typescript/reanimated2/animation/styleAnimation.d.ts +2 -6
- package/lib/typescript/reanimated2/animation/timing.d.ts +4 -7
- package/lib/typescript/reanimated2/animation/transformationMatrix/matrixUtils.d.ts +1 -1
- package/lib/typescript/reanimated2/animation/util.d.ts +2 -4
- package/lib/typescript/reanimated2/commonTypes.d.ts +0 -4
- package/lib/typescript/reanimated2/component/FlatList.d.ts +2 -1
- package/lib/typescript/reanimated2/component/ScrollView.d.ts +1 -1
- package/lib/typescript/reanimated2/helperTypes.d.ts +11 -7
- package/lib/typescript/reanimated2/hook/commonTypes.d.ts +2 -2
- package/lib/typescript/reanimated2/hook/index.d.ts +1 -1
- package/lib/typescript/reanimated2/hook/useAnimatedGestureHandler.d.ts +2 -2
- package/lib/typescript/reanimated2/hook/useAnimatedRef.d.ts +4 -4
- package/lib/typescript/reanimated2/hook/useAnimatedStyle.d.ts +4 -5
- package/lib/typescript/reanimated2/hook/utils.d.ts +3 -11
- package/lib/typescript/reanimated2/index.d.ts +3 -1
- package/lib/typescript/reanimated2/interpolateColor.d.ts +2 -3
- package/lib/typescript/reanimated2/js-reanimated/commonTypes.d.ts +1 -43
- package/lib/typescript/reanimated2/js-reanimated/index.d.ts +3 -2
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +4 -4
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -11
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +3 -3
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +13 -13
- package/lib/typescript/reanimated2/layoutReanimation/index.d.ts +1 -0
- package/lib/typescript/reanimated2/mappers.d.ts +0 -12
- package/lib/typescript/reanimated2/mock.d.ts +1 -76
- package/lib/typescript/reanimated2/mutables.d.ts +0 -1
- package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/reanimated2/valueSetter.d.ts +0 -1
- package/lib/typescript/setAndForwardRef.d.ts +1 -1
- package/package.json +3 -1
- package/src/Animated.ts +80 -6
- package/src/createAnimatedComponent.tsx +2 -2
- package/src/reanimated2/Easing.ts +18 -8
- package/src/reanimated2/UpdateProps.ts +13 -17
- package/src/reanimated2/animation/commonTypes.ts +3 -3
- package/src/reanimated2/animation/decay.ts +3 -1
- package/src/reanimated2/animation/index.ts +3 -3
- package/src/reanimated2/animation/springUtils.ts +2 -0
- package/src/reanimated2/animation/styleAnimation.ts +5 -5
- package/src/reanimated2/animation/timing.ts +6 -4
- package/src/reanimated2/animation/transformationMatrix/matrixUtils.tsx +4 -1
- package/src/reanimated2/animation/util.ts +5 -29
- package/src/reanimated2/commonTypes.ts +0 -25
- package/src/reanimated2/component/FlatList.tsx +3 -1
- package/src/reanimated2/component/ScrollView.tsx +1 -1
- package/src/reanimated2/fabricUtils.ts +1 -0
- package/src/reanimated2/globals.d.ts +3 -3
- package/src/reanimated2/helperTypes.ts +17 -7
- package/src/reanimated2/hook/commonTypes.ts +2 -3
- package/src/reanimated2/hook/index.ts +4 -1
- package/src/reanimated2/hook/useAnimatedGestureHandler.ts +2 -2
- package/src/reanimated2/hook/useAnimatedRef.ts +13 -10
- package/src/reanimated2/hook/useAnimatedStyle.ts +27 -26
- package/src/reanimated2/hook/utils.ts +5 -31
- package/src/reanimated2/index.ts +13 -1
- package/src/reanimated2/interpolateColor.ts +2 -2
- package/src/reanimated2/js-reanimated/commonTypes.ts +3 -3
- package/src/reanimated2/js-reanimated/index.ts +4 -3
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +4 -4
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +5 -5
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +3 -3
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +13 -13
- package/src/reanimated2/layoutReanimation/index.ts +1 -0
- package/src/reanimated2/mappers.ts +2 -2
- package/src/reanimated2/mock.ts +27 -0
- package/src/reanimated2/mutables.ts +0 -1
- package/src/reanimated2/platform-specific/checkCppVersion.ts +2 -0
- package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
- package/src/reanimated2/valueSetter.ts +0 -1
- package/src/setAndForwardRef.ts +1 -1
- package/lib/module/reanimated2/js-reanimated/Mapper.js +0 -69
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +0 -1
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +0 -109
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +0 -1
- package/lib/typescript/reanimated2/js-reanimated/Mapper.d.ts +0 -14
- package/lib/typescript/reanimated2/js-reanimated/MapperRegistry.d.ts +0 -14
- package/src/reanimated2/js-reanimated/Mapper.ts +0 -94
- package/src/reanimated2/js-reanimated/MapperRegistry.ts +0 -133
package/src/reanimated2/index.ts
CHANGED
|
@@ -15,4 +15,16 @@ export * from './commonTypes';
|
|
|
15
15
|
export * from './frameCallback';
|
|
16
16
|
export * from './pluginUtils';
|
|
17
17
|
export * from './jestUtils';
|
|
18
|
-
export type {
|
|
18
|
+
export type {
|
|
19
|
+
Adaptable,
|
|
20
|
+
AdaptTransforms,
|
|
21
|
+
AnimateProps,
|
|
22
|
+
AnimatedProps,
|
|
23
|
+
AnimatedTransform,
|
|
24
|
+
TransformStyleTypes,
|
|
25
|
+
AnimateStyle,
|
|
26
|
+
AnimatedStyle,
|
|
27
|
+
StylesOrDefault,
|
|
28
|
+
} from './helperTypes';
|
|
29
|
+
export type { AnimatedScrollViewProps } from './component/ScrollView';
|
|
30
|
+
export type { FlatListPropsWithLayout } from './component/FlatList';
|
|
@@ -111,7 +111,7 @@ const interpolateColorsRGB = (
|
|
|
111
111
|
);
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
interface InterpolateRGB {
|
|
114
|
+
export interface InterpolateRGB {
|
|
115
115
|
r: number[];
|
|
116
116
|
g: number[];
|
|
117
117
|
b: number[];
|
|
@@ -141,7 +141,7 @@ const getInterpolateRGB = (
|
|
|
141
141
|
return { r, g, b, a };
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
interface InterpolateHSV {
|
|
144
|
+
export interface InterpolateHSV {
|
|
145
145
|
h: number[];
|
|
146
146
|
s: number[];
|
|
147
147
|
v: number[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Timestamp, NestedObjectValues } from '../commonTypes';
|
|
2
2
|
import type MutableValue from './MutableValue';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface Mapper<T> {
|
|
5
5
|
MAPPER_ID?: number;
|
|
6
6
|
id: number;
|
|
7
7
|
inputs: MutableValue<T>[];
|
|
@@ -14,7 +14,7 @@ export interface Mapper<T> {
|
|
|
14
14
|
): MutableValue<T>[];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
interface MapperRegistry<T> {
|
|
18
18
|
sortedMappers: Mapper<T>[];
|
|
19
19
|
mappers: Map<number, Mapper<T>>;
|
|
20
20
|
_module: JSReanimated;
|
|
@@ -25,7 +25,7 @@ export interface MapperRegistry<T> {
|
|
|
25
25
|
updateOrder(): void;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
interface JSReanimated {
|
|
29
29
|
_valueSetter?: <T>(value: T) => void;
|
|
30
30
|
_renderRequested: boolean;
|
|
31
31
|
_mapperRegistry: MapperRegistry<any>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import JSReanimated from './JSReanimated';
|
|
2
|
-
import type {
|
|
2
|
+
import type { StyleProps } from '../commonTypes';
|
|
3
|
+
import type { AnimatedStyle } from '../helperTypes';
|
|
3
4
|
import { isWeb } from '../PlatformChecker';
|
|
4
5
|
|
|
5
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -47,13 +48,13 @@ interface JSReanimatedComponent {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export const _updatePropsJS = (
|
|
50
|
-
updates: StyleProps | AnimatedStyle
|
|
51
|
+
updates: StyleProps | AnimatedStyle<any>,
|
|
51
52
|
viewRef: { _component?: JSReanimatedComponent }
|
|
52
53
|
): void => {
|
|
53
54
|
if (viewRef._component) {
|
|
54
55
|
const component = viewRef._component;
|
|
55
56
|
const [rawStyles] = Object.keys(updates).reduce(
|
|
56
|
-
(acc: [StyleProps, AnimatedStyle], key) => {
|
|
57
|
+
(acc: [StyleProps, AnimatedStyle<any>], key) => {
|
|
57
58
|
const value = updates[key];
|
|
58
59
|
const index = typeof value === 'function' ? 1 : 0;
|
|
59
60
|
acc[index][key] = value;
|
|
@@ -4,12 +4,12 @@ import type {
|
|
|
4
4
|
BaseBuilderAnimationConfig,
|
|
5
5
|
LayoutAnimationAndConfig,
|
|
6
6
|
} from './commonTypes';
|
|
7
|
-
import type {
|
|
7
|
+
import type { EasingFunction } from '../../Easing';
|
|
8
8
|
import { BaseAnimationBuilder } from './BaseAnimationBuilder';
|
|
9
9
|
import type { StyleProps } from '../../commonTypes';
|
|
10
10
|
|
|
11
11
|
export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
12
|
-
easingV?:
|
|
12
|
+
easingV?: EasingFunction;
|
|
13
13
|
rotateV?: string;
|
|
14
14
|
type?: AnimationFunction;
|
|
15
15
|
dampingV?: number;
|
|
@@ -27,13 +27,13 @@ export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
|
27
27
|
|
|
28
28
|
static easing<T extends typeof ComplexAnimationBuilder>(
|
|
29
29
|
this: T,
|
|
30
|
-
easingFunction:
|
|
30
|
+
easingFunction: EasingFunction
|
|
31
31
|
) {
|
|
32
32
|
const instance = this.createInstance();
|
|
33
33
|
return instance.easing(easingFunction);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
easing(easingFunction:
|
|
36
|
+
easing(easingFunction: EasingFunction): this {
|
|
37
37
|
this.easingV = easingFunction;
|
|
38
38
|
return this;
|
|
39
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EasingFunction } from '../../Easing';
|
|
2
2
|
import { Easing } from '../../Easing';
|
|
3
3
|
import { withDelay, withSequence, withTiming } from '../../animation';
|
|
4
4
|
import type {
|
|
@@ -8,12 +8,12 @@ import type {
|
|
|
8
8
|
KeyframeProps,
|
|
9
9
|
} from './commonTypes';
|
|
10
10
|
import type { TransformProperty, StyleProps } from '../../commonTypes';
|
|
11
|
-
|
|
11
|
+
interface KeyframePoint {
|
|
12
12
|
duration: number;
|
|
13
13
|
value: number | string;
|
|
14
|
-
easing?:
|
|
14
|
+
easing?: EasingFunction;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
interface ParsedKeyframesDefinition {
|
|
17
17
|
initialValues: StyleProps;
|
|
18
18
|
keyframes: Record<string, KeyframePoint[]>;
|
|
19
19
|
}
|
|
@@ -113,7 +113,7 @@ class InnerKeyframe implements IEntryExitAnimationBuilder {
|
|
|
113
113
|
key: string;
|
|
114
114
|
value: string | number;
|
|
115
115
|
currentKeyPoint: number;
|
|
116
|
-
easing?:
|
|
116
|
+
easing?: EasingFunction;
|
|
117
117
|
}): void => {
|
|
118
118
|
if (!(key in parsedKeyframes)) {
|
|
119
119
|
throw Error(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EasingFunction } from '../../Easing';
|
|
2
2
|
import type { StyleProps } from '../../commonTypes';
|
|
3
3
|
|
|
4
4
|
export interface KeyframeProps extends StyleProps {
|
|
5
|
-
easing?:
|
|
5
|
+
easing?: EasingFunction;
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -96,7 +96,7 @@ export interface ILayoutAnimationBuilder {
|
|
|
96
96
|
|
|
97
97
|
export interface BaseLayoutAnimationConfig {
|
|
98
98
|
duration?: number;
|
|
99
|
-
easing?:
|
|
99
|
+
easing?: EasingFunction;
|
|
100
100
|
type?: AnimationFunction;
|
|
101
101
|
damping?: number;
|
|
102
102
|
dampingRatio?: number;
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
LayoutAnimationFunction,
|
|
4
4
|
} from '../animationBuilder/commonTypes';
|
|
5
5
|
import { BaseAnimationBuilder } from '../animationBuilder';
|
|
6
|
-
import type {
|
|
6
|
+
import type { EasingFunction } from '../../Easing';
|
|
7
7
|
import { Easing } from '../../Easing';
|
|
8
8
|
import { withTiming } from '../../animation';
|
|
9
9
|
|
|
@@ -11,10 +11,10 @@ export class CurvedTransition
|
|
|
11
11
|
extends BaseAnimationBuilder
|
|
12
12
|
implements ILayoutAnimationBuilder
|
|
13
13
|
{
|
|
14
|
-
easingXV:
|
|
15
|
-
easingYV:
|
|
16
|
-
easingWidthV:
|
|
17
|
-
easingHeightV:
|
|
14
|
+
easingXV: EasingFunction = Easing.in(Easing.ease);
|
|
15
|
+
easingYV: EasingFunction = Easing.out(Easing.ease);
|
|
16
|
+
easingWidthV: EasingFunction = Easing.in(Easing.exp);
|
|
17
|
+
easingHeightV: EasingFunction = Easing.out(Easing.exp);
|
|
18
18
|
|
|
19
19
|
static createInstance<T extends typeof BaseAnimationBuilder>(
|
|
20
20
|
this: T
|
|
@@ -22,42 +22,42 @@ export class CurvedTransition
|
|
|
22
22
|
return new CurvedTransition() as InstanceType<T>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
static easingX(easing:
|
|
25
|
+
static easingX(easing: EasingFunction): CurvedTransition {
|
|
26
26
|
const instance = this.createInstance();
|
|
27
27
|
return instance.easingX(easing);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
easingX(easing:
|
|
30
|
+
easingX(easing: EasingFunction): CurvedTransition {
|
|
31
31
|
this.easingXV = easing;
|
|
32
32
|
return this;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
static easingY(easing:
|
|
35
|
+
static easingY(easing: EasingFunction): CurvedTransition {
|
|
36
36
|
const instance = this.createInstance();
|
|
37
37
|
return instance.easingY(easing);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
easingY(easing:
|
|
40
|
+
easingY(easing: EasingFunction): CurvedTransition {
|
|
41
41
|
this.easingYV = easing;
|
|
42
42
|
return this;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
static easingWidth(easing:
|
|
45
|
+
static easingWidth(easing: EasingFunction): CurvedTransition {
|
|
46
46
|
const instance = this.createInstance();
|
|
47
47
|
return instance.easingWidth(easing);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
easingWidth(easing:
|
|
50
|
+
easingWidth(easing: EasingFunction): CurvedTransition {
|
|
51
51
|
this.easingWidthV = easing;
|
|
52
52
|
return this;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
static easingHeight(easing:
|
|
55
|
+
static easingHeight(easing: EasingFunction): CurvedTransition {
|
|
56
56
|
const instance = this.createInstance();
|
|
57
57
|
return instance.easingHeight(easing);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
easingHeight(easing:
|
|
60
|
+
easingHeight(easing: EasingFunction): CurvedTransition {
|
|
61
61
|
this.easingHeightV = easing;
|
|
62
62
|
return this;
|
|
63
63
|
}
|
|
@@ -5,7 +5,7 @@ import { isSharedValue } from './utils';
|
|
|
5
5
|
|
|
6
6
|
const IS_JEST = isJest();
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
type Mapper = {
|
|
9
9
|
id: number;
|
|
10
10
|
dirty: boolean;
|
|
11
11
|
worklet: () => void;
|
|
@@ -13,7 +13,7 @@ export type Mapper = {
|
|
|
13
13
|
outputs?: SharedValue<any>[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
function createMapperRegistry() {
|
|
17
17
|
'worklet';
|
|
18
18
|
const mappers = new Map();
|
|
19
19
|
let sortedMappers: Mapper[] = [];
|
package/src/reanimated2/mock.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* eslint-disable node/no-callback-literal */
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
3
|
// @ts-nocheck
|
|
4
|
+
import { SensorType } from './commonTypes';
|
|
5
|
+
|
|
4
6
|
const NOOP = () => {
|
|
5
7
|
// noop
|
|
6
8
|
};
|
|
@@ -54,6 +56,31 @@ const ReanimatedV2 = {
|
|
|
54
56
|
useAnimatedRef: () => ({ current: null }),
|
|
55
57
|
useAnimatedReaction: NOOP,
|
|
56
58
|
useAnimatedProps: IMMEDIATE_CB_INVOCATION,
|
|
59
|
+
SensorType: SensorType,
|
|
60
|
+
useAnimatedSensor: () => ({
|
|
61
|
+
sensor: {
|
|
62
|
+
value: {
|
|
63
|
+
x: 0,
|
|
64
|
+
y: 0,
|
|
65
|
+
z: 0,
|
|
66
|
+
interfaceOrientation: 0,
|
|
67
|
+
qw: 0,
|
|
68
|
+
qx: 0,
|
|
69
|
+
qy: 0,
|
|
70
|
+
qz: 0,
|
|
71
|
+
yaw: 0,
|
|
72
|
+
pitch: 0,
|
|
73
|
+
roll: 0,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
unregister: NOOP,
|
|
77
|
+
isAvailable: false,
|
|
78
|
+
config: {
|
|
79
|
+
interval: 0,
|
|
80
|
+
adjustToInterfaceOrientation: false,
|
|
81
|
+
iosReferenceFrame: 0,
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
57
84
|
|
|
58
85
|
withTiming: (toValue, _, cb) => {
|
|
59
86
|
cb && cb(true);
|
|
@@ -15,6 +15,8 @@ export function checkCppVersion() {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// This is used only in test files, therefore it is reported by ts-prune (which is desired)
|
|
19
|
+
// ts-prune-ignore-next
|
|
18
20
|
export function matchVersion(version1: string, version2: string) {
|
|
19
21
|
if (version1.match(/^\d+\.\d+\.\d+$/) && version2.match(/^\d+\.\d+\.\d+$/)) {
|
|
20
22
|
// x.y.z, compare only major and minor, skip patch
|
package/src/setAndForwardRef.ts
CHANGED
|
@@ -35,7 +35,7 @@ import type { MutableRefObject } from 'react';
|
|
|
35
35
|
* module.exports = MyViewWithRef;
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
type ForwardedRef<T> = () => MutableRefObject<T> | ((ref: T) => void);
|
|
39
39
|
|
|
40
40
|
function setAndForwardRef<T>({
|
|
41
41
|
getForwardedRef,
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
import { shouldBeUseWeb } from '../PlatformChecker';
|
|
5
|
-
import MutableValue from './MutableValue';
|
|
6
|
-
export default class Mapper {
|
|
7
|
-
constructor(module, mapper) {
|
|
8
|
-
let inputs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
9
|
-
let outputs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
10
|
-
_defineProperty(this, "id", void 0);
|
|
11
|
-
_defineProperty(this, "inputs", void 0);
|
|
12
|
-
_defineProperty(this, "outputs", void 0);
|
|
13
|
-
_defineProperty(this, "mapper", void 0);
|
|
14
|
-
_defineProperty(this, "dirty", true);
|
|
15
|
-
this.id = Mapper.MAPPER_ID++;
|
|
16
|
-
this.inputs = this.extractMutablesFromArray(inputs);
|
|
17
|
-
this.outputs = this.extractMutablesFromArray(outputs);
|
|
18
|
-
this.mapper = mapper;
|
|
19
|
-
const markDirty = () => {
|
|
20
|
-
this.dirty = true;
|
|
21
|
-
module.maybeRequestRender();
|
|
22
|
-
};
|
|
23
|
-
this.inputs.forEach(input => {
|
|
24
|
-
input.addListener(markDirty);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
execute() {
|
|
28
|
-
this.dirty = false;
|
|
29
|
-
this.mapper();
|
|
30
|
-
}
|
|
31
|
-
extractMutablesFromArray(array) {
|
|
32
|
-
const res = [];
|
|
33
|
-
function extractMutables(value) {
|
|
34
|
-
if (value == null) {
|
|
35
|
-
// return;
|
|
36
|
-
} else if (value instanceof MutableValue) {
|
|
37
|
-
res.push(value);
|
|
38
|
-
} else if (Array.isArray(value)) {
|
|
39
|
-
value.forEach(v => extractMutables(v));
|
|
40
|
-
} else if (isWebDomElement(value)) {
|
|
41
|
-
// do nothing on dom elements
|
|
42
|
-
// without this check, we get a "Maximum call size exceeded error"
|
|
43
|
-
} else if (typeof value === 'object') {
|
|
44
|
-
Object.keys(value).forEach(key => {
|
|
45
|
-
extractMutables(value[key]);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
extractMutables(array);
|
|
50
|
-
return res;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
_defineProperty(Mapper, "MAPPER_ID", 1);
|
|
54
|
-
function isWebDomElement(value) {
|
|
55
|
-
if (!shouldBeUseWeb()) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// https://stackoverflow.com/a/384380/7869175
|
|
60
|
-
function isWebNode(o) {
|
|
61
|
-
return typeof Node === 'object' ? o instanceof Node : o && typeof o === 'object' && typeof o.nodeType === 'number' && typeof o.nodeName === 'string';
|
|
62
|
-
}
|
|
63
|
-
function isWebElement(o) {
|
|
64
|
-
return typeof HTMLElement === 'object' ? o instanceof HTMLElement // DOM2
|
|
65
|
-
: o && typeof o === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string';
|
|
66
|
-
}
|
|
67
|
-
return isWebNode(value) || isWebElement(value);
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=Mapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["shouldBeUseWeb","MutableValue","Mapper","constructor","module","mapper","inputs","arguments","length","undefined","outputs","_defineProperty","id","MAPPER_ID","extractMutablesFromArray","markDirty","dirty","maybeRequestRender","forEach","input","addListener","execute","array","res","extractMutables","value","push","Array","isArray","v","isWebDomElement","Object","keys","key","isWebNode","o","Node","nodeType","nodeName","isWebElement","HTMLElement"],"sources":["Mapper.ts"],"sourcesContent":["import type { NestedObjectValues } from '../commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport type { JSReanimated } from './commonTypes';\nimport MutableValue from './MutableValue';\n\nexport default class Mapper<T> {\n static MAPPER_ID = 1;\n id: number;\n inputs: MutableValue<T>[];\n outputs: MutableValue<T>[];\n mapper: () => void;\n\n dirty = true;\n\n constructor(\n module: JSReanimated,\n mapper: () => void,\n inputs: NestedObjectValues<MutableValue<T>>[] = [],\n outputs: NestedObjectValues<MutableValue<T>>[] = []\n ) {\n this.id = Mapper.MAPPER_ID++;\n this.inputs = this.extractMutablesFromArray(inputs);\n this.outputs = this.extractMutablesFromArray(outputs);\n this.mapper = mapper;\n\n const markDirty = () => {\n this.dirty = true;\n module.maybeRequestRender();\n };\n\n this.inputs.forEach((input) => {\n input.addListener(markDirty);\n });\n }\n\n execute(): void {\n this.dirty = false;\n this.mapper();\n }\n\n extractMutablesFromArray<T>(\n array: NestedObjectValues<MutableValue<T>>\n ): MutableValue<T>[] {\n const res: MutableValue<T>[] = [];\n\n function extractMutables(value: NestedObjectValues<MutableValue<T>>) {\n if (value == null) {\n // return;\n } else if (value instanceof MutableValue) {\n res.push(value);\n } else if (Array.isArray(value)) {\n value.forEach((v) => extractMutables(v));\n } else if (isWebDomElement(value)) {\n // do nothing on dom elements\n // without this check, we get a \"Maximum call size exceeded error\"\n } else if (typeof value === 'object') {\n Object.keys(value).forEach((key) => {\n extractMutables(value[key]);\n });\n }\n }\n\n extractMutables(array);\n return res;\n }\n}\n\nfunction isWebDomElement(value: any) {\n if (!shouldBeUseWeb()) {\n return false;\n }\n\n // https://stackoverflow.com/a/384380/7869175\n function isWebNode(o: any) {\n return typeof Node === 'object'\n ? o instanceof Node\n : o &&\n typeof o === 'object' &&\n typeof o.nodeType === 'number' &&\n typeof o.nodeName === 'string';\n }\n\n function isWebElement(o: any) {\n return typeof HTMLElement === 'object'\n ? o instanceof HTMLElement // DOM2\n : o &&\n typeof o === 'object' &&\n o !== null &&\n o.nodeType === 1 &&\n typeof o.nodeName === 'string';\n }\n\n return isWebNode(value) || isWebElement(value);\n}\n"],"mappings":";;;AACA,SAASA,cAAc,QAAQ,oBAAoB;AAEnD,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,eAAe,MAAMC,MAAM,CAAI;EAS7BC,WAAWA,CACTC,MAAoB,EACpBC,MAAkB,EAGlB;IAAA,IAFAC,MAA6C,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IAAA,IAClDG,OAA8C,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IAAAI,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,gBAN7C,IAAI;IAQV,IAAI,CAACC,EAAE,GAAGV,MAAM,CAACW,SAAS,EAAE;IAC5B,IAAI,CAACP,MAAM,GAAG,IAAI,CAACQ,wBAAwB,CAACR,MAAM,CAAC;IACnD,IAAI,CAACI,OAAO,GAAG,IAAI,CAACI,wBAAwB,CAACJ,OAAO,CAAC;IACrD,IAAI,CAACL,MAAM,GAAGA,MAAM;IAEpB,MAAMU,SAAS,GAAGA,CAAA,KAAM;MACtB,IAAI,CAACC,KA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,QAAQ,GAC3BD,CAAC,YAAYC,IAAI,GACjBD,CAAC,IACC,OAAOA,CAAC,KAAK,QAAQ,IACrB,OAAOA,CAAC,CAACE,QAAQ,KAAK,QAAQ,IAC9B,OAAOF,CAAC,CAACG,QAAQ,KAAK,QAAQ;EACtC;EAEA,SAASC,YAAYA,CAACJ,CAAM,EAAE;IAC5B,OAAO,OAAOK,WAAW,KAAK,QAAQ,GAClCL,CAAC,YAAYK,WAAW,CAAC;IAAA,EACzBL,CAAC,IACC,OAAOA,CAAC,KAAK,QAAQ,IACrBA,CAAC,KAAK,IAAI,IACVA,CAAC,CAACE,QAAQ,KAAK,CAAC,IAChB,OAAOF,CAAC,CAACG,QAAQ,KAAK,QAAQ;EACtC;EAEA,OAAOJ,SAAS,CAACT,KAAK,CAAC,IAAIc,YAAY,CAACd,KAAK,CAAC;AAChD"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
export default class MapperRegistry {
|
|
5
|
-
constructor(module) {
|
|
6
|
-
_defineProperty(this, "sortedMappers", []);
|
|
7
|
-
_defineProperty(this, "mappers", new Map());
|
|
8
|
-
_defineProperty(this, "_module", void 0);
|
|
9
|
-
_defineProperty(this, "updatedSinceLastExecute", false);
|
|
10
|
-
this._module = module;
|
|
11
|
-
}
|
|
12
|
-
startMapper(mapper) {
|
|
13
|
-
this.mappers.set(mapper.id, mapper);
|
|
14
|
-
this.updatedSinceLastExecute = true;
|
|
15
|
-
return mapper.id;
|
|
16
|
-
}
|
|
17
|
-
stopMapper(id) {
|
|
18
|
-
this.mappers.delete(id);
|
|
19
|
-
this.updatedSinceLastExecute = true;
|
|
20
|
-
}
|
|
21
|
-
execute() {
|
|
22
|
-
if (this.updatedSinceLastExecute) {
|
|
23
|
-
this.updateOrder();
|
|
24
|
-
this.updatedSinceLastExecute = false;
|
|
25
|
-
}
|
|
26
|
-
for (let i = 0, len = this.sortedMappers.length; i < len; ++i) {
|
|
27
|
-
const mapper = this.sortedMappers[i];
|
|
28
|
-
if (mapper.dirty) {
|
|
29
|
-
mapper.execute();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
updateOrder() {
|
|
34
|
-
const nodes = [...this.mappers.values()].map(mapper => new Node(mapper));
|
|
35
|
-
const mappersById = {};
|
|
36
|
-
this.mappers.forEach(mapper => {
|
|
37
|
-
mappersById[mapper.id] = mapper;
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// create a graph from array of nodes
|
|
41
|
-
for (let i = 0, nodesLen = nodes.length; i < nodesLen; ++i) {
|
|
42
|
-
const node = nodes[i];
|
|
43
|
-
if (node.mapper.outputs.length === 0) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
for (let j = 0; j < nodesLen; ++j) {
|
|
47
|
-
const restNode = nodes[j];
|
|
48
|
-
if (i === j || restNode.mapper.inputs.length === 0) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
for (let outi = 0, outputsLen = node.mapper.outputs.length; outi < outputsLen; ++outi) {
|
|
52
|
-
for (let resti = 0, restLen = restNode.mapper.inputs.length; resti < restLen; ++resti) {
|
|
53
|
-
if (node.mapper.outputs[outi]._id === restNode.mapper.inputs[resti]._id) {
|
|
54
|
-
node.children.push(restNode);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const post = {};
|
|
61
|
-
let postCounter = 1;
|
|
62
|
-
const dfs = node => {
|
|
63
|
-
const index = nodes.indexOf(node);
|
|
64
|
-
if (index === -1) {
|
|
65
|
-
// this node has already been handled
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
++postCounter;
|
|
69
|
-
nodes.splice(index, 1);
|
|
70
|
-
if (node.children.length === 0 && nodes.length > 0) {
|
|
71
|
-
post[node.mapper.id] = postCounter++;
|
|
72
|
-
dfs(nodes[0]);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
for (let i = 0, len = node.children.length; i < len; ++i) {
|
|
76
|
-
dfs(node.children[i]);
|
|
77
|
-
}
|
|
78
|
-
post[node.mapper.id] = postCounter++;
|
|
79
|
-
};
|
|
80
|
-
while (nodes.length) dfs(nodes[0]);
|
|
81
|
-
const postArray = Object.keys(post).map(key => {
|
|
82
|
-
const num = parseInt(key);
|
|
83
|
-
return [num, post[num]];
|
|
84
|
-
});
|
|
85
|
-
postArray.sort((a, b) => {
|
|
86
|
-
return b[1] - a[1];
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// clear sorted mappers
|
|
90
|
-
this.sortedMappers = [];
|
|
91
|
-
for (let i = 0, len = postArray.length; i < len; ++i) {
|
|
92
|
-
const [id] = postArray[i];
|
|
93
|
-
this.sortedMappers.push(mappersById[id]);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
get needRunOnRender() {
|
|
97
|
-
return this.updatedSinceLastExecute;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
class Node {
|
|
101
|
-
constructor(mapper) {
|
|
102
|
-
let children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
103
|
-
_defineProperty(this, "mapper", void 0);
|
|
104
|
-
_defineProperty(this, "children", void 0);
|
|
105
|
-
this.mapper = mapper;
|
|
106
|
-
this.children = children;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=MapperRegistry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["MapperRegistry","constructor","module","_defineProperty","Map","_module","startMapper","mapper","mappers","set","id","updatedSinceLastExecute","stopMapper","delete","execute","updateOrder","i","len","sortedMappers","length","dirty","nodes","values","map","Node","mappersById","forEach","nodesLen","node","outputs","j","restNode","inputs","outi","outputsLen","resti","restLen","_id","children","push","post","postCounter","dfs","index","indexOf","splice","postArray","Object","keys","key","num","parseInt","sort","a","b","needRunOnRender","arguments","undefined"],"sources":["MapperRegistry.ts"],"sourcesContent":["import type { JSReanimated } from './commonTypes';\nimport type Mapper from './Mapper';\n\nexport default class MapperRegistry<T> {\n sortedMappers: Mapper<T>[] = [];\n mappers: Map<number, Mapper<T>> = new Map();\n _module: JSReanimated;\n\n updatedSinceLastExecute = false;\n\n constructor(module: JSReanimated) {\n this._module = module;\n }\n\n startMapper(mapper: Mapper<T>): number {\n this.mappers.set(mapper.id, mapper);\n this.updatedSinceLastExecute = true;\n return mapper.id;\n }\n\n stopMapper(id: number): void {\n this.mappers.delete(id);\n this.updatedSinceLastExecute = true;\n }\n\n execute(): void {\n if (this.updatedSinceLastExecute) {\n this.updateOrder();\n this.updatedSinceLastExecute = false;\n }\n\n for (let i = 0, len = this.sortedMappers.length; i < len; ++i) {\n const mapper = this.sortedMappers[i];\n if (mapper.dirty) {\n mapper.execute();\n }\n }\n }\n\n updateOrder(): void {\n const nodes = [...this.mappers.values()].map((mapper) => new Node(mapper));\n\n const mappersById: Record<number, Mapper<T>> = {};\n this.mappers.forEach((mapper) => {\n mappersById[mapper.id] = mapper;\n });\n\n // create a graph from array of nodes\n for (let i = 0, nodesLen = nodes.length; i < nodesLen; ++i) {\n const node = nodes[i];\n if (node.mapper.outputs.length === 0) {\n continue;\n }\n for (let j = 0; j < nodesLen; ++j) {\n const restNode = nodes[j];\n if (i === j || restNode.mapper.inputs.length === 0) {\n continue;\n }\n for (\n let outi = 0, outputsLen = node.mapper.outputs.length;\n outi < outputsLen;\n ++outi\n ) {\n for (\n let resti = 0, restLen = restNode.mapper.inputs.length;\n resti < restLen;\n ++resti\n ) {\n if (\n node.mapper.outputs[outi]._id ===\n restNode.mapper.inputs[resti]._id\n ) {\n node.children.push(restNode);\n }\n }\n }\n }\n }\n\n const post: Record<number, number> = {};\n let postCounter = 1;\n const dfs = (node: Node<T>) => {\n const index = nodes.indexOf(node);\n if (index === -1) {\n // this node has already been handled\n return;\n }\n ++postCounter;\n nodes.splice(index, 1);\n if (node.children.length === 0 && nodes.length > 0) {\n post[node.mapper.id] = postCounter++;\n dfs(nodes[0]);\n return;\n }\n for (let i = 0, len = node.children.length; i < len; ++i) {\n dfs(node.children[i]);\n }\n post[node.mapper.id] = postCounter++;\n };\n\n while (nodes.length) dfs(nodes[0]);\n\n const postArray = Object.keys(post).map((key) => {\n const num = parseInt(key);\n return [num, post[num]];\n });\n postArray.sort((a, b) => {\n return b[1] - a[1];\n });\n\n // clear sorted mappers\n this.sortedMappers = [];\n\n for (let i = 0, len = postArray.length; i < len; ++i) {\n const [id] = postArray[i];\n this.sortedMappers.push(mappersById[id]);\n }\n }\n\n get needRunOnRender(): boolean {\n return this.updatedSinceLastExecute;\n }\n}\n\nclass Node<T> {\n mapper: Mapper<T>;\n children: Node<T>[];\n\n constructor(mapper: Mapper<T>, children = []) {\n this.mapper = mapper;\n this.children = children;\n }\n}\n"],"mappings":";;;AAGA,eAAe,MAAMA,cAAc,CAAI;EAOrCC,WAAWA,CAACC,MAAoB,EAAE;IAAAC,eAAA,wBANL,EAAE;IAAAA,eAAA,kBACG,IAAIC,GAAG,EAAE;IAAAD,eAAA;IAAAA,eAAA,kCAGjB,KAAK;IAG7B,IAAI,CAACE,OAAO,GAAGH,MAAM;EACvB;EAEAI,WAAWA,CAACC,MAAiB,EAAU;IACrC,IAAI,CAACC,OAAO,CAACC,GAAG,CAACF,MAAM,CAACG,EAAE,EAAEH,MAAM,CAAC;IACnC,IAAI,CAACI,uBAAuB,GAAG,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,OAAO,IAAI,CAAC5C,uBAAuB;EACrC;AACF;AAEA,MAAMa,IAAI,CAAI;EAIZvB,WAAWA,CAACM,MAAiB,EAAiB;IAAA,IAAf+B,QAAQ,GAAAkB,SAAA,CAAArC,MAAA,QAAAqC,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,EAAE;IAAArD,eAAA;IAAAA,eAAA;IAC1C,IAAI,CAACI,MAAM,GAAGA,MAAM;IACpB,IAAI,CAAC+B,QAAQ,GAAGA,QAAQ;EAC1B;AACF"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { NestedObjectValues } from '../commonTypes';
|
|
2
|
-
import type { JSReanimated } from './commonTypes';
|
|
3
|
-
import MutableValue from './MutableValue';
|
|
4
|
-
export default class Mapper<T> {
|
|
5
|
-
static MAPPER_ID: number;
|
|
6
|
-
id: number;
|
|
7
|
-
inputs: MutableValue<T>[];
|
|
8
|
-
outputs: MutableValue<T>[];
|
|
9
|
-
mapper: () => void;
|
|
10
|
-
dirty: boolean;
|
|
11
|
-
constructor(module: JSReanimated, mapper: () => void, inputs?: NestedObjectValues<MutableValue<T>>[], outputs?: NestedObjectValues<MutableValue<T>>[]);
|
|
12
|
-
execute(): void;
|
|
13
|
-
extractMutablesFromArray<T>(array: NestedObjectValues<MutableValue<T>>): MutableValue<T>[];
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { JSReanimated } from './commonTypes';
|
|
2
|
-
import type Mapper from './Mapper';
|
|
3
|
-
export default class MapperRegistry<T> {
|
|
4
|
-
sortedMappers: Mapper<T>[];
|
|
5
|
-
mappers: Map<number, Mapper<T>>;
|
|
6
|
-
_module: JSReanimated;
|
|
7
|
-
updatedSinceLastExecute: boolean;
|
|
8
|
-
constructor(module: JSReanimated);
|
|
9
|
-
startMapper(mapper: Mapper<T>): number;
|
|
10
|
-
stopMapper(id: number): void;
|
|
11
|
-
execute(): void;
|
|
12
|
-
updateOrder(): void;
|
|
13
|
-
get needRunOnRender(): boolean;
|
|
14
|
-
}
|