@amazon-devices/react-navigation__stack 8.0.9000000000 → 8.0.9000000002
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/SystemModules/amzn__react-navigation__stack-8.private.modules.txt +39 -34
- package/kepler-compatibility.json +4 -2
- package/lib/module/index.js +0 -34
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/oss-attribution/attribution.txt +76 -0
- package/oss-attribution/licenseInfos.json +27 -0
- package/package.json +1 -1
- package/src/index.tsx +0 -55
- package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.bundle +0 -13464
- package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.map +0 -4638
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js +0 -394
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +0 -262
- package/lib/module/TransitionConfigs/TransitionPresets.js +0 -156
- package/lib/module/TransitionConfigs/TransitionSpecs.js +0 -124
- package/lib/module/navigators/createStackNavigator.js +0 -71
- package/lib/module/types.js +0 -4
- package/lib/module/utils/CardAnimationContext.js +0 -5
- package/lib/module/utils/GestureHandlerRefContext.js +0 -5
- package/lib/module/utils/ModalPresentationContext.js +0 -5
- package/lib/module/utils/conditional.js +0 -28
- package/lib/module/utils/findLastIndex.js +0 -11
- package/lib/module/utils/gestureActivationCriteria.js +0 -60
- package/lib/module/utils/getDistanceForDirection.js +0 -15
- package/lib/module/utils/getInvertedMultiplier.js +0 -15
- package/lib/module/utils/getModalRoutesKeys.js +0 -12
- package/lib/module/utils/getShadowStyle.js +0 -24
- package/lib/module/utils/throttle.js +0 -14
- package/lib/module/utils/useCardAnimation.js +0 -12
- package/lib/module/utils/useGestureHandlerRef.js +0 -12
- package/lib/module/utils/useKeyboardManager.js +0 -90
- package/lib/module/views/GestureHandler.android.js +0 -4
- package/lib/module/views/GestureHandler.ios.js +0 -4
- package/lib/module/views/GestureHandler.js +0 -21
- package/lib/module/views/GestureHandler.kepler.js +0 -4
- package/lib/module/views/GestureHandlerNative.js +0 -18
- package/lib/module/views/Header/Header.js +0 -56
- package/lib/module/views/Header/HeaderContainer.js +0 -128
- package/lib/module/views/Header/HeaderSegment.js +0 -142
- package/lib/module/views/Screens.js +0 -42
- package/lib/module/views/Stack/Card.js +0 -433
- package/lib/module/views/Stack/CardA11yWrapper.js +0 -43
- package/lib/module/views/Stack/CardContainer.js +0 -276
- package/lib/module/views/Stack/CardContent.js +0 -74
- package/lib/module/views/Stack/CardStack.js +0 -493
- package/lib/module/views/Stack/StackView.js +0 -339
- package/src/TransitionConfigs/CardStyleInterpolators.tsx +0 -460
- package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +0 -286
- package/src/TransitionConfigs/TransitionPresets.tsx +0 -182
- package/src/TransitionConfigs/TransitionSpecs.tsx +0 -124
- package/src/navigators/createStackNavigator.tsx +0 -120
- package/src/types.tsx +0 -639
- package/src/utils/CardAnimationContext.tsx +0 -7
- package/src/utils/GestureHandlerRefContext.tsx +0 -5
- package/src/utils/ModalPresentationContext.tsx +0 -3
- package/src/utils/conditional.tsx +0 -33
- package/src/utils/findLastIndex.tsx +0 -9
- package/src/utils/gestureActivationCriteria.tsx +0 -70
- package/src/utils/getDistanceForDirection.tsx +0 -19
- package/src/utils/getInvertedMultiplier.tsx +0 -17
- package/src/utils/getModalRoutesKeys.ts +0 -21
- package/src/utils/getShadowStyle.tsx +0 -37
- package/src/utils/throttle.tsx +0 -16
- package/src/utils/useCardAnimation.tsx +0 -15
- package/src/utils/useGestureHandlerRef.tsx +0 -15
- package/src/utils/useKeyboardManager.tsx +0 -103
- package/src/views/GestureHandler.android.tsx +0 -1
- package/src/views/GestureHandler.ios.tsx +0 -1
- package/src/views/GestureHandler.kepler.tsx +0 -1
- package/src/views/GestureHandler.tsx +0 -23
- package/src/views/GestureHandlerNative.tsx +0 -23
- package/src/views/Header/Header.tsx +0 -73
- package/src/views/Header/HeaderContainer.tsx +0 -191
- package/src/views/Header/HeaderSegment.tsx +0 -203
- package/src/views/Screens.tsx +0 -45
- package/src/views/Stack/Card.tsx +0 -646
- package/src/views/Stack/CardA11yWrapper.tsx +0 -67
- package/src/views/Stack/CardContainer.tsx +0 -339
- package/src/views/Stack/CardContent.tsx +0 -92
- package/src/views/Stack/CardStack.tsx +0 -844
- package/src/views/Stack/StackView.tsx +0 -485
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Animated, Platform } from 'react-native';
|
|
4
|
-
import { conditional } from "../utils/conditional.js";
|
|
5
|
-
const {
|
|
6
|
-
add,
|
|
7
|
-
multiply
|
|
8
|
-
} = Animated;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Standard iOS-style slide in from the right.
|
|
12
|
-
*/
|
|
13
|
-
export function forHorizontalIOS({
|
|
14
|
-
current,
|
|
15
|
-
next,
|
|
16
|
-
inverted,
|
|
17
|
-
layouts: {
|
|
18
|
-
screen
|
|
19
|
-
}
|
|
20
|
-
}) {
|
|
21
|
-
const translateFocused = multiply(current.progress.interpolate({
|
|
22
|
-
inputRange: [0, 1],
|
|
23
|
-
outputRange: [screen.width, 0],
|
|
24
|
-
extrapolate: 'clamp'
|
|
25
|
-
}), inverted);
|
|
26
|
-
const translateUnfocused = next ? multiply(next.progress.interpolate({
|
|
27
|
-
inputRange: [0, 1],
|
|
28
|
-
outputRange: [0, screen.width * -0.3],
|
|
29
|
-
extrapolate: 'clamp'
|
|
30
|
-
}), inverted) : 0;
|
|
31
|
-
const overlayOpacity = current.progress.interpolate({
|
|
32
|
-
inputRange: [0, 1],
|
|
33
|
-
outputRange: [0, 0.07],
|
|
34
|
-
extrapolate: 'clamp'
|
|
35
|
-
});
|
|
36
|
-
const shadowOpacity = current.progress.interpolate({
|
|
37
|
-
inputRange: [0, 1],
|
|
38
|
-
outputRange: [0, 0.3],
|
|
39
|
-
extrapolate: 'clamp'
|
|
40
|
-
});
|
|
41
|
-
return {
|
|
42
|
-
cardStyle: {
|
|
43
|
-
transform: [
|
|
44
|
-
// Translation for the animation of the current card
|
|
45
|
-
{
|
|
46
|
-
translateX: translateFocused
|
|
47
|
-
},
|
|
48
|
-
// Translation for the animation of the card on top of this
|
|
49
|
-
{
|
|
50
|
-
translateX: translateUnfocused
|
|
51
|
-
}]
|
|
52
|
-
},
|
|
53
|
-
overlayStyle: {
|
|
54
|
-
opacity: overlayOpacity
|
|
55
|
-
},
|
|
56
|
-
shadowStyle: {
|
|
57
|
-
shadowOpacity
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* iOS-style slide in from the left.
|
|
64
|
-
*/
|
|
65
|
-
export function forHorizontalIOSInverted({
|
|
66
|
-
inverted,
|
|
67
|
-
...rest
|
|
68
|
-
}) {
|
|
69
|
-
return forHorizontalIOS({
|
|
70
|
-
...rest,
|
|
71
|
-
inverted: Animated.multiply(inverted, -1)
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Standard iOS-style slide in from the bottom (used for modals).
|
|
77
|
-
*/
|
|
78
|
-
export function forVerticalIOS({
|
|
79
|
-
current,
|
|
80
|
-
inverted,
|
|
81
|
-
layouts: {
|
|
82
|
-
screen
|
|
83
|
-
}
|
|
84
|
-
}) {
|
|
85
|
-
const translateY = multiply(current.progress.interpolate({
|
|
86
|
-
inputRange: [0, 1],
|
|
87
|
-
outputRange: [screen.height, 0],
|
|
88
|
-
extrapolate: 'clamp'
|
|
89
|
-
}), inverted);
|
|
90
|
-
return {
|
|
91
|
-
cardStyle: {
|
|
92
|
-
transform: [{
|
|
93
|
-
translateY
|
|
94
|
-
}]
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Standard iOS-style modal animation in iOS 13.
|
|
101
|
-
*/
|
|
102
|
-
export function forModalPresentationIOS({
|
|
103
|
-
index,
|
|
104
|
-
current,
|
|
105
|
-
next,
|
|
106
|
-
inverted,
|
|
107
|
-
layouts: {
|
|
108
|
-
screen
|
|
109
|
-
},
|
|
110
|
-
insets
|
|
111
|
-
}) {
|
|
112
|
-
const hasNotchIos = Platform.OS === 'ios' && !Platform.isPad && !Platform.isTV && insets.top > 20;
|
|
113
|
-
const isLandscape = screen.width > screen.height;
|
|
114
|
-
const topOffset = isLandscape ? 0 : 10;
|
|
115
|
-
const statusBarHeight = insets.top;
|
|
116
|
-
const aspectRatio = screen.height / screen.width;
|
|
117
|
-
const progress = add(current.progress.interpolate({
|
|
118
|
-
inputRange: [0, 1],
|
|
119
|
-
outputRange: [0, 1],
|
|
120
|
-
extrapolate: 'clamp'
|
|
121
|
-
}), next ? next.progress.interpolate({
|
|
122
|
-
inputRange: [0, 1],
|
|
123
|
-
outputRange: [0, 1],
|
|
124
|
-
extrapolate: 'clamp'
|
|
125
|
-
}) : 0);
|
|
126
|
-
const isFirst = index === 0;
|
|
127
|
-
const translateY = multiply(progress.interpolate({
|
|
128
|
-
inputRange: [0, 1, 2],
|
|
129
|
-
outputRange: [screen.height, isFirst ? 0 : topOffset, (isFirst ? statusBarHeight : 0) - topOffset * aspectRatio]
|
|
130
|
-
}), inverted);
|
|
131
|
-
const overlayOpacity = progress.interpolate({
|
|
132
|
-
inputRange: [0, 1, 1.0001, 2],
|
|
133
|
-
outputRange: [0, 0.3, 1, 1]
|
|
134
|
-
});
|
|
135
|
-
const scale = isLandscape ? 1 : progress.interpolate({
|
|
136
|
-
inputRange: [0, 1, 2],
|
|
137
|
-
outputRange: [1, 1, screen.width ? 1 - topOffset * 2 / screen.width : 1]
|
|
138
|
-
});
|
|
139
|
-
const borderRadius = isLandscape ? 0 : isFirst ? progress.interpolate({
|
|
140
|
-
inputRange: [0, 1, 1.0001, 2],
|
|
141
|
-
outputRange: [0, 0, hasNotchIos ? 38 : 0, 10]
|
|
142
|
-
}) : 10;
|
|
143
|
-
return {
|
|
144
|
-
cardStyle: {
|
|
145
|
-
overflow: 'hidden',
|
|
146
|
-
borderCurve: 'continuous',
|
|
147
|
-
borderTopLeftRadius: borderRadius,
|
|
148
|
-
borderTopRightRadius: borderRadius,
|
|
149
|
-
// We don't need these for the animation
|
|
150
|
-
// But different border radius for corners improves animation perf
|
|
151
|
-
borderBottomLeftRadius: hasNotchIos ? borderRadius : 0,
|
|
152
|
-
borderBottomRightRadius: hasNotchIos ? borderRadius : 0,
|
|
153
|
-
marginTop: isFirst ? 0 : statusBarHeight,
|
|
154
|
-
marginBottom: isFirst ? 0 : topOffset,
|
|
155
|
-
transform: [{
|
|
156
|
-
translateY
|
|
157
|
-
}, {
|
|
158
|
-
scale
|
|
159
|
-
}]
|
|
160
|
-
},
|
|
161
|
-
overlayStyle: {
|
|
162
|
-
opacity: overlayOpacity
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Standard Android-style fade in from the bottom for Android Oreo.
|
|
169
|
-
*/
|
|
170
|
-
export function forFadeFromBottomAndroid({
|
|
171
|
-
current,
|
|
172
|
-
inverted,
|
|
173
|
-
layouts: {
|
|
174
|
-
screen
|
|
175
|
-
},
|
|
176
|
-
closing
|
|
177
|
-
}) {
|
|
178
|
-
const translateY = multiply(current.progress.interpolate({
|
|
179
|
-
inputRange: [0, 1],
|
|
180
|
-
outputRange: [screen.height * 0.08, 0],
|
|
181
|
-
extrapolate: 'clamp'
|
|
182
|
-
}), inverted);
|
|
183
|
-
const opacity = conditional(closing, current.progress, current.progress.interpolate({
|
|
184
|
-
inputRange: [0, 0.5, 0.9, 1],
|
|
185
|
-
outputRange: [0, 0.25, 0.7, 1],
|
|
186
|
-
extrapolate: 'clamp'
|
|
187
|
-
}));
|
|
188
|
-
return {
|
|
189
|
-
cardStyle: {
|
|
190
|
-
opacity,
|
|
191
|
-
transform: [{
|
|
192
|
-
translateY
|
|
193
|
-
}]
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Standard Android-style reveal from the bottom for Android Pie.
|
|
200
|
-
*/
|
|
201
|
-
export function forRevealFromBottomAndroid({
|
|
202
|
-
current,
|
|
203
|
-
next,
|
|
204
|
-
inverted,
|
|
205
|
-
layouts: {
|
|
206
|
-
screen
|
|
207
|
-
}
|
|
208
|
-
}) {
|
|
209
|
-
const containerTranslateY = multiply(current.progress.interpolate({
|
|
210
|
-
inputRange: [0, 1],
|
|
211
|
-
outputRange: [screen.height, 0],
|
|
212
|
-
extrapolate: 'clamp'
|
|
213
|
-
}), inverted);
|
|
214
|
-
const cardTranslateYFocused = multiply(current.progress.interpolate({
|
|
215
|
-
inputRange: [0, 1],
|
|
216
|
-
outputRange: [screen.height * (95.9 / 100) * -1, 0],
|
|
217
|
-
extrapolate: 'clamp'
|
|
218
|
-
}), inverted);
|
|
219
|
-
const cardTranslateYUnfocused = next ? multiply(next.progress.interpolate({
|
|
220
|
-
inputRange: [0, 1],
|
|
221
|
-
outputRange: [0, screen.height * (2 / 100) * -1],
|
|
222
|
-
extrapolate: 'clamp'
|
|
223
|
-
}), inverted) : 0;
|
|
224
|
-
const overlayOpacity = current.progress.interpolate({
|
|
225
|
-
inputRange: [0, 0.36, 1],
|
|
226
|
-
outputRange: [0, 0.1, 0.1],
|
|
227
|
-
extrapolate: 'clamp'
|
|
228
|
-
});
|
|
229
|
-
return {
|
|
230
|
-
containerStyle: {
|
|
231
|
-
overflow: 'hidden',
|
|
232
|
-
transform: [{
|
|
233
|
-
translateY: containerTranslateY
|
|
234
|
-
}]
|
|
235
|
-
},
|
|
236
|
-
cardStyle: {
|
|
237
|
-
transform: [{
|
|
238
|
-
translateY: cardTranslateYFocused
|
|
239
|
-
}, {
|
|
240
|
-
translateY: cardTranslateYUnfocused
|
|
241
|
-
}]
|
|
242
|
-
},
|
|
243
|
-
overlayStyle: {
|
|
244
|
-
opacity: overlayOpacity
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Standard Android-style zoom for Android 10.
|
|
251
|
-
*/
|
|
252
|
-
export function forScaleFromCenterAndroid({
|
|
253
|
-
current,
|
|
254
|
-
next,
|
|
255
|
-
closing
|
|
256
|
-
}) {
|
|
257
|
-
const progress = add(current.progress.interpolate({
|
|
258
|
-
inputRange: [0, 1],
|
|
259
|
-
outputRange: [0, 1],
|
|
260
|
-
extrapolate: 'clamp'
|
|
261
|
-
}), next ? next.progress.interpolate({
|
|
262
|
-
inputRange: [0, 1],
|
|
263
|
-
outputRange: [0, 1],
|
|
264
|
-
extrapolate: 'clamp'
|
|
265
|
-
}) : 0);
|
|
266
|
-
const opacity = progress.interpolate({
|
|
267
|
-
inputRange: [0, 0.75, 0.875, 1, 1.0825, 1.2075, 2],
|
|
268
|
-
outputRange: [0, 0, 1, 1, 1, 1, 0]
|
|
269
|
-
});
|
|
270
|
-
const scale = conditional(closing, current.progress.interpolate({
|
|
271
|
-
inputRange: [0, 1],
|
|
272
|
-
outputRange: [0.925, 1],
|
|
273
|
-
extrapolate: 'clamp'
|
|
274
|
-
}), progress.interpolate({
|
|
275
|
-
inputRange: [0, 1, 2],
|
|
276
|
-
outputRange: [0.85, 1, 1.075]
|
|
277
|
-
}));
|
|
278
|
-
return {
|
|
279
|
-
cardStyle: {
|
|
280
|
-
opacity,
|
|
281
|
-
transform: [{
|
|
282
|
-
scale
|
|
283
|
-
}]
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Standard Android-style fade from right for Android 14.
|
|
290
|
-
*/
|
|
291
|
-
export function forFadeFromRightAndroid({
|
|
292
|
-
current,
|
|
293
|
-
next,
|
|
294
|
-
inverted,
|
|
295
|
-
closing
|
|
296
|
-
}) {
|
|
297
|
-
const translateFocused = multiply(current.progress.interpolate({
|
|
298
|
-
inputRange: [0, 1],
|
|
299
|
-
outputRange: [96, 0],
|
|
300
|
-
extrapolate: 'clamp'
|
|
301
|
-
}), inverted);
|
|
302
|
-
const translateUnfocused = next ? multiply(next.progress.interpolate({
|
|
303
|
-
inputRange: [0, 1],
|
|
304
|
-
outputRange: [0, -96],
|
|
305
|
-
extrapolate: 'clamp'
|
|
306
|
-
}), inverted) : 0;
|
|
307
|
-
const opacity = conditional(closing, current.progress.interpolate({
|
|
308
|
-
inputRange: [0, 1],
|
|
309
|
-
outputRange: [0, 1],
|
|
310
|
-
extrapolate: 'clamp'
|
|
311
|
-
}), current.progress);
|
|
312
|
-
return {
|
|
313
|
-
cardStyle: {
|
|
314
|
-
opacity,
|
|
315
|
-
transform: [
|
|
316
|
-
// Translation for the animation of the current card
|
|
317
|
-
{
|
|
318
|
-
translateX: translateFocused
|
|
319
|
-
},
|
|
320
|
-
// Translation for the animation of the card on top of this
|
|
321
|
-
{
|
|
322
|
-
translateX: translateUnfocused
|
|
323
|
-
}]
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Standard bottom sheet slide in from the bottom for Android.
|
|
330
|
-
*/
|
|
331
|
-
export function forBottomSheetAndroid({
|
|
332
|
-
current,
|
|
333
|
-
inverted,
|
|
334
|
-
layouts: {
|
|
335
|
-
screen
|
|
336
|
-
},
|
|
337
|
-
closing
|
|
338
|
-
}) {
|
|
339
|
-
const translateY = multiply(current.progress.interpolate({
|
|
340
|
-
inputRange: [0, 1],
|
|
341
|
-
outputRange: [screen.height * 0.8, 0],
|
|
342
|
-
extrapolate: 'clamp'
|
|
343
|
-
}), inverted);
|
|
344
|
-
const opacity = conditional(closing, current.progress, current.progress.interpolate({
|
|
345
|
-
inputRange: [0, 1],
|
|
346
|
-
outputRange: [0, 1],
|
|
347
|
-
extrapolate: 'clamp'
|
|
348
|
-
}));
|
|
349
|
-
const overlayOpacity = current.progress.interpolate({
|
|
350
|
-
inputRange: [0, 1],
|
|
351
|
-
outputRange: [0, 0.3],
|
|
352
|
-
extrapolate: 'clamp'
|
|
353
|
-
});
|
|
354
|
-
return {
|
|
355
|
-
cardStyle: {
|
|
356
|
-
opacity,
|
|
357
|
-
transform: [{
|
|
358
|
-
translateY
|
|
359
|
-
}]
|
|
360
|
-
},
|
|
361
|
-
overlayStyle: {
|
|
362
|
-
opacity: overlayOpacity
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Simple fade animation for dialogs
|
|
369
|
-
*/
|
|
370
|
-
export function forFadeFromCenter({
|
|
371
|
-
current: {
|
|
372
|
-
progress
|
|
373
|
-
}
|
|
374
|
-
}) {
|
|
375
|
-
return {
|
|
376
|
-
cardStyle: {
|
|
377
|
-
opacity: progress.interpolate({
|
|
378
|
-
inputRange: [0, 0.5, 0.9, 1],
|
|
379
|
-
outputRange: [0, 0.25, 0.7, 1]
|
|
380
|
-
})
|
|
381
|
-
},
|
|
382
|
-
overlayStyle: {
|
|
383
|
-
opacity: progress.interpolate({
|
|
384
|
-
inputRange: [0, 1],
|
|
385
|
-
outputRange: [0, 0.5],
|
|
386
|
-
extrapolate: 'clamp'
|
|
387
|
-
})
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
export function forNoAnimation() {
|
|
392
|
-
return {};
|
|
393
|
-
}
|
|
394
|
-
//# sourceMappingURL=CardStyleInterpolators.js.map
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Animated, Platform } from 'react-native';
|
|
4
|
-
const {
|
|
5
|
-
add,
|
|
6
|
-
multiply
|
|
7
|
-
} = Animated;
|
|
8
|
-
|
|
9
|
-
// Width of the screen in split layout on portrait mode on iPad Mini
|
|
10
|
-
// Keep in sync with HeaderBackButton.tsx
|
|
11
|
-
const IPAD_MINI_MEDIUM_WIDTH = 414;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Standard UIKit style animation for the header where the title fades into the back button label.
|
|
15
|
-
*/
|
|
16
|
-
export function forUIKit({
|
|
17
|
-
current,
|
|
18
|
-
next,
|
|
19
|
-
direction,
|
|
20
|
-
layouts
|
|
21
|
-
}) {
|
|
22
|
-
const defaultOffset = 100;
|
|
23
|
-
const leftSpacing = 27 + (Platform.OS === 'ios' && layouts.screen.width >= IPAD_MINI_MEDIUM_WIDTH ? 5 // Additional padding on iPad specified in Header.tsx
|
|
24
|
-
: 0);
|
|
25
|
-
|
|
26
|
-
// The title and back button title should cross-fade to each other
|
|
27
|
-
// When screen is fully open, the title should be in center, and back title should be on left
|
|
28
|
-
// When screen is closing, the previous title will animate to back title's position
|
|
29
|
-
// And back title will animate to title's position
|
|
30
|
-
// We achieve this by calculating the offsets needed to translate title to back title's position and vice-versa
|
|
31
|
-
const leftLabelOffset = layouts.leftLabel ? (layouts.screen.width - layouts.leftLabel.width) / 2 - leftSpacing : defaultOffset;
|
|
32
|
-
const titleLeftOffset = layouts.title ? (layouts.screen.width - layouts.title.width) / 2 - leftSpacing : defaultOffset;
|
|
33
|
-
|
|
34
|
-
// When the current title is animating to right, it is centered in the right half of screen in middle of transition
|
|
35
|
-
// The back title also animates in from this position
|
|
36
|
-
const rightOffset = layouts.screen.width / 4;
|
|
37
|
-
const multiplier = direction === 'rtl' ? -1 : 1;
|
|
38
|
-
const progress = add(current.progress.interpolate({
|
|
39
|
-
inputRange: [0, 1],
|
|
40
|
-
outputRange: [0, 1],
|
|
41
|
-
extrapolate: 'clamp'
|
|
42
|
-
}), next ? next.progress.interpolate({
|
|
43
|
-
inputRange: [0, 1],
|
|
44
|
-
outputRange: [0, 1],
|
|
45
|
-
extrapolate: 'clamp'
|
|
46
|
-
}) : 0);
|
|
47
|
-
return {
|
|
48
|
-
leftButtonStyle: {
|
|
49
|
-
opacity: progress.interpolate({
|
|
50
|
-
inputRange: [0.3, 1, 1.5],
|
|
51
|
-
outputRange: [0, 1, 0]
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
leftLabelStyle: {
|
|
55
|
-
transform: [{
|
|
56
|
-
translateX: multiply(multiplier, progress.interpolate({
|
|
57
|
-
inputRange: [0, 1, 2],
|
|
58
|
-
outputRange: [leftLabelOffset, 0, -rightOffset]
|
|
59
|
-
}))
|
|
60
|
-
}]
|
|
61
|
-
},
|
|
62
|
-
rightButtonStyle: {
|
|
63
|
-
opacity: progress.interpolate({
|
|
64
|
-
inputRange: [0.3, 1, 1.5],
|
|
65
|
-
outputRange: [0, 1, 0]
|
|
66
|
-
})
|
|
67
|
-
},
|
|
68
|
-
titleStyle: {
|
|
69
|
-
opacity: progress.interpolate({
|
|
70
|
-
inputRange: [0, 0.5, 0.75, 1, 1.5],
|
|
71
|
-
outputRange: [0, 0, 0.1, 1, 0]
|
|
72
|
-
}),
|
|
73
|
-
transform: [{
|
|
74
|
-
translateX: multiply(multiplier, progress.interpolate({
|
|
75
|
-
inputRange: [0.5, 1, 2],
|
|
76
|
-
outputRange: [rightOffset, 0, -titleLeftOffset]
|
|
77
|
-
}))
|
|
78
|
-
}]
|
|
79
|
-
},
|
|
80
|
-
backgroundStyle: {
|
|
81
|
-
transform: [{
|
|
82
|
-
translateX: multiply(multiplier, progress.interpolate({
|
|
83
|
-
inputRange: [0, 1, 2],
|
|
84
|
-
outputRange: [layouts.screen.width, 0, -layouts.screen.width]
|
|
85
|
-
}))
|
|
86
|
-
}]
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Simple fade animation for the header elements.
|
|
93
|
-
*/
|
|
94
|
-
export function forFade({
|
|
95
|
-
current,
|
|
96
|
-
next
|
|
97
|
-
}) {
|
|
98
|
-
const progress = add(current.progress.interpolate({
|
|
99
|
-
inputRange: [0, 1],
|
|
100
|
-
outputRange: [0, 1],
|
|
101
|
-
extrapolate: 'clamp'
|
|
102
|
-
}), next ? next.progress.interpolate({
|
|
103
|
-
inputRange: [0, 1],
|
|
104
|
-
outputRange: [0, 1],
|
|
105
|
-
extrapolate: 'clamp'
|
|
106
|
-
}) : 0);
|
|
107
|
-
const opacity = progress.interpolate({
|
|
108
|
-
inputRange: [0, 1, 2],
|
|
109
|
-
outputRange: [0, 1, 0]
|
|
110
|
-
});
|
|
111
|
-
return {
|
|
112
|
-
leftButtonStyle: {
|
|
113
|
-
opacity
|
|
114
|
-
},
|
|
115
|
-
rightButtonStyle: {
|
|
116
|
-
opacity
|
|
117
|
-
},
|
|
118
|
-
titleStyle: {
|
|
119
|
-
opacity
|
|
120
|
-
},
|
|
121
|
-
backgroundStyle: {
|
|
122
|
-
opacity: progress.interpolate({
|
|
123
|
-
inputRange: [0, 1, 1.9, 2],
|
|
124
|
-
outputRange: [0, 1, 1, 0]
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Simple translate animation to translate the header to left.
|
|
132
|
-
*/
|
|
133
|
-
export function forSlideLeft({
|
|
134
|
-
current,
|
|
135
|
-
next,
|
|
136
|
-
direction,
|
|
137
|
-
layouts: {
|
|
138
|
-
screen
|
|
139
|
-
}
|
|
140
|
-
}) {
|
|
141
|
-
const isRTL = direction === 'rtl';
|
|
142
|
-
const progress = add(current.progress.interpolate({
|
|
143
|
-
inputRange: [0, 1],
|
|
144
|
-
outputRange: [0, 1],
|
|
145
|
-
extrapolate: 'clamp'
|
|
146
|
-
}), next ? next.progress.interpolate({
|
|
147
|
-
inputRange: [0, 1],
|
|
148
|
-
outputRange: [0, 1],
|
|
149
|
-
extrapolate: 'clamp'
|
|
150
|
-
}) : 0);
|
|
151
|
-
const translateX = progress.interpolate({
|
|
152
|
-
inputRange: [0, 1, 2],
|
|
153
|
-
outputRange: isRTL ? [-screen.width, 0, screen.width] : [screen.width, 0, -screen.width]
|
|
154
|
-
});
|
|
155
|
-
const transform = [{
|
|
156
|
-
translateX
|
|
157
|
-
}];
|
|
158
|
-
return {
|
|
159
|
-
leftButtonStyle: {
|
|
160
|
-
transform
|
|
161
|
-
},
|
|
162
|
-
rightButtonStyle: {
|
|
163
|
-
transform
|
|
164
|
-
},
|
|
165
|
-
titleStyle: {
|
|
166
|
-
transform
|
|
167
|
-
},
|
|
168
|
-
backgroundStyle: {
|
|
169
|
-
transform
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Simple translate animation to translate the header to right.
|
|
176
|
-
*/
|
|
177
|
-
export function forSlideRight({
|
|
178
|
-
current,
|
|
179
|
-
next,
|
|
180
|
-
direction,
|
|
181
|
-
layouts: {
|
|
182
|
-
screen
|
|
183
|
-
}
|
|
184
|
-
}) {
|
|
185
|
-
const isRTL = direction === 'rtl';
|
|
186
|
-
const progress = add(current.progress.interpolate({
|
|
187
|
-
inputRange: [0, 1],
|
|
188
|
-
outputRange: [0, 1],
|
|
189
|
-
extrapolate: 'clamp'
|
|
190
|
-
}), next ? next.progress.interpolate({
|
|
191
|
-
inputRange: [0, 1],
|
|
192
|
-
outputRange: [0, 1],
|
|
193
|
-
extrapolate: 'clamp'
|
|
194
|
-
}) : 0);
|
|
195
|
-
const translateX = progress.interpolate({
|
|
196
|
-
inputRange: [0, 1, 2],
|
|
197
|
-
outputRange: isRTL ? [screen.width, 0, -screen.width] : [-screen.width, 0, screen.width]
|
|
198
|
-
});
|
|
199
|
-
const transform = [{
|
|
200
|
-
translateX
|
|
201
|
-
}];
|
|
202
|
-
return {
|
|
203
|
-
leftButtonStyle: {
|
|
204
|
-
transform
|
|
205
|
-
},
|
|
206
|
-
rightButtonStyle: {
|
|
207
|
-
transform
|
|
208
|
-
},
|
|
209
|
-
titleStyle: {
|
|
210
|
-
transform
|
|
211
|
-
},
|
|
212
|
-
backgroundStyle: {
|
|
213
|
-
transform
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Simple translate animation to translate the header to slide up.
|
|
220
|
-
*/
|
|
221
|
-
export function forSlideUp({
|
|
222
|
-
current,
|
|
223
|
-
next,
|
|
224
|
-
layouts: {
|
|
225
|
-
header
|
|
226
|
-
}
|
|
227
|
-
}) {
|
|
228
|
-
const progress = add(current.progress.interpolate({
|
|
229
|
-
inputRange: [0, 1],
|
|
230
|
-
outputRange: [0, 1],
|
|
231
|
-
extrapolate: 'clamp'
|
|
232
|
-
}), next ? next.progress.interpolate({
|
|
233
|
-
inputRange: [0, 1],
|
|
234
|
-
outputRange: [0, 1],
|
|
235
|
-
extrapolate: 'clamp'
|
|
236
|
-
}) : 0);
|
|
237
|
-
const translateY = progress.interpolate({
|
|
238
|
-
inputRange: [0, 1, 2],
|
|
239
|
-
outputRange: [-header.height, 0, -header.height]
|
|
240
|
-
});
|
|
241
|
-
const transform = [{
|
|
242
|
-
translateY
|
|
243
|
-
}];
|
|
244
|
-
return {
|
|
245
|
-
leftButtonStyle: {
|
|
246
|
-
transform
|
|
247
|
-
},
|
|
248
|
-
rightButtonStyle: {
|
|
249
|
-
transform
|
|
250
|
-
},
|
|
251
|
-
titleStyle: {
|
|
252
|
-
transform
|
|
253
|
-
},
|
|
254
|
-
backgroundStyle: {
|
|
255
|
-
transform
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
export function forNoAnimation() {
|
|
260
|
-
return {};
|
|
261
|
-
}
|
|
262
|
-
//# sourceMappingURL=HeaderStyleInterpolators.js.map
|