@react-navigation/stack 7.0.0-alpha.5 → 7.0.0-alpha.7
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/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js +11 -21
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +7 -14
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/commonjs/index.js +2 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createStackNavigator.js +24 -24
- package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/CardAnimationContext.js +3 -4
- package/lib/commonjs/utils/CardAnimationContext.js.map +1 -1
- package/lib/commonjs/utils/GestureHandlerRefContext.js +3 -4
- package/lib/commonjs/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/commonjs/utils/ModalPresentationContext.js +3 -4
- package/lib/commonjs/utils/ModalPresentationContext.js.map +1 -1
- package/lib/commonjs/utils/conditional.js.map +1 -1
- package/lib/commonjs/utils/debounce.js.map +1 -1
- package/lib/commonjs/utils/findLastIndex.js +1 -1
- package/lib/commonjs/utils/findLastIndex.js.map +1 -1
- package/lib/commonjs/utils/getDistanceForDirection.js.map +1 -1
- package/lib/commonjs/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/commonjs/utils/memoize.js.map +1 -1
- package/lib/commonjs/utils/useCardAnimation.js +2 -2
- package/lib/commonjs/utils/useCardAnimation.js.map +1 -1
- package/lib/commonjs/utils/useGestureHandlerRef.js +2 -2
- package/lib/commonjs/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardManager.js +6 -6
- package/lib/commonjs/utils/useKeyboardManager.js.map +1 -1
- package/lib/commonjs/views/GestureHandler.android.js.map +1 -1
- package/lib/commonjs/views/GestureHandler.ios.js.map +1 -1
- package/lib/commonjs/views/GestureHandler.js +5 -8
- package/lib/commonjs/views/GestureHandler.js.map +1 -1
- package/lib/commonjs/views/GestureHandlerNative.js +2 -2
- package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
- package/lib/commonjs/views/Header/Header.js +4 -4
- package/lib/commonjs/views/Header/Header.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderContainer.js +12 -9
- package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderSegment.js +6 -3
- package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
- package/lib/commonjs/views/Screens.js +2 -2
- package/lib/commonjs/views/Screens.js.map +1 -1
- package/lib/commonjs/views/Stack/Card.js +9 -27
- package/lib/commonjs/views/Stack/Card.js.map +1 -1
- package/lib/commonjs/views/Stack/CardContainer.js +18 -17
- package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
- package/lib/commonjs/views/Stack/CardSheet.js +24 -4
- package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
- package/lib/commonjs/views/Stack/CardStack.js +21 -35
- package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
- package/lib/commonjs/views/Stack/StackView.js +6 -4
- package/lib/commonjs/views/Stack/StackView.js.map +1 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionPresets.js +1 -1
- package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createStackNavigator.js +21 -20
- package/lib/module/navigators/createStackNavigator.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/CardAnimationContext.js.map +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/module/utils/ModalPresentationContext.js.map +1 -1
- package/lib/module/utils/conditional.js.map +1 -1
- package/lib/module/utils/debounce.js.map +1 -1
- package/lib/module/utils/findLastIndex.js +1 -1
- package/lib/module/utils/findLastIndex.js.map +1 -1
- package/lib/module/utils/getDistanceForDirection.js.map +1 -1
- package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/module/utils/memoize.js.map +1 -1
- package/lib/module/utils/useCardAnimation.js.map +1 -1
- package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/module/utils/useKeyboardManager.js +4 -4
- package/lib/module/utils/useKeyboardManager.js.map +1 -1
- package/lib/module/views/GestureHandler.android.js.map +1 -1
- package/lib/module/views/GestureHandler.ios.js.map +1 -1
- package/lib/module/views/GestureHandler.js.map +1 -1
- package/lib/module/views/GestureHandlerNative.js.map +1 -1
- package/lib/module/views/Header/Header.js +1 -0
- package/lib/module/views/Header/Header.js.map +1 -1
- package/lib/module/views/Header/HeaderContainer.js +11 -8
- package/lib/module/views/Header/HeaderContainer.js.map +1 -1
- package/lib/module/views/Header/HeaderSegment.js +4 -1
- package/lib/module/views/Header/HeaderSegment.js.map +1 -1
- package/lib/module/views/Screens.js.map +1 -1
- package/lib/module/views/Stack/Card.js +6 -23
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/module/views/Stack/CardContainer.js +16 -14
- package/lib/module/views/Stack/CardContainer.js.map +1 -1
- package/lib/module/views/Stack/CardSheet.js +21 -0
- package/lib/module/views/Stack/CardSheet.js.map +1 -1
- package/lib/module/views/Stack/CardStack.js +16 -29
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/module/views/Stack/StackView.js +4 -2
- package/lib/module/views/Stack/StackView.js.map +1 -1
- package/lib/typescript/src/navigators/createStackNavigator.d.ts +4 -3
- package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +5 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/views/GestureHandlerNative.d.ts +3 -2
- package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts +4 -3
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts +3 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
- package/lib/typescript/src/views/Screens.d.ts +3 -3
- package/lib/typescript/src/views/Screens.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/Card.d.ts +3 -5
- package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardContainer.d.ts +2 -3
- package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts +1 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/StackView.d.ts +4 -4
- package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
- package/package.json +19 -20
- package/src/TransitionConfigs/TransitionPresets.tsx +2 -2
- package/src/navigators/createStackNavigator.tsx +11 -6
- package/src/types.tsx +7 -3
- package/src/utils/findLastIndex.tsx +1 -1
- package/src/utils/useKeyboardManager.tsx +1 -1
- package/src/views/GestureHandlerNative.tsx +1 -1
- package/src/views/Header/Header.tsx +1 -0
- package/src/views/Header/HeaderContainer.tsx +15 -4
- package/src/views/Header/HeaderSegment.tsx +8 -4
- package/src/views/Screens.tsx +1 -1
- package/src/views/Stack/Card.tsx +5 -34
- package/src/views/Stack/CardContainer.tsx +11 -6
- package/src/views/Stack/CardSheet.tsx +25 -1
- package/src/views/Stack/CardStack.tsx +13 -27
- package/src/views/Stack/StackView.tsx +8 -11
- package/lib/commonjs/views/ModalStatusBarManager.js +0 -44
- package/lib/commonjs/views/ModalStatusBarManager.js.map +0 -1
- package/lib/module/views/ModalStatusBarManager.js +0 -36
- package/lib/module/views/ModalStatusBarManager.js.map +0 -1
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts +0 -11
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +0 -1
- package/src/views/ModalStatusBarManager.tsx +0 -45
|
@@ -4,7 +4,12 @@ import {
|
|
|
4
4
|
HeaderHeightContext,
|
|
5
5
|
HeaderShownContext,
|
|
6
6
|
} from '@react-navigation/elements';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
type Route,
|
|
9
|
+
useLinkTools,
|
|
10
|
+
useLocale,
|
|
11
|
+
useTheme,
|
|
12
|
+
} from '@react-navigation/native';
|
|
8
13
|
import * as React from 'react';
|
|
9
14
|
import { Animated, StyleSheet, View } from 'react-native';
|
|
10
15
|
|
|
@@ -24,7 +29,6 @@ type Props = {
|
|
|
24
29
|
layout: Layout;
|
|
25
30
|
gesture: Animated.Value;
|
|
26
31
|
scene: Scene;
|
|
27
|
-
headerDarkContent: boolean | undefined;
|
|
28
32
|
safeAreaInsetTop: number;
|
|
29
33
|
safeAreaInsetRight: number;
|
|
30
34
|
safeAreaInsetBottom: number;
|
|
@@ -66,7 +70,6 @@ function CardContainerInner({
|
|
|
66
70
|
modal,
|
|
67
71
|
getPreviousScene,
|
|
68
72
|
getFocusedRoute,
|
|
69
|
-
headerDarkContent,
|
|
70
73
|
hasAbsoluteFloatHeader,
|
|
71
74
|
headerHeight,
|
|
72
75
|
onHeaderHeightChange,
|
|
@@ -202,19 +205,22 @@ function CardContainerInner({
|
|
|
202
205
|
transitionSpec,
|
|
203
206
|
} = scene.descriptor.options;
|
|
204
207
|
|
|
208
|
+
const { buildHref } = useLinkTools();
|
|
205
209
|
const previousScene = getPreviousScene({ route: scene.descriptor.route });
|
|
206
210
|
|
|
207
211
|
let backTitle: string | undefined;
|
|
212
|
+
let href: string | undefined;
|
|
208
213
|
|
|
209
214
|
if (previousScene) {
|
|
210
215
|
const { options, route } = previousScene.descriptor;
|
|
211
216
|
|
|
212
217
|
backTitle = getHeaderTitle(options, route.name);
|
|
218
|
+
href = buildHref(route.name, route.params);
|
|
213
219
|
}
|
|
214
220
|
|
|
215
221
|
const headerBack = React.useMemo(
|
|
216
|
-
() => (
|
|
217
|
-
[backTitle]
|
|
222
|
+
() => ({ title: backTitle, href }),
|
|
223
|
+
[backTitle, href]
|
|
218
224
|
);
|
|
219
225
|
|
|
220
226
|
return (
|
|
@@ -246,7 +252,6 @@ function CardContainerInner({
|
|
|
246
252
|
importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
|
|
247
253
|
pointerEvents={active ? 'box-none' : pointerEvents}
|
|
248
254
|
pageOverflowEnabled={headerMode !== 'float' && presentation !== 'modal'}
|
|
249
|
-
headerDarkContent={headerDarkContent}
|
|
250
255
|
containerStyle={
|
|
251
256
|
hasAbsoluteFloatHeader && headerMode !== 'screen'
|
|
252
257
|
? { marginTop: headerHeight }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleSheet, View, ViewProps } from 'react-native';
|
|
2
|
+
import { StyleSheet, View, type ViewProps } from 'react-native';
|
|
3
3
|
|
|
4
4
|
type Props = ViewProps & {
|
|
5
5
|
enabled: boolean;
|
|
@@ -27,6 +27,7 @@ export const CardSheet = React.forwardRef<CardSheetRef, Props>(
|
|
|
27
27
|
return { setPointerEvents };
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
+
const workaroundApplied = React.useRef(false);
|
|
30
31
|
React.useEffect(() => {
|
|
31
32
|
if (typeof document === 'undefined' || !document.body) {
|
|
32
33
|
// Only run when DOM is available
|
|
@@ -36,6 +37,29 @@ export const CardSheet = React.forwardRef<CardSheetRef, Props>(
|
|
|
36
37
|
const width = document.body.clientWidth;
|
|
37
38
|
const height = document.body.clientHeight;
|
|
38
39
|
|
|
40
|
+
// Workaround for mobile Chrome, necessary when a navigation happens
|
|
41
|
+
// when the address bar has already collapsed, which resulted in an
|
|
42
|
+
// empty space at the bottom of the page (matching the height of the
|
|
43
|
+
// address bar). To fix this, it's necessary to update the height of
|
|
44
|
+
// the DOM with the current height of the window.
|
|
45
|
+
// See https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
46
|
+
const fillHeight = height === layout.height;
|
|
47
|
+
if (fillHeight) {
|
|
48
|
+
const vh = window.innerHeight * 0.01;
|
|
49
|
+
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
|
50
|
+
document.body.setAttribute(
|
|
51
|
+
'style',
|
|
52
|
+
`height: calc(var(--vh, 1vh) * 100);`
|
|
53
|
+
);
|
|
54
|
+
workaroundApplied.current = true;
|
|
55
|
+
} else {
|
|
56
|
+
// Revert the workaround if the stack does not occupy the whole
|
|
57
|
+
// height of the page
|
|
58
|
+
if (workaroundApplied.current) {
|
|
59
|
+
document.documentElement.style.removeProperty('--vh');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
39
63
|
setFill(width === layout.width && height === layout.height);
|
|
40
64
|
}, [layout.height, layout.width]);
|
|
41
65
|
|
|
@@ -9,11 +9,10 @@ import type {
|
|
|
9
9
|
Route,
|
|
10
10
|
StackNavigationState,
|
|
11
11
|
} from '@react-navigation/native';
|
|
12
|
-
import Color from 'color';
|
|
13
12
|
import * as React from 'react';
|
|
14
13
|
import {
|
|
15
14
|
Animated,
|
|
16
|
-
LayoutChangeEvent,
|
|
15
|
+
type LayoutChangeEvent,
|
|
17
16
|
Platform,
|
|
18
17
|
StyleSheet,
|
|
19
18
|
} from 'react-native';
|
|
@@ -31,6 +30,7 @@ import {
|
|
|
31
30
|
import type {
|
|
32
31
|
Layout,
|
|
33
32
|
Scene,
|
|
33
|
+
StackCardStyleInterpolator,
|
|
34
34
|
StackDescriptor,
|
|
35
35
|
StackDescriptorMap,
|
|
36
36
|
StackHeaderMode,
|
|
@@ -40,7 +40,6 @@ import { findLastIndex } from '../../utils/findLastIndex';
|
|
|
40
40
|
import { getDistanceForDirection } from '../../utils/getDistanceForDirection';
|
|
41
41
|
import type { Props as HeaderContainerProps } from '../Header/HeaderContainer';
|
|
42
42
|
import { MaybeScreen, MaybeScreenContainer } from '../Screens';
|
|
43
|
-
import { getIsModalPresentation } from './Card';
|
|
44
43
|
import { CardContainer } from './CardContainer';
|
|
45
44
|
|
|
46
45
|
type GestureValues = {
|
|
@@ -114,6 +113,16 @@ const getInterpolationIndex = (scenes: Scene[], index: number) => {
|
|
|
114
113
|
return interpolationIndex;
|
|
115
114
|
};
|
|
116
115
|
|
|
116
|
+
const getIsModalPresentation = (
|
|
117
|
+
cardStyleInterpolator: StackCardStyleInterpolator
|
|
118
|
+
) => {
|
|
119
|
+
return (
|
|
120
|
+
cardStyleInterpolator === forModalPresentationIOS ||
|
|
121
|
+
// Handle custom modal presentation interpolators as well
|
|
122
|
+
cardStyleInterpolator.name === 'forModalPresentationIOS'
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
117
126
|
const getIsModal = (
|
|
118
127
|
scene: Scene,
|
|
119
128
|
interpolationIndex: number,
|
|
@@ -277,7 +286,7 @@ export class CardStack extends React.Component<Props, State> {
|
|
|
277
286
|
? nextDescriptor.options
|
|
278
287
|
: descriptor.options;
|
|
279
288
|
|
|
280
|
-
|
|
289
|
+
const defaultTransitionPreset =
|
|
281
290
|
optionsForTransitionConfig.presentation === 'modal'
|
|
282
291
|
? ModalTransition
|
|
283
292
|
: optionsForTransitionConfig.presentation === 'transparentModal'
|
|
@@ -628,8 +637,6 @@ export class CardStack extends React.Component<Props, State> {
|
|
|
628
637
|
const {
|
|
629
638
|
headerShown = true,
|
|
630
639
|
headerTransparent,
|
|
631
|
-
headerStyle,
|
|
632
|
-
headerTintColor,
|
|
633
640
|
freezeOnBlur,
|
|
634
641
|
} = scene.descriptor.options;
|
|
635
642
|
|
|
@@ -641,26 +648,6 @@ export class CardStack extends React.Component<Props, State> {
|
|
|
641
648
|
const headerHeight =
|
|
642
649
|
headerShown !== false ? headerHeights[route.key] : 0;
|
|
643
650
|
|
|
644
|
-
let headerDarkContent: boolean | undefined;
|
|
645
|
-
|
|
646
|
-
if (headerShown) {
|
|
647
|
-
if (typeof headerTintColor === 'string') {
|
|
648
|
-
headerDarkContent = Color(headerTintColor).isDark();
|
|
649
|
-
} else {
|
|
650
|
-
const flattenedHeaderStyle = StyleSheet.flatten(headerStyle);
|
|
651
|
-
|
|
652
|
-
if (
|
|
653
|
-
flattenedHeaderStyle &&
|
|
654
|
-
'backgroundColor' in flattenedHeaderStyle &&
|
|
655
|
-
typeof flattenedHeaderStyle.backgroundColor === 'string'
|
|
656
|
-
) {
|
|
657
|
-
headerDarkContent = !Color(
|
|
658
|
-
flattenedHeaderStyle.backgroundColor
|
|
659
|
-
).isDark();
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
|
|
664
651
|
// Start from current card and count backwards the number of cards with same interpolation
|
|
665
652
|
const interpolationIndex = getInterpolationIndex(scenes, index);
|
|
666
653
|
const isModal = getIsModal(
|
|
@@ -708,7 +695,6 @@ export class CardStack extends React.Component<Props, State> {
|
|
|
708
695
|
onHeaderHeightChange={this.handleHeaderLayout}
|
|
709
696
|
getPreviousScene={this.getPreviousScene}
|
|
710
697
|
getFocusedRoute={this.getFocusedRoute}
|
|
711
|
-
headerDarkContent={headerDarkContent}
|
|
712
698
|
hasAbsoluteFloatHeader={
|
|
713
699
|
isFloatHeaderAbsolute && !headerTransparent
|
|
714
700
|
}
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from '@react-navigation/elements';
|
|
5
5
|
import {
|
|
6
6
|
CommonActions,
|
|
7
|
-
LocaleDirection,
|
|
8
|
-
ParamListBase,
|
|
9
|
-
Route,
|
|
7
|
+
type LocaleDirection,
|
|
8
|
+
type ParamListBase,
|
|
9
|
+
type Route,
|
|
10
10
|
StackActions,
|
|
11
|
-
StackNavigationState,
|
|
11
|
+
type StackNavigationState,
|
|
12
12
|
} from '@react-navigation/native';
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { StyleSheet, View } from 'react-native';
|
|
@@ -23,7 +23,7 @@ import { ModalPresentationContext } from '../../utils/ModalPresentationContext';
|
|
|
23
23
|
import { GestureHandlerRootView } from '../GestureHandler';
|
|
24
24
|
import {
|
|
25
25
|
HeaderContainer,
|
|
26
|
-
Props as HeaderContainerProps,
|
|
26
|
+
type Props as HeaderContainerProps,
|
|
27
27
|
} from '../Header/HeaderContainer';
|
|
28
28
|
import { CardStack } from './CardStack';
|
|
29
29
|
|
|
@@ -124,12 +124,9 @@ export class StackView extends React.Component<Props, State> {
|
|
|
124
124
|
: props.state.routes;
|
|
125
125
|
|
|
126
126
|
// Now we need to determine which routes were added and removed
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
replacingRouteKeys,
|
|
131
|
-
previousRoutes,
|
|
132
|
-
} = state;
|
|
127
|
+
const { previousRoutes } = state;
|
|
128
|
+
|
|
129
|
+
let { openingRouteKeys, closingRouteKeys, replacingRouteKeys } = state;
|
|
133
130
|
|
|
134
131
|
const previousFocusedRoute = previousRoutes[previousRoutes.length - 1] as
|
|
135
132
|
| Route<string>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ModalStatusBarManager = ModalStatusBarManager;
|
|
7
|
-
var _native = require("@react-navigation/native");
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
function ModalStatusBarManager(_ref) {
|
|
13
|
-
var _flattenedStyle$trans, _flattenedStyle$trans2;
|
|
14
|
-
let {
|
|
15
|
-
dark,
|
|
16
|
-
layout,
|
|
17
|
-
insets,
|
|
18
|
-
style
|
|
19
|
-
} = _ref;
|
|
20
|
-
const {
|
|
21
|
-
dark: darkTheme
|
|
22
|
-
} = (0, _native.useTheme)();
|
|
23
|
-
const [overlapping, setOverlapping] = React.useState(true);
|
|
24
|
-
const scale = 1 - 20 / layout.width;
|
|
25
|
-
const offset = (insets.top - 34) * scale;
|
|
26
|
-
const flattenedStyle = _reactNative.StyleSheet.flatten(style);
|
|
27
|
-
const translateY = flattenedStyle === null || flattenedStyle === void 0 ? void 0 : (_flattenedStyle$trans = flattenedStyle.transform) === null || _flattenedStyle$trans === void 0 ? void 0 : (_flattenedStyle$trans2 = _flattenedStyle$trans.find(s => s.translateY !== undefined)) === null || _flattenedStyle$trans2 === void 0 ? void 0 : _flattenedStyle$trans2.translateY;
|
|
28
|
-
React.useEffect(() => {
|
|
29
|
-
const listener = _ref2 => {
|
|
30
|
-
let {
|
|
31
|
-
value
|
|
32
|
-
} = _ref2;
|
|
33
|
-
setOverlapping(value < offset);
|
|
34
|
-
};
|
|
35
|
-
const sub = translateY === null || translateY === void 0 ? void 0 : translateY.addListener(listener);
|
|
36
|
-
return () => translateY === null || translateY === void 0 ? void 0 : translateY.removeListener(sub);
|
|
37
|
-
}, [offset, translateY]);
|
|
38
|
-
const darkContent = dark ?? !darkTheme;
|
|
39
|
-
return /*#__PURE__*/React.createElement(_reactNative.StatusBar, {
|
|
40
|
-
animated: true,
|
|
41
|
-
barStyle: overlapping && darkContent ? 'dark-content' : 'light-content'
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=ModalStatusBarManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ModalStatusBarManager","dark","layout","insets","style","darkTheme","useTheme","overlapping","setOverlapping","React","useState","scale","width","offset","top","flattenedStyle","StyleSheet","flatten","translateY","transform","find","s","undefined","useEffect","listener","value","sub","addListener","removeListener","darkContent"],"sourceRoot":"../../../src","sources":["views/ModalStatusBarManager.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAAqD;AAAA;AAY9C,SAASA,qBAAqB,OAAyC;EAAA;EAAA,IAAxC;IAAEC,IAAI;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAa,CAAC;EAC1E,MAAM;IAAEH,IAAI,EAAEI;EAAU,CAAC,GAAG,IAAAC,gBAAQ,GAAE;EACtC,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,KAAK,CAACC,QAAQ,CAAC,IAAI,CAAC;EAE1D,MAAMC,KAAK,GAAG,CAAC,GAAG,EAAE,GAAGT,MAAM,CAACU,KAAK;EACnC,MAAMC,MAAM,GAAG,CAACV,MAAM,CAACW,GAAG,GAAG,EAAE,IAAIH,KAAK;EAExC,MAAMI,cAAc,GAAGC,uBAAU,CAACC,OAAO,CAACb,KAAK,CAAC;EAChD,MAAMc,UAAU,GAAGH,cAAc,aAAdA,cAAc,gDAAdA,cAAc,CAAEI,SAAS,oFAAzB,sBAA2BC,IAAI,CAC/CC,CAAM,IAAKA,CAAC,CAACH,UAAU,KAAKI,SAAS,CACvC,2DAFkB,uBAEhBJ,UAAU;EAEbT,KAAK,CAACc,SAAS,CAAC,MAAM;IACpB,MAAMC,QAAQ,GAAG,SAAkC;MAAA,IAAjC;QAAEC;MAAyB,CAAC;MAC5CjB,cAAc,CAACiB,KAAK,GAAGZ,MAAM,CAAC;IAChC,CAAC;IAED,MAAMa,GAAG,GAAGR,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAES,WAAW,CAACH,QAAQ,CAAC;IAE7C,OAAO,MAAMN,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEU,cAAc,CAACF,GAAG,CAAC;EAC9C,CAAC,EAAE,CAACb,MAAM,EAAEK,UAAU,CAAC,CAAC;EAExB,MAAMW,WAAW,GAAG5B,IAAI,IAAI,CAACI,SAAS;EAEtC,oBACE,oBAAC,sBAAS;IACR,QAAQ;IACR,QAAQ,EAAEE,WAAW,IAAIsB,WAAW,GAAG,cAAc,GAAG;EAAgB,EACxE;AAEN"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '@react-navigation/native';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { StatusBar, StyleSheet } from 'react-native';
|
|
4
|
-
export function ModalStatusBarManager(_ref) {
|
|
5
|
-
var _flattenedStyle$trans, _flattenedStyle$trans2;
|
|
6
|
-
let {
|
|
7
|
-
dark,
|
|
8
|
-
layout,
|
|
9
|
-
insets,
|
|
10
|
-
style
|
|
11
|
-
} = _ref;
|
|
12
|
-
const {
|
|
13
|
-
dark: darkTheme
|
|
14
|
-
} = useTheme();
|
|
15
|
-
const [overlapping, setOverlapping] = React.useState(true);
|
|
16
|
-
const scale = 1 - 20 / layout.width;
|
|
17
|
-
const offset = (insets.top - 34) * scale;
|
|
18
|
-
const flattenedStyle = StyleSheet.flatten(style);
|
|
19
|
-
const translateY = flattenedStyle === null || flattenedStyle === void 0 ? void 0 : (_flattenedStyle$trans = flattenedStyle.transform) === null || _flattenedStyle$trans === void 0 ? void 0 : (_flattenedStyle$trans2 = _flattenedStyle$trans.find(s => s.translateY !== undefined)) === null || _flattenedStyle$trans2 === void 0 ? void 0 : _flattenedStyle$trans2.translateY;
|
|
20
|
-
React.useEffect(() => {
|
|
21
|
-
const listener = _ref2 => {
|
|
22
|
-
let {
|
|
23
|
-
value
|
|
24
|
-
} = _ref2;
|
|
25
|
-
setOverlapping(value < offset);
|
|
26
|
-
};
|
|
27
|
-
const sub = translateY === null || translateY === void 0 ? void 0 : translateY.addListener(listener);
|
|
28
|
-
return () => translateY === null || translateY === void 0 ? void 0 : translateY.removeListener(sub);
|
|
29
|
-
}, [offset, translateY]);
|
|
30
|
-
const darkContent = dark ?? !darkTheme;
|
|
31
|
-
return /*#__PURE__*/React.createElement(StatusBar, {
|
|
32
|
-
animated: true,
|
|
33
|
-
barStyle: overlapping && darkContent ? 'dark-content' : 'light-content'
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=ModalStatusBarManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useTheme","React","StatusBar","StyleSheet","ModalStatusBarManager","dark","layout","insets","style","darkTheme","overlapping","setOverlapping","useState","scale","width","offset","top","flattenedStyle","flatten","translateY","transform","find","s","undefined","useEffect","listener","value","sub","addListener","removeListener","darkContent"],"sourceRoot":"../../../src","sources":["views/ModalStatusBarManager.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,EAAEC,UAAU,QAAQ,cAAc;AAYpD,OAAO,SAASC,qBAAqB,OAAyC;EAAA;EAAA,IAAxC;IAAEC,IAAI;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAa,CAAC;EAC1E,MAAM;IAAEH,IAAI,EAAEI;EAAU,CAAC,GAAGT,QAAQ,EAAE;EACtC,MAAM,CAACU,WAAW,EAAEC,cAAc,CAAC,GAAGV,KAAK,CAACW,QAAQ,CAAC,IAAI,CAAC;EAE1D,MAAMC,KAAK,GAAG,CAAC,GAAG,EAAE,GAAGP,MAAM,CAACQ,KAAK;EACnC,MAAMC,MAAM,GAAG,CAACR,MAAM,CAACS,GAAG,GAAG,EAAE,IAAIH,KAAK;EAExC,MAAMI,cAAc,GAAGd,UAAU,CAACe,OAAO,CAACV,KAAK,CAAC;EAChD,MAAMW,UAAU,GAAGF,cAAc,aAAdA,cAAc,gDAAdA,cAAc,CAAEG,SAAS,oFAAzB,sBAA2BC,IAAI,CAC/CC,CAAM,IAAKA,CAAC,CAACH,UAAU,KAAKI,SAAS,CACvC,2DAFkB,uBAEhBJ,UAAU;EAEblB,KAAK,CAACuB,SAAS,CAAC,MAAM;IACpB,MAAMC,QAAQ,GAAG,SAAkC;MAAA,IAAjC;QAAEC;MAAyB,CAAC;MAC5Cf,cAAc,CAACe,KAAK,GAAGX,MAAM,CAAC;IAChC,CAAC;IAED,MAAMY,GAAG,GAAGR,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAES,WAAW,CAACH,QAAQ,CAAC;IAE7C,OAAO,MAAMN,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEU,cAAc,CAACF,GAAG,CAAC;EAC9C,CAAC,EAAE,CAACZ,MAAM,EAAEI,UAAU,CAAC,CAAC;EAExB,MAAMW,WAAW,GAAGzB,IAAI,IAAI,CAACI,SAAS;EAEtC,oBACE,oBAAC,SAAS;IACR,QAAQ;IACR,QAAQ,EAAEC,WAAW,IAAIoB,WAAW,GAAG,cAAc,GAAG;EAAgB,EACxE;AAEN"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
2
|
-
import type { Layout } from '../types';
|
|
3
|
-
type Props = {
|
|
4
|
-
dark: boolean | undefined;
|
|
5
|
-
layout: Layout;
|
|
6
|
-
insets: EdgeInsets;
|
|
7
|
-
style: any;
|
|
8
|
-
};
|
|
9
|
-
export declare function ModalStatusBarManager({ dark, layout, insets, style }: Props): JSX.Element;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=ModalStatusBarManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalStatusBarManager.d.ts","sourceRoot":"","sources":["../../../../src/views/ModalStatusBarManager.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,eA8B3E"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '@react-navigation/native';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { StatusBar, StyleSheet } from 'react-native';
|
|
4
|
-
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
5
|
-
|
|
6
|
-
import type { Layout } from '../types';
|
|
7
|
-
|
|
8
|
-
type Props = {
|
|
9
|
-
dark: boolean | undefined;
|
|
10
|
-
layout: Layout;
|
|
11
|
-
insets: EdgeInsets;
|
|
12
|
-
style: any;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export function ModalStatusBarManager({ dark, layout, insets, style }: Props) {
|
|
16
|
-
const { dark: darkTheme } = useTheme();
|
|
17
|
-
const [overlapping, setOverlapping] = React.useState(true);
|
|
18
|
-
|
|
19
|
-
const scale = 1 - 20 / layout.width;
|
|
20
|
-
const offset = (insets.top - 34) * scale;
|
|
21
|
-
|
|
22
|
-
const flattenedStyle = StyleSheet.flatten(style);
|
|
23
|
-
const translateY = flattenedStyle?.transform?.find(
|
|
24
|
-
(s: any) => s.translateY !== undefined
|
|
25
|
-
)?.translateY;
|
|
26
|
-
|
|
27
|
-
React.useEffect(() => {
|
|
28
|
-
const listener = ({ value }: { value: number }) => {
|
|
29
|
-
setOverlapping(value < offset);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const sub = translateY?.addListener(listener);
|
|
33
|
-
|
|
34
|
-
return () => translateY?.removeListener(sub);
|
|
35
|
-
}, [offset, translateY]);
|
|
36
|
-
|
|
37
|
-
const darkContent = dark ?? !darkTheme;
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<StatusBar
|
|
41
|
-
animated
|
|
42
|
-
barStyle={overlapping && darkContent ? 'dark-content' : 'light-content'}
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
}
|