@react-navigation/elements 2.9.5 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/Badge.js +2 -2
- package/lib/module/Badge.js.map +1 -1
- package/lib/module/BlurEffectBackground.js +59 -0
- package/lib/module/BlurEffectBackground.js.map +1 -0
- package/lib/module/Button.js +7 -6
- package/lib/module/Button.js.map +1 -1
- package/lib/module/Color.js +11 -0
- package/lib/module/Color.js.map +1 -0
- package/lib/module/Container.js +42 -0
- package/lib/module/Container.js.map +1 -0
- package/lib/module/Header/Header.js +156 -97
- package/lib/module/Header/Header.js.map +1 -1
- package/lib/module/Header/HeaderBackButton.js +130 -121
- package/lib/module/Header/HeaderBackButton.js.map +1 -1
- package/lib/module/Header/HeaderBackground.js +10 -17
- package/lib/module/Header/HeaderBackground.js.map +1 -1
- package/lib/module/Header/HeaderButton.js +6 -2
- package/lib/module/Header/HeaderButton.js.map +1 -1
- package/lib/module/Header/HeaderButtonBackground.js +34 -0
- package/lib/module/Header/HeaderButtonBackground.js.map +1 -0
- package/lib/module/Header/HeaderSearchBar.js +174 -123
- package/lib/module/Header/HeaderSearchBar.js.map +1 -1
- package/lib/module/Header/HeaderTitle.js.map +1 -1
- package/lib/module/Header/getDefaultHeaderHeight.js +22 -10
- package/lib/module/Header/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/Label/Label.js.map +1 -1
- package/lib/module/LiquidGlassView.ios.js +21 -0
- package/lib/module/LiquidGlassView.ios.js.map +1 -0
- package/lib/module/LiquidGlassView.js +13 -0
- package/lib/module/LiquidGlassView.js.map +1 -0
- package/lib/module/MissingIcon.js +1 -0
- package/lib/module/MissingIcon.js.map +1 -1
- package/lib/module/PlatformColor.js +9 -0
- package/lib/module/PlatformColor.js.map +1 -0
- package/lib/module/PlatformColor.native.js +4 -0
- package/lib/module/PlatformColor.native.js.map +1 -0
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/Screen.js +29 -23
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/assets/back-icon.ios.svg +4 -0
- package/lib/module/assets/back-icon@1x.ios.png +0 -0
- package/lib/module/assets/back-icon@2x.ios.png +0 -0
- package/lib/module/assets/back-icon@3x.ios.png +0 -0
- package/lib/module/assets/back-icon@4x.ios.png +0 -0
- package/lib/module/assets/search-icon-legacy.png +0 -0
- package/lib/module/assets/search-icon-legacy@1x.ios.png +0 -0
- package/lib/module/assets/search-icon-legacy@2x.ios.png +0 -0
- package/lib/module/assets/search-icon-legacy@3x.ios.png +0 -0
- package/lib/module/assets/search-icon-legacy@4x.ios.png +0 -0
- package/lib/module/assets/search-icon.ios.svg +4 -0
- package/lib/module/assets/search-icon@1x.ios.png +0 -0
- package/lib/module/assets/search-icon@2x.ios.png +0 -0
- package/lib/module/assets/search-icon@3x.ios.png +0 -0
- package/lib/module/assets/search-icon@4x.ios.png +0 -0
- package/lib/module/getBlurBackgroundColor.js +48 -0
- package/lib/module/getBlurBackgroundColor.js.map +1 -0
- package/lib/module/index.js +2 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +10 -0
- package/lib/module/internal.js.map +1 -0
- package/lib/module/useFrameSize.js +4 -4
- package/lib/module/useFrameSize.js.map +1 -1
- package/lib/typescript/src/Badge.d.ts.map +1 -1
- package/lib/typescript/src/BlurEffectBackground.d.ts +16 -0
- package/lib/typescript/src/BlurEffectBackground.d.ts.map +1 -0
- package/lib/typescript/src/Button.d.ts +5 -4
- package/lib/typescript/src/Button.d.ts.map +1 -1
- package/lib/typescript/src/Color.d.ts +13 -0
- package/lib/typescript/src/Color.d.ts.map +1 -0
- package/lib/typescript/src/Container.d.ts +8 -0
- package/lib/typescript/src/Container.d.ts.map +1 -0
- package/lib/typescript/src/Header/Header.d.ts +1 -5
- package/lib/typescript/src/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackButton.d.ts +1 -1
- package/lib/typescript/src/Header/HeaderBackButton.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackground.d.ts +5 -3
- package/lib/typescript/src/Header/HeaderBackground.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderButton.d.ts +2 -0
- package/lib/typescript/src/Header/HeaderButton.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderButtonBackground.d.ts +7 -0
- package/lib/typescript/src/Header/HeaderButtonBackground.d.ts.map +1 -0
- package/lib/typescript/src/Header/HeaderSearchBar.d.ts +5 -2
- package/lib/typescript/src/Header/HeaderSearchBar.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderTitle.d.ts +2 -2
- package/lib/typescript/src/Header/HeaderTitle.d.ts.map +1 -1
- package/lib/typescript/src/Header/getDefaultHeaderHeight.d.ts +5 -2
- package/lib/typescript/src/Header/getDefaultHeaderHeight.d.ts.map +1 -1
- package/lib/typescript/src/Label/Label.d.ts +2 -2
- package/lib/typescript/src/Label/Label.d.ts.map +1 -1
- package/lib/typescript/src/LiquidGlassView.d.ts +9 -0
- package/lib/typescript/src/LiquidGlassView.d.ts.map +1 -0
- package/lib/typescript/src/LiquidGlassView.ios.d.ts +5 -0
- package/lib/typescript/src/LiquidGlassView.ios.d.ts.map +1 -0
- package/lib/typescript/src/MissingIcon.d.ts +2 -2
- package/lib/typescript/src/MissingIcon.d.ts.map +1 -1
- package/lib/typescript/src/PlatformColor.d.ts +7 -0
- package/lib/typescript/src/PlatformColor.d.ts.map +1 -0
- package/lib/typescript/src/PlatformColor.native.d.ts +2 -0
- package/lib/typescript/src/PlatformColor.native.d.ts.map +1 -0
- package/lib/typescript/src/PlatformPressable.d.ts +3 -3
- package/lib/typescript/src/PlatformPressable.d.ts.map +1 -1
- package/lib/typescript/src/Screen.d.ts.map +1 -1
- package/lib/typescript/src/getBlurBackgroundColor.d.ts +7 -0
- package/lib/typescript/src/getBlurBackgroundColor.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +0 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal.d.ts +8 -0
- package/lib/typescript/src/internal.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +47 -31
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +19 -17
- package/src/Badge.tsx +3 -2
- package/src/BlurEffectBackground.tsx +90 -0
- package/src/Button.tsx +33 -21
- package/src/Color.tsx +21 -0
- package/src/Container.tsx +44 -0
- package/src/Header/Header.tsx +230 -156
- package/src/Header/HeaderBackButton.tsx +194 -168
- package/src/Header/HeaderBackground.tsx +17 -19
- package/src/Header/HeaderButton.tsx +7 -2
- package/src/Header/HeaderButtonBackground.tsx +35 -0
- package/src/Header/HeaderSearchBar.tsx +227 -129
- package/src/Header/HeaderTitle.tsx +2 -1
- package/src/Header/getDefaultHeaderHeight.tsx +29 -18
- package/src/Label/Label.tsx +2 -1
- package/src/LiquidGlassView.ios.tsx +39 -0
- package/src/LiquidGlassView.tsx +20 -0
- package/src/MissingIcon.tsx +12 -3
- package/src/PlatformColor.native.tsx +1 -0
- package/src/PlatformColor.tsx +8 -0
- package/src/PlatformPressable.tsx +2 -1
- package/src/Screen.tsx +24 -25
- package/src/assets/back-icon.ios.svg +4 -0
- package/src/assets/back-icon@1x.ios.png +0 -0
- package/src/assets/back-icon@2x.ios.png +0 -0
- package/src/assets/back-icon@3x.ios.png +0 -0
- package/src/assets/back-icon@4x.ios.png +0 -0
- package/src/assets/search-icon-legacy.png +0 -0
- package/src/assets/search-icon-legacy@1x.ios.png +0 -0
- package/src/assets/search-icon-legacy@2x.ios.png +0 -0
- package/src/assets/search-icon-legacy@3x.ios.png +0 -0
- package/src/assets/search-icon-legacy@4x.ios.png +0 -0
- package/src/assets/search-icon.ios.svg +4 -0
- package/src/assets/search-icon@1x.ios.png +0 -0
- package/src/assets/search-icon@2x.ios.png +0 -0
- package/src/assets/search-icon@3x.ios.png +0 -0
- package/src/assets/search-icon@4x.ios.png +0 -0
- package/src/getBlurBackgroundColor.tsx +68 -0
- package/src/index.tsx +2 -8
- package/src/internal.tsx +7 -0
- package/src/types.tsx +50 -32
- package/src/useFrameSize.tsx +4 -4
- package/lib/module/Background.js +0 -22
- package/lib/module/Background.js.map +0 -1
- package/lib/module/MaskedView.android.js +0 -4
- package/lib/module/MaskedView.android.js.map +0 -1
- package/lib/module/MaskedView.ios.js +0 -4
- package/lib/module/MaskedView.ios.js.map +0 -1
- package/lib/module/MaskedView.js +0 -12
- package/lib/module/MaskedView.js.map +0 -1
- package/lib/module/MaskedViewNative.js +0 -30
- package/lib/module/MaskedViewNative.js.map +0 -1
- package/lib/module/ResourceSavingView.js +0 -57
- package/lib/module/ResourceSavingView.js.map +0 -1
- package/lib/module/assets/back-icon-mask.png +0 -0
- package/lib/typescript/src/Background.d.ts +0 -9
- package/lib/typescript/src/Background.d.ts.map +0 -1
- package/lib/typescript/src/MaskedView.android.d.ts +0 -2
- package/lib/typescript/src/MaskedView.android.d.ts.map +0 -1
- package/lib/typescript/src/MaskedView.d.ts +0 -11
- package/lib/typescript/src/MaskedView.d.ts.map +0 -1
- package/lib/typescript/src/MaskedView.ios.d.ts +0 -2
- package/lib/typescript/src/MaskedView.ios.d.ts.map +0 -1
- package/lib/typescript/src/MaskedViewNative.d.ts +0 -11
- package/lib/typescript/src/MaskedViewNative.d.ts.map +0 -1
- package/lib/typescript/src/ResourceSavingView.d.ts +0 -10
- package/lib/typescript/src/ResourceSavingView.d.ts.map +0 -1
- package/src/Background.tsx +0 -24
- package/src/MaskedView.android.tsx +0 -1
- package/src/MaskedView.ios.tsx +0 -1
- package/src/MaskedView.tsx +0 -13
- package/src/MaskedViewNative.tsx +0 -33
- package/src/ResourceSavingView.tsx +0 -76
- package/src/assets/back-icon-mask.png +0 -0
package/lib/module/Badge.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useTheme } from '@react-navigation/native';
|
|
4
|
-
import Color from 'color';
|
|
5
4
|
import * as React from 'react';
|
|
6
5
|
import { Animated, Platform, StyleSheet } from 'react-native';
|
|
6
|
+
import { Color } from "./Color.js";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const useNativeDriver = Platform.OS !== 'web';
|
|
9
9
|
export function Badge({
|
|
@@ -49,7 +49,7 @@ export function Badge({
|
|
|
49
49
|
backgroundColor = colors.notification,
|
|
50
50
|
...restStyle
|
|
51
51
|
} = StyleSheet.flatten(style) || {};
|
|
52
|
-
const textColor = Color(backgroundColor)
|
|
52
|
+
const textColor = Color(backgroundColor)?.isLight() ? 'black' : 'white';
|
|
53
53
|
const borderRadius = size / 2;
|
|
54
54
|
const fontSize = Math.floor(size * 3 / 4);
|
|
55
55
|
return /*#__PURE__*/_jsx(Animated.Text, {
|
package/lib/module/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useTheme","
|
|
1
|
+
{"version":3,"names":["useTheme","React","Animated","Platform","StyleSheet","Color","jsx","_jsx","useNativeDriver","OS","Badge","children","style","visible","size","rest","opacity","useState","Value","rendered","setRendered","colors","fonts","useEffect","timing","toValue","duration","start","finished","stopAnimation","backgroundColor","notification","restStyle","flatten","textColor","isLight","borderRadius","fontSize","Math","floor","Text","numberOfLines","transform","scale","interpolate","inputRange","outputRange","color","lineHeight","height","minWidth","borderCurve","regular","styles","container","create","alignSelf","textAlign","paddingHorizontal","overflow"],"sourceRoot":"../../src","sources":["Badge.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Animated, Platform, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { getBlurBackgroundColor } from "./getBlurBackgroundColor.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* Component to use as a background to provide apple-style blur effect.
|
|
9
|
+
*
|
|
10
|
+
* Only supported on web. Falls back to a regular `View` on other platforms.
|
|
11
|
+
*/
|
|
12
|
+
export function BlurEffectBackground({
|
|
13
|
+
blurEffect,
|
|
14
|
+
style,
|
|
15
|
+
children,
|
|
16
|
+
...rest
|
|
17
|
+
}) {
|
|
18
|
+
let containerStyle, blurStyle, blurBackground, colorBackground;
|
|
19
|
+
if (Platform.OS === 'web' && blurEffect && blurEffect !== 'none') {
|
|
20
|
+
const blurBackgroundColor = getBlurBackgroundColor(blurEffect);
|
|
21
|
+
if (blurBackgroundColor) {
|
|
22
|
+
const backdropFilter = `saturate(180%) blur(30px)`;
|
|
23
|
+
blurStyle = {
|
|
24
|
+
// @ts-expect-error backdropFilter is web-only
|
|
25
|
+
backdropFilter,
|
|
26
|
+
webkitBackdropFilter: backdropFilter
|
|
27
|
+
};
|
|
28
|
+
blurBackground = /*#__PURE__*/_jsx("div", {
|
|
29
|
+
style: {
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
left: 0,
|
|
32
|
+
right: 0,
|
|
33
|
+
top: 0,
|
|
34
|
+
bottom: 0,
|
|
35
|
+
zIndex: -1,
|
|
36
|
+
backgroundColor: blurBackgroundColor
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const flattenedStyle = StyleSheet.flatten(style) || {};
|
|
40
|
+
containerStyle = [flattenedStyle, {
|
|
41
|
+
backgroundColor: 'transparent'
|
|
42
|
+
}];
|
|
43
|
+
colorBackground = 'backgroundColor' in flattenedStyle && flattenedStyle.backgroundColor !== 'transparent' ? /*#__PURE__*/_jsx(Animated.View, {
|
|
44
|
+
style: [StyleSheet.absoluteFill, {
|
|
45
|
+
zIndex: -1,
|
|
46
|
+
backgroundColor: flattenedStyle.backgroundColor
|
|
47
|
+
}]
|
|
48
|
+
}) : null;
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
containerStyle = style;
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
54
|
+
style: [blurStyle, containerStyle],
|
|
55
|
+
...rest,
|
|
56
|
+
children: [blurBackground, colorBackground, children]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=BlurEffectBackground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Animated","Platform","StyleSheet","View","getBlurBackgroundColor","jsx","_jsx","jsxs","_jsxs","BlurEffectBackground","blurEffect","style","children","rest","containerStyle","blurStyle","blurBackground","colorBackground","OS","blurBackgroundColor","backdropFilter","webkitBackdropFilter","position","left","right","top","bottom","zIndex","backgroundColor","flattenedStyle","flatten","absoluteFill"],"sourceRoot":"../../src","sources":["BlurEffectBackground.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,QAAQ,EAERC,UAAU,EACVC,IAAI,QAGC,cAAc;AAErB,SAEEC,sBAAsB,QACjB,6BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQlC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAC;EACnCC,UAAU;EACVC,KAAK;EACLC,QAAQ;EACR,GAAGC;AACE,CAAC,EAAE;EACR,IAAIC,cAAc,EAAEC,SAAS,EAAEC,cAAc,EAAEC,eAAe;EAE9D,IAAIhB,QAAQ,CAACiB,EAAE,KAAK,KAAK,IAAIR,UAAU,IAAIA,UAAU,KAAK,MAAM,EAAE;IAChE,MAAMS,mBAAmB,GAAGf,sBAAsB,CAACM,UAAU,CAAC;IAE9D,IAAIS,mBAAmB,EAAE;MACvB,MAAMC,cAAc,GAAG,2BAA2B;MAElDL,SAAS,GAAG;QACV;QACAK,cAAc;QACdC,oBAAoB,EAAED;MACxB,CAAC;MAEDJ,cAAc,gBACZV,IAAA;QACEK,KAAK,EAAE;UACLW,QAAQ,EAAE,UAAU;UACpBC,IAAI,EAAE,CAAC;UACPC,KAAK,EAAE,CAAC;UACRC,GAAG,EAAE,CAAC;UACNC,MAAM,EAAE,CAAC;UACTC,MAAM,EAAE,CAAC,CAAC;UACVC,eAAe,EAAET;QACnB;MAAE,CACH,CACF;MAED,MAAMU,cAAc,GAAG3B,UAAU,CAAC4B,OAAO,CAACnB,KAAK,CAAC,IAAI,CAAC,CAAC;MAEtDG,cAAc,GAAG,CAACe,cAAc,EAAE;QAAED,eAAe,EAAE;MAAc,CAAC,CAAC;MACrEX,eAAe,GACb,iBAAiB,IAAIY,cAAc,IACnCA,cAAc,CAACD,eAAe,KAAK,aAAa,gBAC9CtB,IAAA,CAACN,QAAQ,CAACG,IAAI;QACZQ,KAAK,EAAE,CACLT,UAAU,CAAC6B,YAAY,EACvB;UACEJ,MAAM,EAAE,CAAC,CAAC;UACVC,eAAe,EAAEC,cAAc,CAACD;QAClC,CAAC;MACD,CACH,CAAC,GACA,IAAI;IACZ;EACF,CAAC,MAAM;IACLd,cAAc,GAAGH,KAAK;EACxB;EAEA,oBACEH,KAAA,CAACL,IAAI;IAACQ,KAAK,EAAE,CAACI,SAAS,EAAED,cAAc,CAAE;IAAA,GAAKD,IAAI;IAAAD,QAAA,GAC/CI,cAAc,EACdC,eAAe,EACfL,QAAQ;EAAA,CACL,CAAC;AAEX","ignoreList":[]}
|
package/lib/module/Button.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useLinkProps, useTheme } from '@react-navigation/native';
|
|
4
|
-
import Color from 'color';
|
|
5
4
|
import * as React from 'react';
|
|
6
5
|
import { Platform, StyleSheet } from 'react-native';
|
|
6
|
+
import { Color } from "./Color.js";
|
|
7
7
|
import { PlatformPressable } from "./PlatformPressable.js";
|
|
8
8
|
import { Text } from "./Text.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -48,6 +48,7 @@ function ButtonBase({
|
|
|
48
48
|
...rest
|
|
49
49
|
}) {
|
|
50
50
|
const {
|
|
51
|
+
dark,
|
|
51
52
|
colors,
|
|
52
53
|
fonts
|
|
53
54
|
} = useTheme();
|
|
@@ -60,25 +61,25 @@ function ButtonBase({
|
|
|
60
61
|
textColor = color;
|
|
61
62
|
break;
|
|
62
63
|
case 'tinted':
|
|
63
|
-
backgroundColor = Color(color)
|
|
64
|
+
backgroundColor = Color(color)?.fade(0.85).string() ?? (dark ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.06)');
|
|
64
65
|
textColor = color;
|
|
65
66
|
break;
|
|
66
67
|
case 'filled':
|
|
67
68
|
backgroundColor = color;
|
|
68
|
-
textColor = Color(color)
|
|
69
|
+
textColor = Color(color)?.isDark() ? 'white' : Color(color)?.darken(0.71).string() ?? '#fff';
|
|
69
70
|
break;
|
|
70
71
|
}
|
|
71
72
|
return /*#__PURE__*/_jsx(PlatformPressable, {
|
|
72
73
|
...rest,
|
|
73
74
|
android_ripple: {
|
|
74
75
|
radius: BUTTON_RADIUS,
|
|
75
|
-
color: Color(textColor)
|
|
76
|
+
color: Color(textColor)?.fade(0.85).string() ?? 'rgba(0, 0, 0, 0.1)',
|
|
76
77
|
...android_ripple
|
|
77
78
|
},
|
|
78
79
|
pressOpacity: Platform.OS === 'ios' ? undefined : 1,
|
|
79
|
-
hoverEffect: {
|
|
80
|
+
hoverEffect: typeof textColor === 'string' ? {
|
|
80
81
|
color: textColor
|
|
81
|
-
},
|
|
82
|
+
} : undefined,
|
|
82
83
|
style: [{
|
|
83
84
|
backgroundColor
|
|
84
85
|
}, styles.button, style],
|
package/lib/module/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useLinkProps","useTheme","
|
|
1
|
+
{"version":3,"names":["useLinkProps","useTheme","React","Platform","StyleSheet","Color","PlatformPressable","Text","jsx","_jsx","BUTTON_RADIUS","Button","props","ButtonLink","ButtonBase","screen","params","action","href","rest","variant","color","customColor","android_ripple","style","children","dark","colors","fonts","primary","backgroundColor","textColor","fade","string","isDark","darken","radius","pressOpacity","OS","undefined","hoverEffect","styles","button","regular","text","create","paddingHorizontal","paddingVertical","borderRadius","borderCurve","fontSize","lineHeight","letterSpacing","textAlign"],"sourceRoot":"../../src","sources":["Button.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line no-restricted-imports
|
|
4
|
+
import OriginalColor from 'color';
|
|
5
|
+
export function Color(value) {
|
|
6
|
+
if (typeof value === 'string' && !value.startsWith('var(')) {
|
|
7
|
+
return OriginalColor(value);
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OriginalColor","Color","value","startsWith","undefined"],"sourceRoot":"../../src","sources":["Color.tsx"],"mappings":";;AAAA;AACA,OAAOA,aAAa,MAAM,OAAO;AAajC,OAAO,SAASC,KAAKA,CAACC,KAAiB,EAAyB;EAC9D,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACA,KAAK,CAACC,UAAU,CAAC,MAAM,CAAC,EAAE;IAC1D,OAAOH,aAAa,CAACE,KAAK,CAAC;EAC7B;EAEA,OAAOE,SAAS;AAClB","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform, View } from 'react-native';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export function Container({
|
|
6
|
+
inert,
|
|
7
|
+
children,
|
|
8
|
+
style
|
|
9
|
+
}) {
|
|
10
|
+
if (Platform.OS === 'web') {
|
|
11
|
+
return /*#__PURE__*/_jsx("div", {
|
|
12
|
+
inert: inert,
|
|
13
|
+
"aria-hidden": inert,
|
|
14
|
+
style: {
|
|
15
|
+
...DEFAULT_STYLE,
|
|
16
|
+
...style
|
|
17
|
+
},
|
|
18
|
+
children: children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/_jsx(View, {
|
|
22
|
+
"aria-hidden": inert,
|
|
23
|
+
style: [{
|
|
24
|
+
pointerEvents: inert ? 'none' : 'box-none'
|
|
25
|
+
}, style],
|
|
26
|
+
collapsable: false,
|
|
27
|
+
children: children
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const DEFAULT_STYLE = {
|
|
31
|
+
display: 'flex',
|
|
32
|
+
alignContent: 'flex-start',
|
|
33
|
+
alignItems: 'stretch',
|
|
34
|
+
boxSizing: 'border-box',
|
|
35
|
+
flexBasis: 'auto',
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
flexShrink: 0,
|
|
38
|
+
minHeight: 0,
|
|
39
|
+
minWidth: 0,
|
|
40
|
+
position: 'relative'
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=Container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","View","jsx","_jsx","Container","inert","children","style","OS","DEFAULT_STYLE","pointerEvents","collapsable","display","alignContent","alignItems","boxSizing","flexBasis","flexDirection","flexShrink","minHeight","minWidth","position"],"sourceRoot":"../../src","sources":["Container.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,IAAI,QAAwB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQ9D,OAAO,SAASC,SAASA,CAAC;EAAEC,KAAK;EAAEC,QAAQ;EAAEC;AAAa,CAAC,EAAE;EAC3D,IAAIP,QAAQ,CAACQ,EAAE,KAAK,KAAK,EAAE;IACzB,oBACEL,IAAA;MACEE,KAAK,EAAEA,KAAM;MACb,eAAaA,KAAM;MACnBE,KAAK,EAAE;QAAE,GAAGE,aAAa;QAAE,GAAGF;MAAM,CAAE;MAAAD,QAAA,EAErCA;IAAQ,CACN,CAAC;EAEV;EAEA,oBACEH,IAAA,CAACF,IAAI;IACH,eAAaI,KAAM;IACnBE,KAAK,EAAE,CAAC;MAAEG,aAAa,EAAEL,KAAK,GAAG,MAAM,GAAG;IAAW,CAAC,EAAEE,KAAK,CAAE;IAC/DI,WAAW,EAAE,KAAM;IAAAL,QAAA,EAElBA;EAAQ,CACL,CAAC;AAEX;AAEA,MAAMG,aAAa,GAAG;EACpBG,OAAO,EAAE,MAAM;EACfC,YAAY,EAAE,YAAY;EAC1BC,UAAU,EAAE,SAAS;EACrBC,SAAS,EAAE,YAAY;EACvBC,SAAS,EAAE,MAAM;EACjBC,aAAa,EAAE,QAAQ;EACvBC,UAAU,EAAE,CAAC;EACbC,SAAS,EAAE,CAAC;EACZC,QAAQ,EAAE,CAAC;EACXC,QAAQ,EAAE;AACZ,CAAwC","ignoreList":[]}
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useNavigation, useTheme } from '@react-navigation/native';
|
|
4
|
-
import Color from 'color';
|
|
5
4
|
import * as React from 'react';
|
|
6
|
-
import { Animated, Platform, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { Animated, Easing, Platform, StyleSheet, View } from 'react-native';
|
|
7
6
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
8
7
|
import searchIcon from '../assets/search-icon.png';
|
|
8
|
+
import { Color } from "../Color.js";
|
|
9
|
+
import { isLiquidGlassSupported } from '../LiquidGlassView';
|
|
10
|
+
import { PlatformColor } from '../PlatformColor';
|
|
9
11
|
import { useFrameSize } from "../useFrameSize.js";
|
|
10
12
|
import { getDefaultHeaderHeight } from "./getDefaultHeaderHeight.js";
|
|
11
13
|
import { HeaderBackButton } from "./HeaderBackButton.js";
|
|
12
14
|
import { HeaderBackground } from "./HeaderBackground.js";
|
|
13
|
-
import { HeaderButton } from "./HeaderButton.js";
|
|
15
|
+
import { BUTTON_SIZE, BUTTON_SPACING, HeaderButton } from "./HeaderButton.js";
|
|
16
|
+
import { HeaderButtonBackground } from "./HeaderButtonBackground.js";
|
|
14
17
|
import { HeaderIcon } from "./HeaderIcon.js";
|
|
15
18
|
import { HeaderSearchBar } from "./HeaderSearchBar.js";
|
|
16
19
|
import { HeaderShownContext } from "./HeaderShownContext.js";
|
|
17
20
|
import { HeaderTitle } from "./HeaderTitle.js";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
const STATUS_BAR_OFFSET = Platform.select({
|
|
23
|
+
// The top inset on iOS is a bit less than the status bar height
|
|
24
|
+
ios: -7,
|
|
25
|
+
default: 0
|
|
26
|
+
});
|
|
22
27
|
const warnIfHeaderStylesDefined = styles => {
|
|
23
28
|
Object.keys(styles).forEach(styleProp => {
|
|
24
29
|
const value = styles[styleProp];
|
|
@@ -29,33 +34,16 @@ const warnIfHeaderStylesDefined = styles => {
|
|
|
29
34
|
}
|
|
30
35
|
});
|
|
31
36
|
};
|
|
37
|
+
const useNativeDriver = Platform.OS !== 'web';
|
|
32
38
|
export function Header(props) {
|
|
33
39
|
const insets = useSafeAreaInsets();
|
|
34
|
-
const frame = useFrameSize(size => size, true);
|
|
35
40
|
const {
|
|
36
41
|
colors
|
|
37
42
|
} = useTheme();
|
|
38
43
|
const navigation = useNavigation();
|
|
39
44
|
const isParentHeaderShown = React.useContext(HeaderShownContext);
|
|
40
45
|
const [searchBarVisible, setSearchBarVisible] = React.useState(false);
|
|
41
|
-
const [titleLayout, setTitleLayout] = React.useState(undefined);
|
|
42
|
-
const onTitleLayout = e => {
|
|
43
|
-
const {
|
|
44
|
-
height,
|
|
45
|
-
width
|
|
46
|
-
} = e.nativeEvent.layout;
|
|
47
|
-
setTitleLayout(titleLayout => {
|
|
48
|
-
if (titleLayout && height === titleLayout.height && width === titleLayout.width) {
|
|
49
|
-
return titleLayout;
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
height,
|
|
53
|
-
width
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
46
|
const {
|
|
58
|
-
layout = frame,
|
|
59
47
|
modal = false,
|
|
60
48
|
back,
|
|
61
49
|
title,
|
|
@@ -64,17 +52,20 @@ export function Header(props) {
|
|
|
64
52
|
headerLeft = back ? props => /*#__PURE__*/_jsx(HeaderBackButton, {
|
|
65
53
|
...props
|
|
66
54
|
}) : undefined,
|
|
55
|
+
headerLeftBackgroundVisible,
|
|
67
56
|
headerSearchBarOptions,
|
|
68
57
|
headerTransparent,
|
|
69
58
|
headerTintColor,
|
|
70
59
|
headerBackground,
|
|
60
|
+
headerBlurEffect,
|
|
71
61
|
headerRight,
|
|
62
|
+
headerRightBackgroundVisible,
|
|
72
63
|
headerTitleAllowFontScaling: titleAllowFontScaling,
|
|
73
64
|
headerTitleStyle: titleStyle,
|
|
74
65
|
headerLeftContainerStyle: leftContainerStyle,
|
|
75
66
|
headerRightContainerStyle: rightContainerStyle,
|
|
76
67
|
headerTitleContainerStyle: titleContainerStyle,
|
|
77
|
-
headerBackButtonDisplayMode = Platform.OS
|
|
68
|
+
headerBackButtonDisplayMode = Platform.OS !== 'ios' || isLiquidGlassSupported ? 'minimal' : 'default',
|
|
78
69
|
headerBackTitleStyle,
|
|
79
70
|
headerBackgroundContainerStyle: backgroundContainerStyle,
|
|
80
71
|
headerStyle: customHeaderStyle,
|
|
@@ -83,7 +74,11 @@ export function Header(props) {
|
|
|
83
74
|
headerPressOpacity,
|
|
84
75
|
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top
|
|
85
76
|
} = props;
|
|
86
|
-
const defaultHeight =
|
|
77
|
+
const defaultHeight = useFrameSize(frame => getDefaultHeaderHeight({
|
|
78
|
+
landscape: frame.width > frame.height,
|
|
79
|
+
modalPresentation: modal,
|
|
80
|
+
topInset: headerStatusBarHeight
|
|
81
|
+
}));
|
|
87
82
|
const {
|
|
88
83
|
height = defaultHeight,
|
|
89
84
|
maxHeight,
|
|
@@ -218,7 +213,7 @@ export function Header(props) {
|
|
|
218
213
|
...safeStyles
|
|
219
214
|
};
|
|
220
215
|
const iconTintColor = headerTintColor ?? Platform.select({
|
|
221
|
-
ios: colors.primary,
|
|
216
|
+
ios: isLiquidGlassSupported && PlatformColor ? PlatformColor('label') : colors.primary,
|
|
222
217
|
default: colors.text
|
|
223
218
|
});
|
|
224
219
|
const leftButton = headerLeft ? headerLeft({
|
|
@@ -226,8 +221,6 @@ export function Header(props) {
|
|
|
226
221
|
pressColor: headerPressColor,
|
|
227
222
|
pressOpacity: headerPressOpacity,
|
|
228
223
|
displayMode: headerBackButtonDisplayMode,
|
|
229
|
-
titleLayout,
|
|
230
|
-
screenLayout: layout,
|
|
231
224
|
canGoBack: Boolean(back),
|
|
232
225
|
onPress: back ? navigation.goBack : undefined,
|
|
233
226
|
label: back?.title,
|
|
@@ -243,9 +236,50 @@ export function Header(props) {
|
|
|
243
236
|
const headerTitle = typeof customTitle !== 'function' ? props => /*#__PURE__*/_jsx(HeaderTitle, {
|
|
244
237
|
...props
|
|
245
238
|
}) : customTitle;
|
|
239
|
+
const buttonMinWidth = headerTitleAlign === 'center' && (leftButton || rightButton) ? BUTTON_SIZE : 0;
|
|
240
|
+
const [searchBarRendered, setSearchBarRendered] = React.useState(searchBarVisible);
|
|
241
|
+
const searchBarVisibleRef = React.useRef(searchBarVisible);
|
|
242
|
+
const [searchBarVisibleAnim] = React.useState(() => new Animated.Value(searchBarVisible ? 1 : 0));
|
|
243
|
+
if (searchBarVisible && !searchBarRendered) {
|
|
244
|
+
setSearchBarRendered(true);
|
|
245
|
+
}
|
|
246
|
+
React.useEffect(() => {
|
|
247
|
+
// Avoid act warning in tests just by rendering header
|
|
248
|
+
if (searchBarVisible === searchBarVisibleRef.current) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
Animated.timing(searchBarVisibleAnim, {
|
|
252
|
+
toValue: searchBarVisible ? 1 : 0,
|
|
253
|
+
duration: 150,
|
|
254
|
+
useNativeDriver,
|
|
255
|
+
easing: Easing.in(Easing.linear)
|
|
256
|
+
}).start(({
|
|
257
|
+
finished
|
|
258
|
+
}) => {
|
|
259
|
+
if (finished) {
|
|
260
|
+
setSearchBarRendered(searchBarVisible);
|
|
261
|
+
searchBarVisibleRef.current = searchBarVisible;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
return () => {
|
|
265
|
+
searchBarVisibleAnim.stopAnimation();
|
|
266
|
+
};
|
|
267
|
+
}, [searchBarVisible, searchBarVisibleAnim]);
|
|
268
|
+
const headerOpacity = searchBarVisibleAnim.interpolate({
|
|
269
|
+
inputRange: [0, 1],
|
|
270
|
+
outputRange: [1, 0]
|
|
271
|
+
});
|
|
272
|
+
const searchBarOpacity = searchBarVisibleAnim.interpolate({
|
|
273
|
+
inputRange: [0, 1],
|
|
274
|
+
outputRange: [
|
|
275
|
+
// FIXME: Liquid glass views don't work properly with `opacity: 0`
|
|
276
|
+
// So we use a small value instead to workaround this issue.
|
|
277
|
+
0.1, 1]
|
|
278
|
+
});
|
|
279
|
+
const statusBarSpacing = Math.max(headerStatusBarHeight + STATUS_BAR_OFFSET, 0);
|
|
246
280
|
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
247
|
-
pointerEvents: "box-none",
|
|
248
281
|
style: [{
|
|
282
|
+
pointerEvents: 'box-none',
|
|
249
283
|
height,
|
|
250
284
|
minHeight,
|
|
251
285
|
maxHeight,
|
|
@@ -253,53 +287,48 @@ export function Header(props) {
|
|
|
253
287
|
transform
|
|
254
288
|
}],
|
|
255
289
|
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
256
|
-
|
|
257
|
-
style: [StyleSheet.absoluteFill, backgroundContainerStyle],
|
|
290
|
+
style: [styles.background, backgroundContainerStyle],
|
|
258
291
|
children: headerBackground ? headerBackground({
|
|
259
292
|
style: backgroundStyle
|
|
260
293
|
}) : /*#__PURE__*/_jsx(HeaderBackground, {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
294
|
+
blurEffect: headerBlurEffect,
|
|
295
|
+
style: [{
|
|
296
|
+
// Allow touch through the header when background color is transparent
|
|
297
|
+
pointerEvents: headerTransparent && backgroundStyle.backgroundColor && (backgroundStyle.backgroundColor === 'transparent' || Color(backgroundStyle.backgroundColor)?.alpha() === 0) ? 'none' : 'auto'
|
|
298
|
+
}, backgroundStyle]
|
|
265
299
|
})
|
|
266
|
-
}), /*#__PURE__*/
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
pointerEvents: "box-none",
|
|
276
|
-
style: [styles.start, !searchBarVisible && headerTitleAlign === 'center' && styles.expand, {
|
|
300
|
+
}), /*#__PURE__*/_jsxs(Animated.View, {
|
|
301
|
+
style: [styles.content, {
|
|
302
|
+
pointerEvents: searchBarVisible ? 'none' : 'auto',
|
|
303
|
+
marginTop: statusBarSpacing,
|
|
304
|
+
opacity: headerOpacity
|
|
305
|
+
}],
|
|
306
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
307
|
+
style: [styles.start, headerTitleAlign === 'center' ? styles.expand : styles.shrink, {
|
|
308
|
+
minWidth: buttonMinWidth,
|
|
277
309
|
marginStart: insets.left
|
|
278
|
-
}
|
|
279
|
-
children:
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
style: [styles.end, styles.expand, {
|
|
301
|
-
marginEnd: insets.right
|
|
302
|
-
}, rightContainerStyle],
|
|
310
|
+
}],
|
|
311
|
+
children: /*#__PURE__*/_jsx(HeaderButtonBackground, {
|
|
312
|
+
plain: headerLeftBackgroundVisible === false,
|
|
313
|
+
style: [styles.buttonContainer, leftContainerStyle],
|
|
314
|
+
children: leftButton
|
|
315
|
+
})
|
|
316
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
317
|
+
style: [styles.title, !leftButton && styles.titleStart, titleContainerStyle],
|
|
318
|
+
children: headerTitle({
|
|
319
|
+
children: title,
|
|
320
|
+
allowFontScaling: titleAllowFontScaling,
|
|
321
|
+
tintColor: headerTintColor,
|
|
322
|
+
style: [styles.titleText, titleStyle]
|
|
323
|
+
})
|
|
324
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
325
|
+
style: [styles.end, styles.expand, {
|
|
326
|
+
minWidth: buttonMinWidth,
|
|
327
|
+
marginEnd: insets.right
|
|
328
|
+
}],
|
|
329
|
+
children: /*#__PURE__*/_jsxs(HeaderButtonBackground, {
|
|
330
|
+
plain: headerRightBackgroundVisible === false,
|
|
331
|
+
style: [styles.buttonContainer, rightContainerStyle],
|
|
303
332
|
children: [rightButton, headerSearchBarOptions ? /*#__PURE__*/_jsx(HeaderButton, {
|
|
304
333
|
tintColor: iconTintColor,
|
|
305
334
|
pressColor: headerPressColor,
|
|
@@ -313,51 +342,81 @@ export function Header(props) {
|
|
|
313
342
|
tintColor: iconTintColor
|
|
314
343
|
})
|
|
315
344
|
}) : null]
|
|
316
|
-
})
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}]
|
|
332
|
-
}) : null]
|
|
333
|
-
})]
|
|
345
|
+
})
|
|
346
|
+
})]
|
|
347
|
+
}), searchBarRendered ? /*#__PURE__*/_jsx(HeaderSearchBar, {
|
|
348
|
+
...headerSearchBarOptions,
|
|
349
|
+
statusBarHeight: statusBarSpacing,
|
|
350
|
+
visible: searchBarVisible,
|
|
351
|
+
onClose: () => {
|
|
352
|
+
setSearchBarVisible(false);
|
|
353
|
+
headerSearchBarOptions?.onClose?.();
|
|
354
|
+
},
|
|
355
|
+
tintColor: headerTintColor,
|
|
356
|
+
style: [StyleSheet.absoluteFill, {
|
|
357
|
+
opacity: searchBarOpacity
|
|
358
|
+
}]
|
|
359
|
+
}) : null]
|
|
334
360
|
});
|
|
335
361
|
}
|
|
362
|
+
const BUTTON_OFFSET = Platform.OS === 'ios' ? 10 : 4;
|
|
363
|
+
const TITLE_START_OFFSET = Platform.OS === 'ios' ? 0 :
|
|
364
|
+
// Since button container is always present,
|
|
365
|
+
// We need to account for its horizontal margin as well
|
|
366
|
+
16 - BUTTON_OFFSET * 2;
|
|
336
367
|
const styles = StyleSheet.create({
|
|
337
368
|
content: {
|
|
369
|
+
pointerEvents: 'box-none',
|
|
338
370
|
flex: 1,
|
|
339
371
|
flexDirection: 'row',
|
|
340
372
|
alignItems: 'stretch'
|
|
341
373
|
},
|
|
342
|
-
large: {
|
|
343
|
-
marginHorizontal: 5
|
|
344
|
-
},
|
|
345
374
|
title: {
|
|
346
|
-
|
|
375
|
+
flexShrink: 1,
|
|
376
|
+
minWidth: 0,
|
|
377
|
+
justifyContent: 'center',
|
|
378
|
+
pointerEvents: 'box-none',
|
|
379
|
+
// Make sure title goes below liquid glass buttons
|
|
380
|
+
zIndex: -1
|
|
381
|
+
},
|
|
382
|
+
titleStart: {
|
|
383
|
+
marginLeft: TITLE_START_OFFSET
|
|
384
|
+
},
|
|
385
|
+
titleText: {
|
|
386
|
+
textAlign: 'center'
|
|
387
|
+
},
|
|
388
|
+
buttonContainer: {
|
|
389
|
+
flexDirection: 'row',
|
|
390
|
+
pointerEvents: 'box-none',
|
|
391
|
+
gap: BUTTON_SPACING,
|
|
392
|
+
marginHorizontal: BUTTON_OFFSET
|
|
347
393
|
},
|
|
348
394
|
start: {
|
|
349
395
|
flexDirection: 'row',
|
|
350
396
|
alignItems: 'center',
|
|
351
|
-
justifyContent: 'flex-start'
|
|
397
|
+
justifyContent: 'flex-start',
|
|
398
|
+
pointerEvents: 'box-none'
|
|
352
399
|
},
|
|
353
400
|
end: {
|
|
354
401
|
flexDirection: 'row',
|
|
355
402
|
alignItems: 'center',
|
|
356
|
-
justifyContent: 'flex-end'
|
|
403
|
+
justifyContent: 'flex-end',
|
|
404
|
+
pointerEvents: 'box-none'
|
|
357
405
|
},
|
|
358
406
|
expand: {
|
|
359
407
|
flexGrow: 1,
|
|
408
|
+
flexShrink: 1,
|
|
360
409
|
flexBasis: 0
|
|
410
|
+
},
|
|
411
|
+
shrink: {
|
|
412
|
+
flexGrow: 0,
|
|
413
|
+
flexShrink: 1,
|
|
414
|
+
minWidth: 0,
|
|
415
|
+
maxWidth: '50%'
|
|
416
|
+
},
|
|
417
|
+
background: {
|
|
418
|
+
...StyleSheet.absoluteFillObject,
|
|
419
|
+
pointerEvents: 'box-none'
|
|
361
420
|
}
|
|
362
421
|
});
|
|
363
422
|
//# sourceMappingURL=Header.js.map
|