@react-navigation/elements 2.0.0-rc.2 → 2.0.0-rc.20
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/Background.js +4 -3
- package/lib/commonjs/Background.js.map +1 -1
- package/lib/commonjs/Button.js +29 -56
- package/lib/commonjs/Button.js.map +1 -1
- package/lib/commonjs/Header/Header.js +72 -56
- package/lib/commonjs/Header/Header.js.map +1 -1
- package/lib/commonjs/Header/HeaderBackButton.js +78 -66
- package/lib/commonjs/Header/HeaderBackButton.js.map +1 -1
- package/lib/commonjs/Header/HeaderBackContext.js +1 -1
- package/lib/commonjs/Header/HeaderBackground.js +9 -7
- package/lib/commonjs/Header/HeaderBackground.js.map +1 -1
- package/lib/commonjs/Header/HeaderButton.js +6 -7
- package/lib/commonjs/Header/HeaderButton.js.map +1 -1
- package/lib/commonjs/Header/HeaderHeightContext.js +1 -1
- package/lib/commonjs/Header/HeaderShownContext.js +1 -1
- package/lib/commonjs/Header/HeaderTitle.js +5 -8
- package/lib/commonjs/Header/HeaderTitle.js.map +1 -1
- package/lib/commonjs/Header/useHeaderHeight.js +1 -1
- package/lib/commonjs/Label/Label.js +6 -9
- package/lib/commonjs/Label/Label.js.map +1 -1
- package/lib/commonjs/MaskedView.android.js +1 -1
- package/lib/commonjs/MaskedView.ios.js +1 -1
- package/lib/commonjs/MaskedViewNative.js +5 -1
- package/lib/commonjs/MaskedViewNative.js.map +1 -1
- package/lib/commonjs/MissingIcon.js +6 -9
- package/lib/commonjs/MissingIcon.js.map +1 -1
- package/lib/commonjs/PlatformPressable.js +57 -4
- package/lib/commonjs/PlatformPressable.js.map +1 -1
- package/lib/commonjs/ResourceSavingView.js +19 -15
- package/lib/commonjs/ResourceSavingView.js.map +1 -1
- package/lib/commonjs/SafeAreaProviderCompat.js +26 -19
- package/lib/commonjs/SafeAreaProviderCompat.js.map +1 -1
- package/lib/commonjs/Screen.js +34 -25
- package/lib/commonjs/Screen.js.map +1 -1
- package/lib/commonjs/Text.js +6 -7
- package/lib/commonjs/Text.js.map +1 -1
- package/lib/commonjs/index.js +27 -28
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/module/Background.js +6 -3
- package/lib/module/Background.js.map +1 -1
- package/lib/module/Button.js +31 -56
- package/lib/module/Button.js.map +1 -1
- package/lib/module/Header/Header.js +74 -56
- package/lib/module/Header/Header.js.map +1 -1
- package/lib/module/Header/HeaderBackButton.js +79 -66
- package/lib/module/Header/HeaderBackButton.js.map +1 -1
- package/lib/module/Header/HeaderBackContext.js +3 -1
- package/lib/module/Header/HeaderBackContext.js.map +1 -1
- package/lib/module/Header/HeaderBackground.js +11 -7
- package/lib/module/Header/HeaderBackground.js.map +1 -1
- package/lib/module/Header/HeaderButton.js +8 -5
- package/lib/module/Header/HeaderButton.js.map +1 -1
- package/lib/module/Header/HeaderHeightContext.js +3 -1
- package/lib/module/Header/HeaderHeightContext.js.map +1 -1
- package/lib/module/Header/HeaderShownContext.js +3 -1
- package/lib/module/Header/HeaderShownContext.js.map +1 -1
- package/lib/module/Header/HeaderTitle.js +7 -6
- package/lib/module/Header/HeaderTitle.js.map +1 -1
- package/lib/module/Header/getDefaultHeaderHeight.js +2 -0
- package/lib/module/Header/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/Header/getHeaderTitle.js +2 -0
- package/lib/module/Header/getHeaderTitle.js.map +1 -1
- package/lib/module/Header/useHeaderHeight.js +3 -1
- package/lib/module/Header/useHeaderHeight.js.map +1 -1
- package/lib/module/Label/Label.js +8 -7
- package/lib/module/Label/Label.js.map +1 -1
- package/lib/module/Label/getLabel.js +2 -0
- package/lib/module/Label/getLabel.js.map +1 -1
- package/lib/module/MaskedView.android.js +3 -1
- package/lib/module/MaskedView.android.js.map +1 -1
- package/lib/module/MaskedView.ios.js +3 -1
- package/lib/module/MaskedView.ios.js.map +1 -1
- package/lib/module/MaskedView.js +2 -0
- package/lib/module/MaskedView.js.map +1 -1
- package/lib/module/MaskedViewNative.js +7 -1
- package/lib/module/MaskedViewNative.js.map +1 -1
- package/lib/module/MissingIcon.js +9 -7
- package/lib/module/MissingIcon.js.map +1 -1
- package/lib/module/PlatformPressable.js +59 -4
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/ResourceSavingView.js +21 -15
- package/lib/module/ResourceSavingView.js.map +1 -1
- package/lib/module/SafeAreaProviderCompat.js +28 -19
- package/lib/module/SafeAreaProviderCompat.js.map +1 -1
- package/lib/module/Screen.js +36 -25
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/Text.js +7 -6
- package/lib/module/Text.js.map +1 -1
- package/lib/module/getDefaultSidebarWidth.js +2 -0
- package/lib/module/getDefaultSidebarWidth.js.map +1 -1
- package/lib/module/getNamedContext.js +2 -0
- package/lib/module/getNamedContext.js.map +1 -1
- package/lib/module/index.js +28 -28
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/{src → commonjs/src}/Background.d.ts +1 -1
- package/lib/typescript/commonjs/src/Background.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Button.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/Header/Header.d.ts +1 -2
- package/lib/typescript/commonjs/src/Header/Header.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Header/HeaderBackButton.d.ts +3 -0
- package/lib/typescript/commonjs/src/Header/HeaderBackButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Header/HeaderBackContext.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/Header/HeaderBackground.d.ts +1 -1
- package/lib/typescript/commonjs/src/Header/HeaderBackground.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/Header/HeaderButton.d.ts +1 -2
- package/lib/typescript/commonjs/src/Header/HeaderButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Header/HeaderHeightContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Header/HeaderShownContext.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/Header/HeaderTitle.d.ts +1 -2
- package/lib/typescript/commonjs/src/Header/HeaderTitle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Header/getDefaultHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Header/getHeaderTitle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Header/useHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/Label/Label.d.ts +1 -2
- package/lib/typescript/commonjs/src/Label/Label.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Label/getLabel.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MaskedView.android.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MaskedView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MaskedView.ios.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/MaskedViewNative.d.ts +1 -1
- package/lib/typescript/commonjs/src/MaskedViewNative.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/MissingIcon.d.ts +1 -2
- package/lib/typescript/commonjs/src/MissingIcon.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/PlatformPressable.d.ts +8 -1
- package/lib/typescript/commonjs/src/PlatformPressable.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/ResourceSavingView.d.ts +1 -1
- package/lib/typescript/commonjs/src/ResourceSavingView.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/SafeAreaProviderCompat.d.ts +1 -1
- package/lib/typescript/commonjs/src/SafeAreaProviderCompat.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/Screen.d.ts +1 -1
- package/lib/typescript/commonjs/src/Screen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Text.d.ts +3 -0
- package/lib/typescript/commonjs/src/Text.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/getDefaultSidebarWidth.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/getNamedContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/types.d.ts +12 -4
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/Background.d.ts +9 -0
- package/lib/typescript/module/src/Background.d.ts.map +1 -0
- package/lib/typescript/module/src/Button.d.ts +13 -0
- package/lib/typescript/module/src/Button.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/Header.d.ts +18 -0
- package/lib/typescript/module/src/Header/Header.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/HeaderBackButton.d.ts +3 -0
- package/lib/typescript/module/src/Header/HeaderBackButton.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/HeaderBackContext.d.ts +5 -0
- package/lib/typescript/module/src/Header/HeaderBackContext.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/HeaderBackground.d.ts +9 -0
- package/lib/typescript/module/src/Header/HeaderBackground.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/HeaderButton.d.ts +3 -0
- package/lib/typescript/module/src/Header/HeaderButton.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/HeaderHeightContext.d.ts +2 -0
- package/lib/typescript/module/src/Header/HeaderHeightContext.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/HeaderShownContext.d.ts +2 -0
- package/lib/typescript/module/src/Header/HeaderShownContext.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/HeaderTitle.d.ts +9 -0
- package/lib/typescript/module/src/Header/HeaderTitle.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/getDefaultHeaderHeight.d.ts +3 -0
- package/lib/typescript/module/src/Header/getDefaultHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/getHeaderTitle.d.ts +6 -0
- package/lib/typescript/module/src/Header/getHeaderTitle.d.ts.map +1 -0
- package/lib/typescript/module/src/Header/useHeaderHeight.d.ts +2 -0
- package/lib/typescript/module/src/Header/useHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/module/src/Label/Label.d.ts +9 -0
- package/lib/typescript/module/src/Label/Label.d.ts.map +1 -0
- package/lib/typescript/module/src/Label/getLabel.d.ts +5 -0
- package/lib/typescript/module/src/Label/getLabel.d.ts.map +1 -0
- package/lib/typescript/module/src/MaskedView.android.d.ts +2 -0
- package/lib/typescript/module/src/MaskedView.android.d.ts.map +1 -0
- package/lib/typescript/module/src/MaskedView.d.ts +11 -0
- package/lib/typescript/module/src/MaskedView.d.ts.map +1 -0
- package/lib/typescript/module/src/MaskedView.ios.d.ts +2 -0
- package/lib/typescript/module/src/MaskedView.ios.d.ts.map +1 -0
- package/lib/typescript/module/src/MaskedViewNative.d.ts +11 -0
- package/lib/typescript/module/src/MaskedViewNative.d.ts.map +1 -0
- package/lib/typescript/module/src/MissingIcon.d.ts +9 -0
- package/lib/typescript/module/src/MissingIcon.d.ts.map +1 -0
- package/lib/typescript/module/src/PlatformPressable.d.ts +21 -0
- package/lib/typescript/module/src/PlatformPressable.d.ts.map +1 -0
- package/lib/typescript/module/src/ResourceSavingView.d.ts +10 -0
- package/lib/typescript/module/src/ResourceSavingView.d.ts.map +1 -0
- package/lib/typescript/module/src/SafeAreaProviderCompat.d.ts +13 -0
- package/lib/typescript/module/src/SafeAreaProviderCompat.d.ts.map +1 -0
- package/lib/typescript/module/src/Screen.d.ts +18 -0
- package/lib/typescript/module/src/Screen.d.ts.map +1 -0
- package/lib/typescript/module/src/Text.d.ts +3 -0
- package/lib/typescript/module/src/Text.d.ts.map +1 -0
- package/lib/typescript/module/src/getDefaultSidebarWidth.d.ts +4 -0
- package/lib/typescript/module/src/getDefaultSidebarWidth.d.ts.map +1 -0
- package/lib/typescript/module/src/getNamedContext.d.ts +6 -0
- package/lib/typescript/module/src/getNamedContext.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +25 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +234 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +42 -13
- package/src/Button.tsx +3 -40
- package/src/Header/Header.tsx +17 -9
- package/src/Header/HeaderBackButton.tsx +90 -73
- package/src/Header/HeaderBackground.tsx +3 -3
- package/src/Header/HeaderButton.tsx +0 -1
- package/src/Header/HeaderTitle.tsx +0 -1
- package/src/Label/Label.tsx +0 -1
- package/src/MissingIcon.tsx +3 -4
- package/src/PlatformPressable.tsx +65 -1
- package/src/SafeAreaProviderCompat.tsx +1 -0
- package/src/Screen.tsx +1 -0
- package/src/Text.tsx +1 -3
- package/src/index.tsx +4 -6
- package/src/types.tsx +13 -4
- package/lib/typescript/src/Background.d.ts.map +0 -1
- package/lib/typescript/src/Button.d.ts.map +0 -1
- package/lib/typescript/src/Header/Header.d.ts.map +0 -1
- package/lib/typescript/src/Header/HeaderBackButton.d.ts +0 -4
- package/lib/typescript/src/Header/HeaderBackButton.d.ts.map +0 -1
- package/lib/typescript/src/Header/HeaderBackContext.d.ts.map +0 -1
- package/lib/typescript/src/Header/HeaderBackground.d.ts.map +0 -1
- package/lib/typescript/src/Header/HeaderButton.d.ts.map +0 -1
- package/lib/typescript/src/Header/HeaderHeightContext.d.ts.map +0 -1
- package/lib/typescript/src/Header/HeaderShownContext.d.ts.map +0 -1
- package/lib/typescript/src/Header/HeaderTitle.d.ts.map +0 -1
- package/lib/typescript/src/Header/getDefaultHeaderHeight.d.ts.map +0 -1
- package/lib/typescript/src/Header/getHeaderTitle.d.ts.map +0 -1
- package/lib/typescript/src/Header/useHeaderHeight.d.ts.map +0 -1
- package/lib/typescript/src/Label/Label.d.ts.map +0 -1
- package/lib/typescript/src/Label/getLabel.d.ts.map +0 -1
- package/lib/typescript/src/MaskedView.android.d.ts.map +0 -1
- package/lib/typescript/src/MaskedView.d.ts.map +0 -1
- package/lib/typescript/src/MaskedView.ios.d.ts.map +0 -1
- package/lib/typescript/src/MaskedViewNative.d.ts.map +0 -1
- package/lib/typescript/src/MissingIcon.d.ts.map +0 -1
- package/lib/typescript/src/PlatformPressable.d.ts.map +0 -1
- package/lib/typescript/src/ResourceSavingView.d.ts.map +0 -1
- package/lib/typescript/src/SafeAreaProviderCompat.d.ts.map +0 -1
- package/lib/typescript/src/Screen.d.ts.map +0 -1
- package/lib/typescript/src/Text.d.ts +0 -4
- package/lib/typescript/src/Text.d.ts.map +0 -1
- package/lib/typescript/src/getDefaultSidebarWidth.d.ts.map +0 -1
- package/lib/typescript/src/getNamedContext.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- /package/lib/typescript/{src → commonjs/src}/Button.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Header/HeaderBackContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Header/HeaderHeightContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Header/HeaderShownContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Header/getDefaultHeaderHeight.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Header/getHeaderTitle.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Header/useHeaderHeight.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Label/getLabel.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/MaskedView.android.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/MaskedView.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/MaskedView.ios.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/getDefaultSidebarWidth.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/getNamedContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
package/lib/module/Button.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
2
3
|
import { useLinkProps, useTheme } from '@react-navigation/native';
|
|
3
4
|
import Color from 'color';
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { Platform, StyleSheet } from 'react-native';
|
|
6
|
-
import { PlatformPressable } from
|
|
7
|
-
import { Text } from
|
|
7
|
+
import { PlatformPressable } from "./PlatformPressable.js";
|
|
8
|
+
import { Text } from "./Text.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
10
|
const BUTTON_RADIUS = 40;
|
|
9
11
|
export function Button(props) {
|
|
10
12
|
if ('screen' in props || 'action' in props) {
|
|
11
13
|
// @ts-expect-error: This is already type-checked by the prop types
|
|
12
|
-
return /*#__PURE__*/
|
|
14
|
+
return /*#__PURE__*/_jsx(ButtonLink, {
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
13
17
|
} else {
|
|
14
|
-
return /*#__PURE__*/
|
|
18
|
+
return /*#__PURE__*/_jsx(ButtonBase, {
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
function ButtonLink({
|
|
@@ -28,7 +34,10 @@ function ButtonLink({
|
|
|
28
34
|
action,
|
|
29
35
|
href
|
|
30
36
|
});
|
|
31
|
-
return /*#__PURE__*/
|
|
37
|
+
return /*#__PURE__*/_jsx(ButtonBase, {
|
|
38
|
+
...rest,
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
32
41
|
}
|
|
33
42
|
function ButtonBase({
|
|
34
43
|
variant = 'tinted',
|
|
@@ -59,62 +68,28 @@ function ButtonBase({
|
|
|
59
68
|
textColor = Color(color).isDark() ? 'white' : Color(color).darken(0.71).string();
|
|
60
69
|
break;
|
|
61
70
|
}
|
|
62
|
-
return /*#__PURE__*/
|
|
63
|
-
|
|
64
|
-
style: [{
|
|
65
|
-
backgroundColor
|
|
66
|
-
}, styles.button, style],
|
|
71
|
+
return /*#__PURE__*/_jsx(PlatformPressable, {
|
|
72
|
+
...rest,
|
|
67
73
|
android_ripple: {
|
|
68
74
|
radius: BUTTON_RADIUS,
|
|
69
75
|
color: Color(textColor).fade(0.85).string(),
|
|
70
76
|
...android_ripple
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}) : null, /*#__PURE__*/React.createElement(Text, {
|
|
75
|
-
style: [{
|
|
77
|
+
},
|
|
78
|
+
pressOpacity: Platform.OS === 'ios' ? undefined : 1,
|
|
79
|
+
hoverEffect: {
|
|
76
80
|
color: textColor
|
|
77
|
-
},
|
|
78
|
-
|
|
81
|
+
},
|
|
82
|
+
style: [{
|
|
83
|
+
backgroundColor
|
|
84
|
+
}, styles.button, style],
|
|
85
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
86
|
+
style: [{
|
|
87
|
+
color: textColor
|
|
88
|
+
}, fonts.regular, styles.text],
|
|
89
|
+
children: children
|
|
90
|
+
})
|
|
91
|
+
});
|
|
79
92
|
}
|
|
80
|
-
const CLASS_NAME = '__react-navigation_elements_Button_hover';
|
|
81
|
-
const css = String.raw;
|
|
82
|
-
const cssText = css`
|
|
83
|
-
.${CLASS_NAME} {
|
|
84
|
-
position: absolute;
|
|
85
|
-
top: 0;
|
|
86
|
-
left: 0;
|
|
87
|
-
right: 0;
|
|
88
|
-
bottom: 0;
|
|
89
|
-
border-radius: ${BUTTON_RADIUS}px;
|
|
90
|
-
pointer-events: none;
|
|
91
|
-
opacity: 0;
|
|
92
|
-
transition: opacity 0.15s;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
button:hover > .${CLASS_NAME} {
|
|
96
|
-
opacity: 0.08;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
button:active > .${CLASS_NAME} {
|
|
100
|
-
opacity: 0.15;
|
|
101
|
-
}
|
|
102
|
-
`;
|
|
103
|
-
const HoverEffect = ({
|
|
104
|
-
color
|
|
105
|
-
}) => {
|
|
106
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", {
|
|
107
|
-
// eslint-disable-next-line react/no-danger
|
|
108
|
-
dangerouslySetInnerHTML: {
|
|
109
|
-
__html: cssText
|
|
110
|
-
}
|
|
111
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
112
|
-
className: CLASS_NAME,
|
|
113
|
-
style: {
|
|
114
|
-
backgroundColor: color
|
|
115
|
-
}
|
|
116
|
-
}));
|
|
117
|
-
};
|
|
118
93
|
const styles = StyleSheet.create({
|
|
119
94
|
button: {
|
|
120
95
|
paddingHorizontal: 24,
|
package/lib/module/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useLinkProps","useTheme","Color","React","Platform","StyleSheet","PlatformPressable","Text","BUTTON_RADIUS","Button","props","
|
|
1
|
+
{"version":3,"names":["useLinkProps","useTheme","Color","React","Platform","StyleSheet","PlatformPressable","Text","jsx","_jsx","BUTTON_RADIUS","Button","props","ButtonLink","ButtonBase","screen","params","action","href","rest","variant","color","customColor","android_ripple","style","children","colors","fonts","primary","backgroundColor","textColor","fade","string","isDark","darken","radius","pressOpacity","OS","undefined","hoverEffect","styles","button","regular","text","create","paddingHorizontal","paddingVertical","borderRadius","fontSize","lineHeight","letterSpacing","textAlign"],"sourceRoot":"../../src","sources":["Button.tsx"],"mappings":";;AAAA,SAEEA,YAAY,EACZC,QAAQ,QACH,0BAA0B;AACjC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAEnD,SACEC,iBAAiB,QAEZ,wBAAqB;AAC5B,SAASC,IAAI,QAAQ,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAW9B,MAAMC,aAAa,GAAG,EAAE;AAQxB,OAAO,SAASC,MAAMA,CACpBC,KAAmD,EACnD;EACA,IAAI,QAAQ,IAAIA,KAAK,IAAI,QAAQ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,IAAI,CAAC,CAACF,MAAM,CAAC,CAAC;MACtC;EACJ;EAEA,oBACEvB,IAAA,CAACH,iBAAiB;IAAA,GACZa,IAAI;IACRI,cAAc,EAAE;MACdY,MAAM,EAAEzB,aAAa;MACrBW,KAAK,EAAEnB,KAAK,CAAC4B,SAAS,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,CAACC,MAAM,CAAC,CAAC;MAC3C,GAAGT;IACL,CAAE;IACFa,YAAY,EAAEhC,QAAQ,CAACiC,EAAE,KAAK,KAAK,GAAGC,SAAS,GAAG,CAAE;IACpDC,WAAW,EAAE;MAAElB,KAAK,EAAES;IAAU,CAAE;IAClCN,KAAK,EAAE,CAAC;MAAEK;IAAgB,CAAC,EAAEW,MAAM,CAACC,MAAM,EAAEjB,KAAK,CAAE;IAAAC,QAAA,eAEnDhB,IAAA,CAACF,IAAI;MAACiB,KAAK,EAAE,CAAC;QAAEH,KAAK,EAAES;MAAU,CAAC,EAAEH,KAAK,CAACe,OAAO,EAAEF,MAAM,CAACG,IAAI,CAAE;MAAAlB,QAAA,EAC7DA;IAAQ,CACL;EAAC,CACU,CAAC;AAExB;AAEA,MAAMe,MAAM,GAAGnC,UAAU,CAACuC,MAAM,CAAC;EAC/BH,MAAM,EAAE;IACNI,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,YAAY,EAAErC;EAChB,CAAC;EACDiC,IAAI,EAAE;IACJK,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,EAAE;IACdC,aAAa,EAAE,GAAG;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useTheme } from '@react-navigation/native';
|
|
1
4
|
import * as React from 'react';
|
|
2
5
|
import { Animated, Platform, StyleSheet, View } from 'react-native';
|
|
3
6
|
import { useSafeAreaFrame, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
-
import { getDefaultHeaderHeight } from
|
|
5
|
-
import { HeaderBackground } from
|
|
6
|
-
import { HeaderShownContext } from
|
|
7
|
-
import { HeaderTitle } from
|
|
7
|
+
import { getDefaultHeaderHeight } from "./getDefaultHeaderHeight.js";
|
|
8
|
+
import { HeaderBackground } from "./HeaderBackground.js";
|
|
9
|
+
import { HeaderShownContext } from "./HeaderShownContext.js";
|
|
10
|
+
import { HeaderTitle } from "./HeaderTitle.js";
|
|
8
11
|
|
|
9
12
|
// Width of the screen in split layout on portrait mode on iPad Mini
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
14
|
const IPAD_MINI_MEDIUM_WIDTH = 414;
|
|
11
15
|
const warnIfHeaderStylesDefined = styles => {
|
|
12
16
|
Object.keys(styles).forEach(styleProp => {
|
|
@@ -21,18 +25,18 @@ const warnIfHeaderStylesDefined = styles => {
|
|
|
21
25
|
export function Header(props) {
|
|
22
26
|
const insets = useSafeAreaInsets();
|
|
23
27
|
const frame = useSafeAreaFrame();
|
|
28
|
+
const {
|
|
29
|
+
colors
|
|
30
|
+
} = useTheme();
|
|
24
31
|
const isParentHeaderShown = React.useContext(HeaderShownContext);
|
|
25
32
|
const {
|
|
33
|
+
// eslint-disable-next-line @eslint-react/no-unstable-default-props
|
|
26
34
|
layout = frame,
|
|
27
35
|
modal = false,
|
|
28
36
|
title,
|
|
29
37
|
headerTitle: customTitle,
|
|
30
|
-
headerTitleAlign = Platform.
|
|
31
|
-
ios: 'center',
|
|
32
|
-
default: 'left'
|
|
33
|
-
}),
|
|
38
|
+
headerTitleAlign = Platform.OS === 'ios' ? 'center' : 'left',
|
|
34
39
|
headerLeft,
|
|
35
|
-
headerLeftLabelVisible,
|
|
36
40
|
headerTransparent,
|
|
37
41
|
headerTintColor,
|
|
38
42
|
headerBackground,
|
|
@@ -42,11 +46,13 @@ export function Header(props) {
|
|
|
42
46
|
headerLeftContainerStyle: leftContainerStyle,
|
|
43
47
|
headerRightContainerStyle: rightContainerStyle,
|
|
44
48
|
headerTitleContainerStyle: titleContainerStyle,
|
|
49
|
+
headerBackButtonDisplayMode = Platform.OS === 'ios' ? 'default' : 'minimal',
|
|
45
50
|
headerBackgroundContainerStyle: backgroundContainerStyle,
|
|
46
51
|
headerStyle: customHeaderStyle,
|
|
47
52
|
headerShadowVisible,
|
|
48
53
|
headerPressColor,
|
|
49
54
|
headerPressOpacity,
|
|
55
|
+
// eslint-disable-next-line @eslint-react/no-unstable-default-props
|
|
50
56
|
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top
|
|
51
57
|
} = props;
|
|
52
58
|
const defaultHeight = getDefaultHeaderHeight(layout, modal, headerStatusBarHeight);
|
|
@@ -146,19 +152,25 @@ export function Header(props) {
|
|
|
146
152
|
shadowOpacity: 0,
|
|
147
153
|
borderBottomWidth: 0
|
|
148
154
|
}];
|
|
155
|
+
const iconTintColor = headerTintColor ?? Platform.select({
|
|
156
|
+
ios: colors.primary,
|
|
157
|
+
default: colors.text
|
|
158
|
+
});
|
|
149
159
|
const leftButton = headerLeft ? headerLeft({
|
|
150
|
-
tintColor:
|
|
160
|
+
tintColor: iconTintColor,
|
|
151
161
|
pressColor: headerPressColor,
|
|
152
162
|
pressOpacity: headerPressOpacity,
|
|
153
|
-
|
|
163
|
+
displayMode: headerBackButtonDisplayMode
|
|
154
164
|
}) : null;
|
|
155
165
|
const rightButton = headerRight ? headerRight({
|
|
156
|
-
tintColor:
|
|
166
|
+
tintColor: iconTintColor,
|
|
157
167
|
pressColor: headerPressColor,
|
|
158
168
|
pressOpacity: headerPressOpacity
|
|
159
169
|
}) : null;
|
|
160
|
-
const headerTitle = typeof customTitle !== 'function' ? props => /*#__PURE__*/
|
|
161
|
-
|
|
170
|
+
const headerTitle = typeof customTitle !== 'function' ? props => /*#__PURE__*/_jsx(HeaderTitle, {
|
|
171
|
+
...props
|
|
172
|
+
}) : customTitle;
|
|
173
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
162
174
|
pointerEvents: "box-none",
|
|
163
175
|
style: [{
|
|
164
176
|
height,
|
|
@@ -166,48 +178,54 @@ export function Header(props) {
|
|
|
166
178
|
maxHeight,
|
|
167
179
|
opacity,
|
|
168
180
|
transform
|
|
169
|
-
}]
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
181
|
+
}],
|
|
182
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
183
|
+
pointerEvents: "box-none",
|
|
184
|
+
style: [StyleSheet.absoluteFill, backgroundContainerStyle],
|
|
185
|
+
children: headerBackground ? headerBackground({
|
|
186
|
+
style: backgroundStyle
|
|
187
|
+
}) : headerTransparent ? null : /*#__PURE__*/_jsx(HeaderBackground, {
|
|
188
|
+
style: backgroundStyle
|
|
189
|
+
})
|
|
190
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
191
|
+
pointerEvents: "none",
|
|
192
|
+
style: {
|
|
193
|
+
height: headerStatusBarHeight
|
|
194
|
+
}
|
|
195
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
196
|
+
pointerEvents: "box-none",
|
|
197
|
+
style: [styles.content, Platform.OS === 'ios' && frame.width >= IPAD_MINI_MEDIUM_WIDTH ? styles.large : null],
|
|
198
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
199
|
+
pointerEvents: "box-none",
|
|
200
|
+
style: [styles.start, headerTitleAlign === 'center' && styles.expand, {
|
|
201
|
+
marginStart: insets.left
|
|
202
|
+
}, leftContainerStyle],
|
|
203
|
+
children: leftButton
|
|
204
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
205
|
+
pointerEvents: "box-none",
|
|
206
|
+
style: [styles.title, {
|
|
207
|
+
// Avoid the title from going offscreen or overlapping buttons
|
|
208
|
+
maxWidth: headerTitleAlign === 'center' ? layout.width - ((leftButton ? headerBackButtonDisplayMode !== 'minimal' ? 80 : 32 : 16) + (rightButton ? 16 : 0) + Math.max(insets.left, insets.right)) * 2 : layout.width - ((leftButton ? 52 : 16) + (rightButton ? 52 : 16) + insets.left - insets.right)
|
|
209
|
+
}, headerTitleAlign === 'left' && leftButton ? {
|
|
210
|
+
marginStart: 4
|
|
211
|
+
} : {
|
|
212
|
+
marginStart: 16
|
|
213
|
+
}, titleContainerStyle],
|
|
214
|
+
children: headerTitle({
|
|
215
|
+
children: title,
|
|
216
|
+
allowFontScaling: titleAllowFontScaling,
|
|
217
|
+
tintColor: headerTintColor,
|
|
218
|
+
style: titleStyle
|
|
219
|
+
})
|
|
220
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
221
|
+
pointerEvents: "box-none",
|
|
222
|
+
style: [styles.end, styles.expand, {
|
|
223
|
+
marginEnd: insets.right
|
|
224
|
+
}, rightContainerStyle],
|
|
225
|
+
children: rightButton
|
|
226
|
+
})]
|
|
227
|
+
})]
|
|
228
|
+
});
|
|
211
229
|
}
|
|
212
230
|
const styles = StyleSheet.create({
|
|
213
231
|
content: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Animated","Platform","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","getDefaultHeaderHeight","HeaderBackground","HeaderShownContext","HeaderTitle","IPAD_MINI_MEDIUM_WIDTH","warnIfHeaderStylesDefined","styles","Object","keys","forEach","styleProp","value","console","warn","undefined","Header","props","insets","frame","isParentHeaderShown","useContext","layout","modal","title","headerTitle","customTitle","headerTitleAlign","
|
|
1
|
+
{"version":3,"names":["useTheme","React","Animated","Platform","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","getDefaultHeaderHeight","HeaderBackground","HeaderShownContext","HeaderTitle","jsx","_jsx","jsxs","_jsxs","IPAD_MINI_MEDIUM_WIDTH","warnIfHeaderStylesDefined","styles","Object","keys","forEach","styleProp","value","console","warn","undefined","Header","props","insets","frame","colors","isParentHeaderShown","useContext","layout","modal","title","headerTitle","customTitle","headerTitleAlign","OS","headerLeft","headerTransparent","headerTintColor","headerBackground","headerRight","headerTitleAllowFontScaling","titleAllowFontScaling","headerTitleStyle","titleStyle","headerLeftContainerStyle","leftContainerStyle","headerRightContainerStyle","rightContainerStyle","headerTitleContainerStyle","titleContainerStyle","headerBackButtonDisplayMode","headerBackgroundContainerStyle","backgroundContainerStyle","headerStyle","customHeaderStyle","headerShadowVisible","headerPressColor","headerPressOpacity","headerStatusBarHeight","top","defaultHeight","height","minHeight","maxHeight","backgroundColor","borderBottomColor","borderBottomEndRadius","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomWidth","borderColor","borderEndColor","borderEndWidth","borderLeftColor","borderLeftWidth","borderRadius","borderRightColor","borderRightWidth","borderStartColor","borderStartWidth","borderStyle","borderTopColor","borderTopEndRadius","borderTopLeftRadius","borderTopRightRadius","borderTopStartRadius","borderTopWidth","borderWidth","boxShadow","elevation","shadowColor","shadowOffset","shadowOpacity","shadowRadius","opacity","transform","unsafeStyles","flatten","process","env","NODE_ENV","safeStyles","backgroundStyle","iconTintColor","select","ios","primary","default","text","leftButton","tintColor","pressColor","pressOpacity","displayMode","rightButton","pointerEvents","style","children","absoluteFill","content","width","large","start","expand","marginStart","left","maxWidth","Math","max","right","allowFontScaling","end","marginEnd","create","flex","flexDirection","alignItems","marginHorizontal","justifyContent","flexGrow","fl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ExF,KAAK;UACfqG,gBAAgB,EAAE1F,qBAAqB;UACvCsE,SAAS,EAAE1E,eAAe;UAC1BgF,KAAK,EAAE1E;QACT,CAAC;MAAC,CACW,CAAC,eAChBpC,IAAA,CAACX,QAAQ,CAACG,IAAI;QACZqH,aAAa,EAAC,UAAU;QACxBC,KAAK,EAAE,CACLzG,MAAM,CAACwH,GAAG,EACVxH,MAAM,CAACgH,MAAM,EACb;UAAES,SAAS,EAAE9G,MAAM,CAAC2G;QAAM,CAAC,EAC3BnF,mBAAmB,CACnB;QAAAuE,QAAA,EAEDH;MAAW,CACC,CAAC;IAAA,CACZ,CAAC;EAAA,CACM,CAAC;AAEpB;AAEA,MAAMvG,MAAM,GAAGd,UAAU,CAACwI,MAAM,CAAC;EAC/Bd,OAAO,EAAE;IACPe,IAAI,EAAE,CAAC;IACPC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd,CAAC;EACDf,KAAK,EAAE;IACLgB,gBAAgB,EAAE;EACpB,CAAC;EACD5G,KAAK,EAAE;IACL6G,cAAc,EAAE;EAClB,CAAC;EACDhB,KAAK,EAAE;IACLgB,cAAc,EAAE,QAAQ;IACxBF,UAAU,EAAE;EACd,CAAC;EACDL,GAAG,EAAE;IACHO,cAAc,EAAE,QAAQ;IACxBF,UAAU,EAAE;EACd,CAAC;EACDb,MAAM,EAAE;IACNgB,QAAQ,EAAE,CAAC;IACXC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { useLocale, useTheme } from '@react-navigation/native';
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { Animated, Image, Platform, StyleSheet, View } from 'react-native';
|
|
6
|
+
import backIcon from '../assets/back-icon.png';
|
|
7
|
+
import backIconMask from '../assets/back-icon-mask.png';
|
|
4
8
|
import { MaskedView } from '../MaskedView';
|
|
5
|
-
import { HeaderButton } from
|
|
9
|
+
import { HeaderButton } from "./HeaderButton.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
11
|
export function HeaderBackButton({
|
|
7
12
|
disabled,
|
|
8
13
|
allowFontScaling,
|
|
9
14
|
backImage,
|
|
10
15
|
label,
|
|
11
16
|
labelStyle,
|
|
12
|
-
|
|
17
|
+
displayMode = Platform.OS === 'ios' ? 'default' : 'minimal',
|
|
13
18
|
onLabelLayout,
|
|
14
19
|
onPress,
|
|
15
20
|
pressColor,
|
|
16
21
|
pressOpacity,
|
|
17
22
|
screenLayout,
|
|
18
|
-
tintColor
|
|
23
|
+
tintColor,
|
|
19
24
|
titleLayout,
|
|
20
25
|
truncatedLabel = 'Back',
|
|
21
26
|
accessibilityLabel = label && label !== 'Back' ? `${label}, back` : 'Go back',
|
|
@@ -30,83 +35,90 @@ export function HeaderBackButton({
|
|
|
30
35
|
const {
|
|
31
36
|
direction
|
|
32
37
|
} = useLocale();
|
|
33
|
-
const [
|
|
34
|
-
const
|
|
35
|
-
ios: colors.primary,
|
|
36
|
-
default: colors.text
|
|
37
|
-
});
|
|
38
|
-
const handleLabelLayout = e => {
|
|
39
|
-
onLabelLayout?.(e);
|
|
40
|
-
const {
|
|
41
|
-
layout
|
|
42
|
-
} = e.nativeEvent;
|
|
43
|
-
setInitialLabelWidth((direction === 'rtl' ? layout.y : layout.x) + layout.width);
|
|
44
|
-
};
|
|
45
|
-
const shouldTruncateLabel = () => {
|
|
46
|
-
return !label || initialLabelWidth && titleLayout && screenLayout && (screenLayout.width - titleLayout.width) / 2 < initialLabelWidth + 26;
|
|
47
|
-
};
|
|
38
|
+
const [labelWidth, setLabelWidth] = React.useState(null);
|
|
39
|
+
const [truncatedLabelWidth, setTruncatedLabelWidth] = React.useState(null);
|
|
48
40
|
const renderBackImage = () => {
|
|
49
41
|
if (backImage) {
|
|
50
42
|
return backImage({
|
|
51
|
-
tintColor
|
|
43
|
+
tintColor: tintColor ?? colors.text
|
|
52
44
|
});
|
|
53
45
|
} else {
|
|
54
|
-
return /*#__PURE__*/
|
|
55
|
-
style: [styles.icon, direction === 'rtl' && styles.flip,
|
|
46
|
+
return /*#__PURE__*/_jsx(Image, {
|
|
47
|
+
style: [styles.icon, direction === 'rtl' && styles.flip, displayMode !== 'minimal' && styles.iconWithLabel, Boolean(tintColor) && {
|
|
56
48
|
tintColor
|
|
57
49
|
}],
|
|
58
50
|
resizeMode: "contain",
|
|
59
|
-
source:
|
|
51
|
+
source: backIcon,
|
|
60
52
|
fadeDuration: 0
|
|
61
53
|
});
|
|
62
54
|
}
|
|
63
55
|
};
|
|
64
56
|
const renderLabel = () => {
|
|
65
|
-
|
|
66
|
-
if (!labelVisible || leftLabelText === undefined) {
|
|
57
|
+
if (displayMode === 'minimal') {
|
|
67
58
|
return null;
|
|
68
59
|
}
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
60
|
+
const availableSpace = titleLayout && screenLayout ? (screenLayout.width - titleLayout.width) / 2 - (ICON_WIDTH + ICON_MARGIN_START) : null;
|
|
61
|
+
const potentialLabelText = displayMode === 'default' ? label : truncatedLabel;
|
|
62
|
+
const finalLabelText = availableSpace && labelWidth && truncatedLabelWidth ? availableSpace > labelWidth ? potentialLabelText : availableSpace > truncatedLabelWidth ? truncatedLabel : null : potentialLabelText;
|
|
63
|
+
const commonStyle = [fonts.regular, styles.label, labelStyle];
|
|
64
|
+
const hiddenStyle = [commonStyle, {
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
top: 0,
|
|
67
|
+
left: 0,
|
|
68
|
+
opacity: 0
|
|
69
|
+
}];
|
|
70
|
+
const labelElement = /*#__PURE__*/_jsxs(View, {
|
|
71
|
+
style: styles.labelWrapper,
|
|
72
|
+
children: [label && displayMode === 'default' ? /*#__PURE__*/_jsx(Animated.Text, {
|
|
73
|
+
style: hiddenStyle,
|
|
74
|
+
numberOfLines: 1,
|
|
75
|
+
onLayout: e => setLabelWidth(e.nativeEvent.layout.width),
|
|
76
|
+
children: label
|
|
77
|
+
}) : null, truncatedLabel ? /*#__PURE__*/_jsx(Animated.Text, {
|
|
78
|
+
style: hiddenStyle,
|
|
79
|
+
numberOfLines: 1,
|
|
80
|
+
onLayout: e => setTruncatedLabelWidth(e.nativeEvent.layout.width),
|
|
81
|
+
children: truncatedLabel
|
|
82
|
+
}) : null, finalLabelText ? /*#__PURE__*/_jsx(Animated.Text, {
|
|
83
|
+
accessible: false,
|
|
84
|
+
onLayout: onLabelLayout,
|
|
85
|
+
style: [tintColor ? {
|
|
86
|
+
color: tintColor
|
|
87
|
+
} : null, commonStyle],
|
|
88
|
+
numberOfLines: 1,
|
|
89
|
+
allowFontScaling: !!allowFontScaling,
|
|
90
|
+
children: finalLabelText
|
|
91
|
+
}) : null]
|
|
92
|
+
});
|
|
83
93
|
if (backImage || Platform.OS !== 'ios') {
|
|
84
94
|
// When a custom backimage is specified, we can't mask the label
|
|
85
95
|
// Otherwise there might be weird effect due to our mask not being the same as the image
|
|
86
96
|
return labelElement;
|
|
87
97
|
}
|
|
88
|
-
return /*#__PURE__*/
|
|
89
|
-
maskElement: /*#__PURE__*/
|
|
98
|
+
return /*#__PURE__*/_jsx(MaskedView, {
|
|
99
|
+
maskElement: /*#__PURE__*/_jsxs(View, {
|
|
90
100
|
style: [styles.iconMaskContainer,
|
|
91
101
|
// Extend the mask to the center of the screen so that label isn't clipped during animation
|
|
92
102
|
screenLayout ? {
|
|
93
103
|
minWidth: screenLayout.width / 2 - 27
|
|
94
|
-
} : null]
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
} : null],
|
|
105
|
+
children: [/*#__PURE__*/_jsx(Image, {
|
|
106
|
+
source: backIconMask,
|
|
107
|
+
resizeMode: "contain",
|
|
108
|
+
style: [styles.iconMask, direction === 'rtl' && styles.flip]
|
|
109
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
110
|
+
style: styles.iconMaskFillerRect
|
|
111
|
+
})]
|
|
112
|
+
}),
|
|
113
|
+
children: labelElement
|
|
114
|
+
});
|
|
103
115
|
};
|
|
104
116
|
const handlePress = () => {
|
|
105
117
|
if (onPress) {
|
|
106
118
|
requestAnimationFrame(() => onPress());
|
|
107
119
|
}
|
|
108
120
|
};
|
|
109
|
-
return /*#__PURE__*/
|
|
121
|
+
return /*#__PURE__*/_jsx(HeaderButton, {
|
|
110
122
|
disabled: disabled,
|
|
111
123
|
href: href,
|
|
112
124
|
accessibilityLabel: accessibilityLabel,
|
|
@@ -114,9 +126,17 @@ export function HeaderBackButton({
|
|
|
114
126
|
onPress: handlePress,
|
|
115
127
|
pressColor: pressColor,
|
|
116
128
|
pressOpacity: pressOpacity,
|
|
117
|
-
style: [styles.container, style]
|
|
118
|
-
|
|
129
|
+
style: [styles.container, style],
|
|
130
|
+
children: /*#__PURE__*/_jsxs(React.Fragment, {
|
|
131
|
+
children: [renderBackImage(), renderLabel()]
|
|
132
|
+
})
|
|
133
|
+
});
|
|
119
134
|
}
|
|
135
|
+
const ICON_WIDTH = Platform.OS === 'ios' ? 13 : 24;
|
|
136
|
+
const ICON_HEIGHT = Platform.OS === 'ios' ? 21 : 24;
|
|
137
|
+
const ICON_MARGIN_START = Platform.OS === 'ios' ? 8 : 3;
|
|
138
|
+
const ICON_MARGIN_END = Platform.OS === 'ios' ? 22 : 3;
|
|
139
|
+
const ICON_MARGIN_VERTICAL = Platform.OS === 'ios' ? 8 : 3;
|
|
120
140
|
const styles = StyleSheet.create({
|
|
121
141
|
container: {
|
|
122
142
|
paddingHorizontal: 0,
|
|
@@ -150,20 +170,13 @@ const styles = StyleSheet.create({
|
|
|
150
170
|
}
|
|
151
171
|
})
|
|
152
172
|
},
|
|
153
|
-
icon:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
default: {
|
|
162
|
-
height: 24,
|
|
163
|
-
width: 24,
|
|
164
|
-
margin: 3
|
|
165
|
-
}
|
|
166
|
-
}),
|
|
173
|
+
icon: {
|
|
174
|
+
height: ICON_HEIGHT,
|
|
175
|
+
width: ICON_WIDTH,
|
|
176
|
+
marginStart: ICON_MARGIN_START,
|
|
177
|
+
marginEnd: ICON_MARGIN_END,
|
|
178
|
+
marginVertical: ICON_MARGIN_VERTICAL
|
|
179
|
+
},
|
|
167
180
|
iconWithLabel: Platform.OS === 'ios' ? {
|
|
168
181
|
marginEnd: 6
|
|
169
182
|
} : {},
|