@hanzogui/animations-reanimated 3.0.6 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createAnimations.cjs +477 -334
- package/dist/cjs/createAnimations.native.js +561 -409
- package/dist/cjs/createAnimations.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/createAnimations.mjs +449 -308
- package/dist/esm/createAnimations.mjs.map +1 -1
- package/dist/esm/createAnimations.native.js +533 -383
- package/dist/esm/createAnimations.native.js.map +1 -1
- package/package.json +5 -5
- package/src/createAnimations.tsx +164 -123
- package/types/createAnimations.d.ts.map +2 -2
|
@@ -1,188 +1,218 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getEffectiveAnimation, normalizeTransition } from "@hanzogui/animation-helpers";
|
|
3
3
|
import { getSplitStyles, hooks, isWeb, Text, useComposedRefs, useEvent, useIsomorphicLayoutEffect, useThemeWithState, View } from "@hanzogui/core";
|
|
4
4
|
import { ResetPresence, usePresence } from "@hanzogui/use-presence";
|
|
5
5
|
import React, { forwardRef, useMemo, useRef } from "react";
|
|
6
|
-
import Animated_, { cancelAnimation, runOnJS, useAnimatedReaction, useAnimatedStyle, useDerivedValue, useSharedValue, withDelay, withSpring, withTiming } from "react-native-reanimated";
|
|
6
|
+
import Animated_, { cancelAnimation, runOnJS, runOnUI, useAnimatedReaction, useAnimatedStyle, useDerivedValue, useSharedValue, withDelay, withSpring, withTiming } from "react-native-reanimated";
|
|
7
7
|
function _type_of(obj) {
|
|
8
8
|
"@swc/helpers - typeof";
|
|
9
9
|
|
|
10
|
-
return obj && typeof Symbol
|
|
10
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
11
11
|
}
|
|
12
12
|
var getDefaultExport = function (module) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
var mod = module;
|
|
14
|
+
if (mod.__esModule || mod[Symbol.toStringTag] === "Module") {
|
|
15
|
+
return mod.default || mod;
|
|
16
|
+
}
|
|
17
|
+
return mod;
|
|
18
|
+
};
|
|
19
|
+
var Animated = getDefaultExport(Animated_);
|
|
20
|
+
var resolveDynamicValue = function (value, isDark) {
|
|
21
|
+
if (value !== null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && "dynamic" in value && _type_of(value.dynamic) === "object") {
|
|
22
|
+
var dynamic = value.dynamic;
|
|
23
|
+
return isDark ? dynamic.dark : dynamic.light;
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
};
|
|
27
|
+
var applyAnimation = function (targetValue, config, callback) {
|
|
28
|
+
"worklet";
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
30
|
+
var delay = config.delay;
|
|
31
|
+
var animatedValue;
|
|
32
|
+
if (config.type === "timing") {
|
|
33
|
+
animatedValue = withTiming(targetValue, config, callback);
|
|
34
|
+
} else {
|
|
35
|
+
animatedValue = withSpring(targetValue, config, callback);
|
|
36
|
+
}
|
|
37
|
+
if (delay && delay > 0) {
|
|
38
|
+
animatedValue = withDelay(delay, animatedValue);
|
|
39
|
+
}
|
|
40
|
+
return animatedValue;
|
|
41
|
+
};
|
|
42
|
+
var ANIMATABLE_PROPERTIES = {
|
|
43
|
+
// Transform
|
|
44
|
+
transform: true,
|
|
45
|
+
// Opacity
|
|
46
|
+
opacity: true,
|
|
47
|
+
// Dimensions
|
|
48
|
+
height: true,
|
|
49
|
+
width: true,
|
|
50
|
+
minWidth: true,
|
|
51
|
+
minHeight: true,
|
|
52
|
+
maxWidth: true,
|
|
53
|
+
maxHeight: true,
|
|
54
|
+
// Background
|
|
55
|
+
backgroundColor: true,
|
|
56
|
+
// Border colors
|
|
57
|
+
borderColor: true,
|
|
58
|
+
borderLeftColor: true,
|
|
59
|
+
borderRightColor: true,
|
|
60
|
+
borderTopColor: true,
|
|
61
|
+
borderBottomColor: true,
|
|
62
|
+
// Border radius
|
|
63
|
+
borderRadius: true,
|
|
64
|
+
borderTopLeftRadius: true,
|
|
65
|
+
borderTopRightRadius: true,
|
|
66
|
+
borderBottomLeftRadius: true,
|
|
67
|
+
borderBottomRightRadius: true,
|
|
68
|
+
// Border width
|
|
69
|
+
borderWidth: true,
|
|
70
|
+
borderLeftWidth: true,
|
|
71
|
+
borderRightWidth: true,
|
|
72
|
+
borderTopWidth: true,
|
|
73
|
+
borderBottomWidth: true,
|
|
74
|
+
// Text
|
|
75
|
+
color: true,
|
|
76
|
+
fontSize: true,
|
|
77
|
+
fontWeight: true,
|
|
78
|
+
lineHeight: true,
|
|
79
|
+
letterSpacing: true,
|
|
80
|
+
// Position
|
|
81
|
+
left: true,
|
|
82
|
+
right: true,
|
|
83
|
+
top: true,
|
|
84
|
+
bottom: true,
|
|
85
|
+
// Margin
|
|
86
|
+
margin: true,
|
|
87
|
+
marginTop: true,
|
|
88
|
+
marginBottom: true,
|
|
89
|
+
marginLeft: true,
|
|
90
|
+
marginRight: true,
|
|
91
|
+
marginHorizontal: true,
|
|
92
|
+
marginVertical: true,
|
|
93
|
+
// Padding
|
|
94
|
+
padding: true,
|
|
95
|
+
paddingTop: true,
|
|
96
|
+
paddingBottom: true,
|
|
97
|
+
paddingLeft: true,
|
|
98
|
+
paddingRight: true,
|
|
99
|
+
paddingHorizontal: true,
|
|
100
|
+
paddingVertical: true,
|
|
101
|
+
// Flex/Gap
|
|
102
|
+
gap: true,
|
|
103
|
+
rowGap: true,
|
|
104
|
+
columnGap: true,
|
|
105
|
+
flex: true,
|
|
106
|
+
flexGrow: true,
|
|
107
|
+
flexShrink: true
|
|
108
|
+
};
|
|
109
|
+
var canAnimateProperty = function (key, value, animateOnly) {
|
|
110
|
+
if (!ANIMATABLE_PROPERTIES[key]) return false;
|
|
111
|
+
if (value === "auto") return false;
|
|
112
|
+
if (typeof value === "string" && value.startsWith("calc")) return false;
|
|
113
|
+
if (animateOnly && !animateOnly.includes(key)) return false;
|
|
114
|
+
return true;
|
|
115
|
+
};
|
|
101
116
|
function createWebAnimatedComponent(defaultTag) {
|
|
102
|
-
var isText = defaultTag === "span"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return Component
|
|
117
|
+
var isText = defaultTag === "span";
|
|
118
|
+
var Component = Animated.createAnimatedComponent(/* @__PURE__ */forwardRef(function (propsIn, ref) {
|
|
119
|
+
var _hooks_usePropsTransform;
|
|
120
|
+
var {
|
|
121
|
+
forwardedRef,
|
|
122
|
+
render = defaultTag,
|
|
123
|
+
...rest
|
|
124
|
+
} = propsIn;
|
|
125
|
+
var hostRef = useRef(null);
|
|
126
|
+
var composedRefs = useComposedRefs(forwardedRef, ref, hostRef);
|
|
127
|
+
var stateRef = useRef({
|
|
128
|
+
get host() {
|
|
129
|
+
return hostRef.current;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
var [, themeState] = useThemeWithState({});
|
|
133
|
+
var _themeState_theme, _themeState_name;
|
|
134
|
+
var result = getSplitStyles(rest, isText ? Text.staticConfig : View.staticConfig, (_themeState_theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme) !== null && _themeState_theme !== void 0 ? _themeState_theme : {}, (_themeState_name = themeState === null || themeState === void 0 ? void 0 : themeState.name) !== null && _themeState_name !== void 0 ? _themeState_name : "", {
|
|
135
|
+
unmounted: false
|
|
136
|
+
}, {
|
|
137
|
+
isAnimated: false,
|
|
138
|
+
noClass: true
|
|
139
|
+
});
|
|
140
|
+
var _result_viewProps;
|
|
141
|
+
var viewProps = (_result_viewProps = result === null || result === void 0 ? void 0 : result.viewProps) !== null && _result_viewProps !== void 0 ? _result_viewProps : {};
|
|
142
|
+
var Element = render;
|
|
143
|
+
var transformedProps = (_hooks_usePropsTransform = hooks.usePropsTransform) === null || _hooks_usePropsTransform === void 0 ? void 0 : _hooks_usePropsTransform.call(hooks, render, viewProps, stateRef, false);
|
|
144
|
+
return /* @__PURE__ */_jsx(Element, {
|
|
145
|
+
...transformedProps,
|
|
146
|
+
ref: composedRefs
|
|
147
|
+
});
|
|
148
|
+
}));
|
|
149
|
+
Component.acceptRenderProp = true;
|
|
150
|
+
return Component;
|
|
136
151
|
}
|
|
137
|
-
var AnimatedView = createWebAnimatedComponent("div")
|
|
138
|
-
|
|
152
|
+
var AnimatedView = createWebAnimatedComponent("div");
|
|
153
|
+
var AnimatedText = createWebAnimatedComponent("span");
|
|
139
154
|
function buildTransitionConfig(transition, animations, animationState, styleKeys) {
|
|
140
|
-
var normalized = normalizeTransition(transition)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
var normalized = normalizeTransition(transition);
|
|
156
|
+
var effectiveKey = getEffectiveAnimation(normalized, animationState);
|
|
157
|
+
var _animations_effectiveKey;
|
|
158
|
+
var base = effectiveKey ? (_animations_effectiveKey = animations[effectiveKey]) !== null && _animations_effectiveKey !== void 0 ? _animations_effectiveKey : {
|
|
159
|
+
type: "spring"
|
|
160
|
+
} : {
|
|
161
|
+
type: "spring"
|
|
162
|
+
};
|
|
163
|
+
if (normalized.delay) {
|
|
164
|
+
base = {
|
|
165
|
+
...base,
|
|
166
|
+
delay: normalized.delay
|
|
147
167
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
168
|
+
}
|
|
169
|
+
if (normalized.config) {
|
|
170
|
+
base = {
|
|
171
|
+
...base,
|
|
172
|
+
...normalized.config
|
|
173
|
+
};
|
|
174
|
+
if (base.type !== "timing" && normalized.config.duration !== void 0 && normalized.config.damping === void 0 && normalized.config.stiffness === void 0 && normalized.config.mass === void 0) {
|
|
175
|
+
base = {
|
|
176
|
+
...base,
|
|
177
|
+
type: "timing"
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
var propertyConfigs = {};
|
|
182
|
+
var _iteratorNormalCompletion = true,
|
|
183
|
+
_didIteratorError = false,
|
|
161
184
|
_iteratorError = void 0;
|
|
162
185
|
try {
|
|
163
|
-
for (var _iterator = styleKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion =
|
|
164
|
-
var key = _step.value
|
|
165
|
-
|
|
166
|
-
if (typeof propAnimation
|
|
186
|
+
for (var _iterator = styleKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
187
|
+
var key = _step.value;
|
|
188
|
+
var propAnimation = normalized.properties[key];
|
|
189
|
+
if (typeof propAnimation === "string") {
|
|
167
190
|
var _animations_propAnimation;
|
|
168
191
|
propertyConfigs[key] = (_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : base;
|
|
169
|
-
} else if (propAnimation && (typeof propAnimation
|
|
170
|
-
var configType = propAnimation.type
|
|
171
|
-
|
|
172
|
-
|
|
192
|
+
} else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object") {
|
|
193
|
+
var configType = propAnimation.type;
|
|
194
|
+
var _animations_configType;
|
|
195
|
+
var baseForProp = configType ? (_animations_configType = animations[configType]) !== null && _animations_configType !== void 0 ? _animations_configType : base : base;
|
|
173
196
|
propertyConfigs[key] = {
|
|
174
197
|
...baseForProp,
|
|
175
198
|
...propAnimation
|
|
176
199
|
};
|
|
177
|
-
} else
|
|
200
|
+
} else {
|
|
201
|
+
propertyConfigs[key] = base;
|
|
202
|
+
}
|
|
178
203
|
}
|
|
179
204
|
} catch (err) {
|
|
180
|
-
_didIteratorError =
|
|
205
|
+
_didIteratorError = true;
|
|
206
|
+
_iteratorError = err;
|
|
181
207
|
} finally {
|
|
182
208
|
try {
|
|
183
|
-
!_iteratorNormalCompletion && _iterator.return != null
|
|
209
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
210
|
+
_iterator.return();
|
|
211
|
+
}
|
|
184
212
|
} finally {
|
|
185
|
-
if (_didIteratorError)
|
|
213
|
+
if (_didIteratorError) {
|
|
214
|
+
throw _iteratorError;
|
|
215
|
+
}
|
|
186
216
|
}
|
|
187
217
|
}
|
|
188
218
|
return {
|
|
@@ -193,21 +223,28 @@ function buildTransitionConfig(transition, animations, animationState, styleKeys
|
|
|
193
223
|
function getStyleKeys(style) {
|
|
194
224
|
var keys = new Set(Object.keys(style));
|
|
195
225
|
if (style.transform && Array.isArray(style.transform)) {
|
|
196
|
-
var _iteratorNormalCompletion =
|
|
197
|
-
_didIteratorError =
|
|
226
|
+
var _iteratorNormalCompletion = true,
|
|
227
|
+
_didIteratorError = false,
|
|
198
228
|
_iteratorError = void 0;
|
|
199
229
|
try {
|
|
200
|
-
for (var _iterator = style.transform[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion =
|
|
230
|
+
for (var _iterator = style.transform[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
201
231
|
var t = _step.value;
|
|
202
|
-
t && (typeof t
|
|
232
|
+
if (t && (typeof t === "undefined" ? "undefined" : _type_of(t)) === "object") {
|
|
233
|
+
keys.add(Object.keys(t)[0]);
|
|
234
|
+
}
|
|
203
235
|
}
|
|
204
236
|
} catch (err) {
|
|
205
|
-
_didIteratorError =
|
|
237
|
+
_didIteratorError = true;
|
|
238
|
+
_iteratorError = err;
|
|
206
239
|
} finally {
|
|
207
240
|
try {
|
|
208
|
-
!_iteratorNormalCompletion && _iterator.return != null
|
|
241
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
242
|
+
_iterator.return();
|
|
243
|
+
}
|
|
209
244
|
} finally {
|
|
210
|
-
if (_didIteratorError)
|
|
245
|
+
if (_didIteratorError) {
|
|
246
|
+
throw _iteratorError;
|
|
247
|
+
}
|
|
211
248
|
}
|
|
212
249
|
}
|
|
213
250
|
}
|
|
@@ -215,18 +252,20 @@ function getStyleKeys(style) {
|
|
|
215
252
|
}
|
|
216
253
|
function createAnimations(animationsConfig) {
|
|
217
254
|
var animations = {};
|
|
218
|
-
for (var key in animationsConfig)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
255
|
+
for (var key in animationsConfig) {
|
|
256
|
+
animations[key] = {
|
|
257
|
+
type: "spring",
|
|
258
|
+
...animationsConfig[key]
|
|
259
|
+
};
|
|
260
|
+
}
|
|
222
261
|
return {
|
|
223
|
-
needsCustomComponent:
|
|
262
|
+
needsCustomComponent: true,
|
|
224
263
|
View: isWeb ? AnimatedView : Animated.View,
|
|
225
264
|
Text: isWeb ? AnimatedText : Animated.Text,
|
|
226
|
-
isReactNative:
|
|
265
|
+
isReactNative: true,
|
|
227
266
|
inputStyle: "value",
|
|
228
267
|
outputStyle: "inline",
|
|
229
|
-
avoidReRenders:
|
|
268
|
+
avoidReRenders: true,
|
|
230
269
|
animations,
|
|
231
270
|
usePresence,
|
|
232
271
|
ResetPresence,
|
|
@@ -248,22 +287,31 @@ function createAnimations(animationsConfig) {
|
|
|
248
287
|
return sharedValue.value;
|
|
249
288
|
},
|
|
250
289
|
setValue(next) {
|
|
251
|
-
"worklet";
|
|
252
|
-
|
|
253
290
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
254
291
|
type: "spring"
|
|
255
292
|
},
|
|
256
|
-
onFinish = arguments.length > 2 ? arguments[2] : void 0
|
|
257
|
-
|
|
293
|
+
onFinish = arguments.length > 2 ? arguments[2] : void 0;
|
|
294
|
+
if (config.type === "direct") {
|
|
295
|
+
sharedValue.value = next;
|
|
296
|
+
onFinish === null || onFinish === void 0 ? void 0 : onFinish();
|
|
297
|
+
} else {
|
|
298
|
+
var cb = onFinish ? function () {
|
|
258
299
|
"worklet";
|
|
259
300
|
|
|
260
301
|
runOnJS(onFinish)();
|
|
261
302
|
} : void 0;
|
|
262
|
-
|
|
303
|
+
if (isWeb) {
|
|
304
|
+
sharedValue.value = config.type === "spring" ? withSpring(next, config, cb) : withTiming(next, config, cb);
|
|
305
|
+
} else {
|
|
306
|
+
runOnUI(function () {
|
|
307
|
+
"worklet";
|
|
308
|
+
|
|
309
|
+
sharedValue.value = config.type === "spring" ? withSpring(next, config, cb) : withTiming(next, config, cb);
|
|
310
|
+
})();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
263
313
|
},
|
|
264
314
|
stop() {
|
|
265
|
-
"worklet";
|
|
266
|
-
|
|
267
315
|
cancelAnimation(sharedValue);
|
|
268
316
|
}
|
|
269
317
|
};
|
|
@@ -274,119 +322,172 @@ function createAnimations(animationsConfig) {
|
|
|
274
322
|
// =========================================================================
|
|
275
323
|
useAnimatedNumberReaction(param, onValue) {
|
|
276
324
|
var {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
325
|
+
value
|
|
326
|
+
} = param;
|
|
327
|
+
var instance = value.getInstance();
|
|
280
328
|
return useAnimatedReaction(function () {
|
|
281
329
|
return instance.value;
|
|
282
330
|
}, function (next, prev) {
|
|
283
|
-
prev !== next
|
|
331
|
+
if (prev !== next) {
|
|
332
|
+
runOnJS(onValue)(next);
|
|
333
|
+
}
|
|
284
334
|
}, [onValue, instance]);
|
|
285
335
|
},
|
|
286
336
|
// =========================================================================
|
|
287
337
|
// useAnimatedNumberStyle - Create animated styles from values
|
|
288
338
|
// =========================================================================
|
|
289
339
|
useAnimatedNumberStyle(val, getStyle) {
|
|
290
|
-
var instance = val.getInstance()
|
|
291
|
-
|
|
292
|
-
|
|
340
|
+
var instance = val.getInstance();
|
|
341
|
+
if (isWeb) {
|
|
342
|
+
return useAnimatedStyle(function () {
|
|
343
|
+
"worklet";
|
|
344
|
+
|
|
345
|
+
return getStyle(instance.value);
|
|
293
346
|
}, [instance, getStyle]);
|
|
347
|
+
}
|
|
348
|
+
var styleVal = useDerivedValue(function () {
|
|
349
|
+
"worklet";
|
|
350
|
+
|
|
351
|
+
return getStyle(instance.value);
|
|
352
|
+
});
|
|
353
|
+
return useAnimatedStyle(function () {
|
|
354
|
+
"worklet";
|
|
355
|
+
|
|
356
|
+
return styleVal.value;
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
useAnimatedNumbersStyle(vals, getStyle) {
|
|
360
|
+
var instances = vals.map(function (v) {
|
|
361
|
+
return v.getInstance();
|
|
362
|
+
});
|
|
294
363
|
return useAnimatedStyle(function () {
|
|
295
|
-
|
|
296
|
-
|
|
364
|
+
"worklet";
|
|
365
|
+
|
|
366
|
+
var currentValues = instances.map(function (inst) {
|
|
367
|
+
return inst.value;
|
|
368
|
+
});
|
|
369
|
+
return getStyle(...currentValues);
|
|
370
|
+
}, isWeb ? [getStyle, ...instances] : void 0);
|
|
297
371
|
},
|
|
298
372
|
// =========================================================================
|
|
299
373
|
// useAnimations - Main animation hook for components
|
|
300
374
|
// =========================================================================
|
|
301
375
|
useAnimations(animationProps) {
|
|
302
376
|
var {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
377
|
+
props,
|
|
378
|
+
presence,
|
|
379
|
+
style,
|
|
380
|
+
componentState,
|
|
381
|
+
useStyleEmitter,
|
|
382
|
+
themeName,
|
|
383
|
+
stateRef,
|
|
384
|
+
styleState
|
|
385
|
+
} = animationProps;
|
|
386
|
+
var isHydrating = componentState.unmounted === true;
|
|
387
|
+
var isMounting = componentState.unmounted === "should-enter";
|
|
388
|
+
var isEntering = !!componentState.unmounted;
|
|
389
|
+
var isExiting = (presence === null || presence === void 0 ? void 0 : presence[0]) === false;
|
|
390
|
+
var wasEnteringRef = useRef(isEntering);
|
|
391
|
+
var justFinishedEntering = wasEnteringRef.current && !isEntering;
|
|
318
392
|
React.useEffect(function () {
|
|
319
393
|
wasEnteringRef.current = isEntering;
|
|
320
394
|
});
|
|
321
|
-
var _styleState_effectiveTransition
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
395
|
+
var _styleState_effectiveTransition;
|
|
396
|
+
var effectiveTransition = (_styleState_effectiveTransition = styleState === null || styleState === void 0 ? void 0 : styleState.effectiveTransition) !== null && _styleState_effectiveTransition !== void 0 ? _styleState_effectiveTransition : props.transition;
|
|
397
|
+
var normalized = normalizeTransition(effectiveTransition);
|
|
398
|
+
var animationState = isExiting ? "exit" : isMounting || justFinishedEntering ? "enter" : "default";
|
|
399
|
+
var animationKey = getEffectiveAnimation(normalized, animationState);
|
|
400
|
+
var disableAnimation = isHydrating || !animationKey;
|
|
401
|
+
var isDark = (themeName === null || themeName === void 0 ? void 0 : themeName.startsWith("dark")) || false;
|
|
402
|
+
var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];
|
|
403
|
+
var exitCycleIdRef = useRef(0);
|
|
404
|
+
var pendingExitKeysRef = useRef(/* @__PURE__ */new Set());
|
|
405
|
+
var exitCompletedRef = useRef(false);
|
|
406
|
+
var wasExitingRef = useRef(false);
|
|
407
|
+
var justStartedExiting = isExiting && !wasExitingRef.current;
|
|
408
|
+
var justStoppedExiting = !isExiting && wasExitingRef.current;
|
|
409
|
+
var markExitKeyDone = useEvent(function (key3, cycleId, finished) {
|
|
410
|
+
if (cycleId !== exitCycleIdRef.current) return;
|
|
411
|
+
if (exitCompletedRef.current) return;
|
|
412
|
+
pendingExitKeysRef.current.delete(key3);
|
|
413
|
+
if (pendingExitKeysRef.current.size === 0) {
|
|
414
|
+
exitCompletedRef.current = true;
|
|
415
|
+
sendExitComplete === null || sendExitComplete === void 0 ? void 0 : sendExitComplete();
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
var isExitingRef = useSharedValue(isExiting);
|
|
419
|
+
var exitCycleIdShared = useSharedValue(exitCycleIdRef.current);
|
|
420
|
+
if (justStartedExiting) {
|
|
421
|
+
exitCycleIdRef.current++;
|
|
422
|
+
exitCompletedRef.current = false;
|
|
423
|
+
pendingExitKeysRef.current.clear();
|
|
424
|
+
}
|
|
425
|
+
if (justStoppedExiting) {
|
|
426
|
+
exitCycleIdRef.current++;
|
|
427
|
+
pendingExitKeysRef.current.clear();
|
|
428
|
+
}
|
|
429
|
+
useIsomorphicLayoutEffect(function () {
|
|
430
|
+
isExitingRef.value = isExiting;
|
|
431
|
+
exitCycleIdShared.value = exitCycleIdRef.current;
|
|
432
|
+
}, [isExiting, exitCycleIdRef.current]);
|
|
433
|
+
React.useEffect(function () {
|
|
343
434
|
wasExitingRef.current = isExiting;
|
|
344
435
|
});
|
|
345
|
-
var animatedTargetsRef = useSharedValue(null)
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
436
|
+
var animatedTargetsRef = useSharedValue(null);
|
|
437
|
+
var staticTargetsRef = useSharedValue(null);
|
|
438
|
+
var transformTargetsRef = useSharedValue(null);
|
|
439
|
+
var {
|
|
440
|
+
animatedStyles,
|
|
441
|
+
staticStyles
|
|
442
|
+
} = useMemo(function () {
|
|
443
|
+
var animated = {};
|
|
444
|
+
var staticStyles2 = {};
|
|
445
|
+
var animateOnly2 = props.animateOnly;
|
|
446
|
+
for (var key3 in style) {
|
|
447
|
+
var rawValue = style[key3];
|
|
448
|
+
var value = resolveDynamicValue(rawValue, isDark);
|
|
449
|
+
if (value === void 0) continue;
|
|
450
|
+
if (disableAnimation) {
|
|
451
|
+
staticStyles2[key3] = value;
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
if (canAnimateProperty(key3, value, animateOnly2)) {
|
|
455
|
+
animated[key3] = value;
|
|
456
|
+
} else {
|
|
457
|
+
staticStyles2[key3] = value;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (isMounting) {
|
|
461
|
+
for (var key1 in animated) {
|
|
462
|
+
staticStyles2[key1] = animated[key1];
|
|
365
463
|
}
|
|
366
|
-
|
|
464
|
+
}
|
|
465
|
+
return {
|
|
466
|
+
animatedStyles: animated,
|
|
467
|
+
staticStyles: staticStyles2
|
|
468
|
+
};
|
|
469
|
+
}, [disableAnimation, style, isDark, isMounting, props.animateOnly]);
|
|
470
|
+
var {
|
|
471
|
+
baseConfig,
|
|
472
|
+
propertyConfigs
|
|
473
|
+
} = useMemo(function () {
|
|
474
|
+
if (isHydrating) {
|
|
367
475
|
return {
|
|
368
|
-
animatedStyles: animated,
|
|
369
|
-
staticStyles: staticStyles2
|
|
370
|
-
};
|
|
371
|
-
}, [disableAnimation, style, isDark, isMounting, props.animateOnly]),
|
|
372
|
-
{
|
|
373
|
-
baseConfig,
|
|
374
|
-
propertyConfigs
|
|
375
|
-
} = useMemo(function () {
|
|
376
|
-
return isHydrating ? {
|
|
377
476
|
baseConfig: {
|
|
378
477
|
type: "timing",
|
|
379
478
|
duration: 0
|
|
380
479
|
},
|
|
381
480
|
propertyConfigs: {}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
return buildTransitionConfig(props.transition, animations, animationState, getStyleKeys(animatedStyles));
|
|
484
|
+
}, [isHydrating, props.transition, animatedStyles, animationState]);
|
|
485
|
+
var configRef = useSharedValue({
|
|
486
|
+
baseConfig,
|
|
487
|
+
propertyConfigs,
|
|
488
|
+
disableAnimation,
|
|
489
|
+
isHydrating
|
|
490
|
+
});
|
|
390
491
|
useIsomorphicLayoutEffect(function () {
|
|
391
492
|
configRef.set({
|
|
392
493
|
baseConfig,
|
|
@@ -394,16 +495,17 @@ function createAnimations(animationsConfig) {
|
|
|
394
495
|
disableAnimation,
|
|
395
496
|
isHydrating
|
|
396
497
|
});
|
|
397
|
-
}, [baseConfig, propertyConfigs, disableAnimation, isHydrating])
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
498
|
+
}, [baseConfig, propertyConfigs, disableAnimation, isHydrating]);
|
|
499
|
+
useStyleEmitter === null || useStyleEmitter === void 0 ? void 0 : useStyleEmitter(function (nextStyle, effectiveTransition2) {
|
|
500
|
+
var animateOnly2 = props.animateOnly;
|
|
501
|
+
var animated = {};
|
|
502
|
+
var statics = {};
|
|
503
|
+
var transforms2 = [];
|
|
504
|
+
var transitionToUse = effectiveTransition2 !== null && effectiveTransition2 !== void 0 ? effectiveTransition2 : props.transition;
|
|
505
|
+
var {
|
|
506
|
+
baseConfig: newBase,
|
|
507
|
+
propertyConfigs: newPropertyConfigs
|
|
508
|
+
} = buildTransitionConfig(transitionToUse, animations, animationState, getStyleKeys(nextStyle));
|
|
407
509
|
configRef.set({
|
|
408
510
|
baseConfig: newBase,
|
|
409
511
|
propertyConfigs: newPropertyConfigs,
|
|
@@ -411,172 +513,220 @@ function createAnimations(animationsConfig) {
|
|
|
411
513
|
isHydrating: configRef.get().isHydrating
|
|
412
514
|
});
|
|
413
515
|
for (var key3 in nextStyle) {
|
|
414
|
-
var rawValue = nextStyle[key3]
|
|
415
|
-
|
|
416
|
-
if (value
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
516
|
+
var rawValue = nextStyle[key3];
|
|
517
|
+
var value = resolveDynamicValue(rawValue, isDark);
|
|
518
|
+
if (value == void 0) continue;
|
|
519
|
+
if (configRef.get().disableAnimation) {
|
|
520
|
+
statics[key3] = value;
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
if (key3 === "transform" && Array.isArray(value)) {
|
|
524
|
+
var _iteratorNormalCompletion2 = true,
|
|
525
|
+
_didIteratorError2 = false,
|
|
526
|
+
_iteratorError2 = void 0;
|
|
527
|
+
try {
|
|
528
|
+
for (var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
529
|
+
var t2 = _step2.value;
|
|
530
|
+
if (t2 && (typeof t2 === "undefined" ? "undefined" : _type_of(t2)) === "object") {
|
|
531
|
+
var tKey2 = Object.keys(t2)[0];
|
|
532
|
+
var tVal = t2[tKey2];
|
|
533
|
+
if (typeof tVal === "number" || typeof tVal === "string") {
|
|
534
|
+
transforms2.push(t2);
|
|
432
535
|
}
|
|
433
536
|
}
|
|
434
|
-
}
|
|
435
|
-
|
|
537
|
+
}
|
|
538
|
+
} catch (err) {
|
|
539
|
+
_didIteratorError2 = true;
|
|
540
|
+
_iteratorError2 = err;
|
|
541
|
+
} finally {
|
|
542
|
+
try {
|
|
543
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
544
|
+
_iterator2.return();
|
|
545
|
+
}
|
|
436
546
|
} finally {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
} finally {
|
|
440
|
-
if (_didIteratorError2) throw _iteratorError2;
|
|
547
|
+
if (_didIteratorError2) {
|
|
548
|
+
throw _iteratorError2;
|
|
441
549
|
}
|
|
442
550
|
}
|
|
443
|
-
continue;
|
|
444
551
|
}
|
|
445
|
-
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
if (canAnimateProperty(key3, value, animateOnly2)) {
|
|
555
|
+
animated[key3] = value;
|
|
556
|
+
} else {
|
|
557
|
+
statics[key3] = value;
|
|
446
558
|
}
|
|
447
559
|
}
|
|
448
|
-
animatedTargetsRef.set(animated)
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
560
|
+
animatedTargetsRef.set(animated);
|
|
561
|
+
staticTargetsRef.set(statics);
|
|
562
|
+
transformTargetsRef.set(transforms2);
|
|
563
|
+
if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
|
|
564
|
+
console.info("[animations-reanimated] useStyleEmitter update", {
|
|
565
|
+
animated,
|
|
566
|
+
statics,
|
|
567
|
+
transforms: transforms2
|
|
568
|
+
});
|
|
569
|
+
}
|
|
453
570
|
});
|
|
454
|
-
var exitKeysRegistered = useRef(
|
|
571
|
+
var exitKeysRegistered = useRef(false);
|
|
455
572
|
if (justStartedExiting && sendExitComplete) {
|
|
456
|
-
var exitKeys = []
|
|
457
|
-
|
|
458
|
-
for (var key2 in animatedStyles)
|
|
573
|
+
var exitKeys = [];
|
|
574
|
+
var animateOnly = props.animateOnly;
|
|
575
|
+
for (var key2 in animatedStyles) {
|
|
576
|
+
if (key2 === "transform") continue;
|
|
577
|
+
if (canAnimateProperty(key2, animatedStyles[key2], animateOnly)) {
|
|
578
|
+
exitKeys.push(key2);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
459
581
|
var transforms = animatedStyles.transform;
|
|
460
582
|
if (transforms && Array.isArray(transforms)) {
|
|
461
|
-
var _iteratorNormalCompletion =
|
|
462
|
-
_didIteratorError =
|
|
583
|
+
var _iteratorNormalCompletion = true,
|
|
584
|
+
_didIteratorError = false,
|
|
463
585
|
_iteratorError = void 0;
|
|
464
586
|
try {
|
|
465
|
-
for (var _iterator = transforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion =
|
|
587
|
+
for (var _iterator = transforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
466
588
|
var t = _step.value;
|
|
467
|
-
if (t)
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
589
|
+
if (!t) continue;
|
|
590
|
+
var tKey = Object.keys(t)[0];
|
|
591
|
+
if (tKey) {
|
|
592
|
+
if (animateOnly && !animateOnly.includes(tKey)) {
|
|
593
|
+
continue;
|
|
472
594
|
}
|
|
595
|
+
exitKeys.push(`transform:${tKey}`);
|
|
473
596
|
}
|
|
474
597
|
}
|
|
475
598
|
} catch (err) {
|
|
476
|
-
_didIteratorError =
|
|
599
|
+
_didIteratorError = true;
|
|
600
|
+
_iteratorError = err;
|
|
477
601
|
} finally {
|
|
478
602
|
try {
|
|
479
|
-
!_iteratorNormalCompletion && _iterator.return != null
|
|
603
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
604
|
+
_iterator.return();
|
|
605
|
+
}
|
|
480
606
|
} finally {
|
|
481
|
-
if (_didIteratorError)
|
|
607
|
+
if (_didIteratorError) {
|
|
608
|
+
throw _iteratorError;
|
|
609
|
+
}
|
|
482
610
|
}
|
|
483
611
|
}
|
|
484
612
|
}
|
|
485
|
-
pendingExitKeysRef.current = new Set(exitKeys)
|
|
613
|
+
pendingExitKeysRef.current = new Set(exitKeys);
|
|
614
|
+
exitKeysRegistered.current = exitKeys.length > 0;
|
|
486
615
|
}
|
|
487
616
|
React.useEffect(function () {
|
|
488
|
-
!justStartedExiting || !sendExitComplete
|
|
617
|
+
if (!justStartedExiting || !sendExitComplete) return;
|
|
618
|
+
if (!exitKeysRegistered.current && pendingExitKeysRef.current.size === 0) {
|
|
619
|
+
if (!exitCompletedRef.current) {
|
|
620
|
+
exitCompletedRef.current = true;
|
|
621
|
+
sendExitComplete();
|
|
622
|
+
}
|
|
623
|
+
}
|
|
489
624
|
}, [justStartedExiting, sendExitComplete]);
|
|
490
625
|
var animatedStyle = useAnimatedStyle(function () {
|
|
491
626
|
"worklet";
|
|
492
627
|
|
|
493
628
|
var _loop = function (key12) {
|
|
494
629
|
if (key12 === "transform") return "continue";
|
|
495
|
-
var targetValue = animatedValues[key12]
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
630
|
+
var targetValue = animatedValues[key12];
|
|
631
|
+
var _config_propertyConfigs_key;
|
|
632
|
+
var propConfig = (_config_propertyConfigs_key = config.propertyConfigs[key12]) !== null && _config_propertyConfigs_key !== void 0 ? _config_propertyConfigs_key : config.baseConfig;
|
|
633
|
+
var callback = void 0;
|
|
499
634
|
if (currentlyExiting) {
|
|
500
|
-
var capturedKey = key12
|
|
501
|
-
|
|
635
|
+
var capturedKey = key12;
|
|
636
|
+
var capturedCycleId = currentCycleId;
|
|
502
637
|
callback = function (finished) {
|
|
503
638
|
"worklet";
|
|
504
639
|
|
|
505
|
-
runOnJS(markExitKeyDone)(capturedKey, capturedCycleId, finished
|
|
640
|
+
runOnJS(markExitKeyDone)(capturedKey, capturedCycleId, finished !== null && finished !== void 0 ? finished : false);
|
|
506
641
|
};
|
|
507
642
|
}
|
|
508
643
|
result[key12] = applyAnimation(targetValue, propConfig, callback);
|
|
509
644
|
};
|
|
510
|
-
if (disableAnimation || isHydrating)
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
645
|
+
if (disableAnimation || isHydrating) {
|
|
646
|
+
return {};
|
|
647
|
+
}
|
|
648
|
+
var result = {};
|
|
649
|
+
var config = configRef.get();
|
|
650
|
+
var emitterAnimated = animatedTargetsRef.value;
|
|
651
|
+
var emitterStatic = staticTargetsRef.value;
|
|
652
|
+
var emitterTransforms = transformTargetsRef.value;
|
|
653
|
+
var hasEmitterUpdates = emitterAnimated !== null;
|
|
654
|
+
var animatedValues = hasEmitterUpdates ? emitterAnimated : animatedStyles;
|
|
655
|
+
var staticValues = hasEmitterUpdates ? emitterStatic : {};
|
|
656
|
+
var currentlyExiting = isExitingRef.value;
|
|
657
|
+
var currentCycleId = exitCycleIdShared.value;
|
|
658
|
+
for (var key3 in staticValues) {
|
|
659
|
+
result[key3] = staticValues[key3];
|
|
660
|
+
}
|
|
522
661
|
for (var key1 in animatedValues) _loop(key1);
|
|
523
662
|
var transforms2 = hasEmitterUpdates ? emitterTransforms : animatedStyles.transform;
|
|
524
663
|
if (transforms2 && Array.isArray(transforms2)) {
|
|
525
|
-
var validTransforms = []
|
|
526
|
-
|
|
527
|
-
_didIteratorError2 =
|
|
664
|
+
var validTransforms = [];
|
|
665
|
+
var _iteratorNormalCompletion2 = true,
|
|
666
|
+
_didIteratorError2 = false,
|
|
528
667
|
_iteratorError2 = void 0;
|
|
529
668
|
try {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
669
|
+
var _loop1 = function () {
|
|
670
|
+
var t2 = _step2.value;
|
|
671
|
+
if (!t2) return "continue";
|
|
672
|
+
var keys = Object.keys(t2);
|
|
673
|
+
if (keys.length === 0) return "continue";
|
|
674
|
+
var value = t2[keys[0]];
|
|
675
|
+
if (typeof value === "number" || typeof value === "string") {
|
|
676
|
+
var transformKey = Object.keys(t2)[0];
|
|
677
|
+
var targetValue = t2[transformKey];
|
|
678
|
+
var _config_propertyConfigs_transformKey;
|
|
679
|
+
var propConfig = (_config_propertyConfigs_transformKey = config.propertyConfigs[transformKey]) !== null && _config_propertyConfigs_transformKey !== void 0 ? _config_propertyConfigs_transformKey : config.baseConfig;
|
|
680
|
+
var callback = void 0;
|
|
681
|
+
if (currentlyExiting) {
|
|
682
|
+
var capturedKey = `transform:${transformKey}`;
|
|
683
|
+
var capturedCycleId = currentCycleId;
|
|
684
|
+
callback = function (finished) {
|
|
685
|
+
"worklet";
|
|
547
686
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
}
|
|
551
|
-
validTransforms.push({
|
|
552
|
-
[transformKey]: applyAnimation(targetValue, propConfig, callback)
|
|
553
|
-
});
|
|
687
|
+
runOnJS(markExitKeyDone)(capturedKey, capturedCycleId, finished !== null && finished !== void 0 ? finished : false);
|
|
688
|
+
};
|
|
554
689
|
}
|
|
555
|
-
|
|
690
|
+
validTransforms.push({
|
|
691
|
+
[transformKey]: applyAnimation(targetValue, propConfig, callback)
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
for (var _iterator2 = transforms2[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) _loop1();
|
|
556
696
|
} catch (err) {
|
|
557
|
-
_didIteratorError2 =
|
|
697
|
+
_didIteratorError2 = true;
|
|
698
|
+
_iteratorError2 = err;
|
|
558
699
|
} finally {
|
|
559
700
|
try {
|
|
560
|
-
!_iteratorNormalCompletion2 && _iterator2.return != null
|
|
701
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
702
|
+
_iterator2.return();
|
|
703
|
+
}
|
|
561
704
|
} finally {
|
|
562
|
-
if (_didIteratorError2)
|
|
705
|
+
if (_didIteratorError2) {
|
|
706
|
+
throw _iteratorError2;
|
|
707
|
+
}
|
|
563
708
|
}
|
|
564
709
|
}
|
|
565
|
-
validTransforms.length > 0
|
|
710
|
+
if (validTransforms.length > 0) {
|
|
711
|
+
result.transform = validTransforms;
|
|
712
|
+
}
|
|
566
713
|
}
|
|
567
714
|
return result;
|
|
568
|
-
}, [animatedStyles, baseConfig, propertyConfigs, disableAnimation, isHydrating,
|
|
569
|
-
//
|
|
570
|
-
animatedTargetsRef, staticTargetsRef, transformTargetsRef, isExitingRef, exitCycleIdShared, markExitKeyDone]);
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
715
|
+
}, isWeb ? [animatedStyles, baseConfig, propertyConfigs, disableAnimation, isHydrating,
|
|
716
|
+
// pass SharedValues so the mapper watches them on web (no babel plugin)
|
|
717
|
+
animatedTargetsRef, staticTargetsRef, transformTargetsRef, isExitingRef, exitCycleIdShared, markExitKeyDone] : void 0);
|
|
718
|
+
if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
|
|
719
|
+
console.info("[animations-reanimated] useAnimations", {
|
|
720
|
+
animationKey,
|
|
721
|
+
componentState,
|
|
722
|
+
isExiting,
|
|
723
|
+
animatedStyles,
|
|
724
|
+
staticStyles,
|
|
725
|
+
baseConfig,
|
|
726
|
+
propertyConfigs
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
return {
|
|
580
730
|
style: [staticStyles, animatedStyle]
|
|
581
731
|
};
|
|
582
732
|
}
|