@react-navigation/elements 1.4.0-alpha.1 → 2.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/commonjs/Background.js +1 -1
- package/lib/commonjs/Background.js.map +1 -1
- package/lib/commonjs/Header/HeaderBackButton.js +22 -17
- package/lib/commonjs/Header/HeaderBackButton.js.map +1 -1
- package/lib/commonjs/Label/Label.js +37 -0
- package/lib/commonjs/Label/Label.js.map +1 -0
- package/lib/commonjs/Label/getLabel.js +10 -0
- package/lib/commonjs/Label/getLabel.js.map +1 -0
- package/lib/commonjs/getDefaultSidebarWidth.js +26 -0
- package/lib/commonjs/getDefaultSidebarWidth.js.map +1 -0
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Background.js +2 -2
- package/lib/module/Background.js.map +1 -1
- package/lib/module/Header/HeaderBackButton.js +24 -19
- package/lib/module/Header/HeaderBackButton.js.map +1 -1
- package/lib/module/Label/Label.js +29 -0
- package/lib/module/Label/Label.js.map +1 -0
- package/lib/module/Label/getLabel.js +4 -0
- package/lib/module/Label/getLabel.js.map +1 -0
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/getDefaultSidebarWidth.js +19 -0
- package/lib/module/getDefaultSidebarWidth.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/Background.d.ts +3 -2
- package/lib/typescript/src/Background.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackButton.d.ts.map +1 -1
- package/lib/typescript/src/Label/Label.d.ts +9 -0
- package/lib/typescript/src/Label/Label.d.ts.map +1 -0
- package/lib/typescript/src/Label/getLabel.d.ts +5 -0
- package/lib/typescript/src/Label/getLabel.d.ts.map +1 -0
- package/lib/typescript/src/Screen.d.ts +2 -2
- package/lib/typescript/src/Screen.d.ts.map +1 -1
- package/lib/typescript/src/getDefaultSidebarWidth.d.ts +5 -0
- package/lib/typescript/src/getDefaultSidebarWidth.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/Background.tsx +4 -3
- package/src/Header/HeaderBackButton.tsx +20 -9
- package/src/Label/Label.tsx +39 -0
- package/src/Label/getLabel.tsx +10 -0
- package/src/Screen.tsx +2 -2
- package/src/getDefaultSidebarWidth.tsx +22 -0
- package/src/index.tsx +3 -0
|
@@ -18,7 +18,7 @@ function Background(_ref) {
|
|
|
18
18
|
const {
|
|
19
19
|
colors
|
|
20
20
|
} = (0, _native.useTheme)();
|
|
21
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, _extends({}, rest, {
|
|
21
|
+
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, _extends({}, rest, {
|
|
22
22
|
style: [{
|
|
23
23
|
flex: 1,
|
|
24
24
|
backgroundColor: colors.background
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Background","style","rest","colors","useTheme","flex","backgroundColor","background"],"sourceRoot":"../../src","sources":["Background.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["Background","style","rest","colors","useTheme","flex","backgroundColor","background"],"sourceRoot":"../../src","sources":["Background.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAAyE;AAAA;AAAA;AAOlE,SAASA,UAAU,OAA4B;EAAA,IAA3B;IAAEC,KAAK;IAAE,GAAGC;EAAY,CAAC;EAClD,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,gBAAQ,GAAE;EAE7B,oBACE,oBAAC,qBAAQ,CAAC,IAAI,eACRF,IAAI;IACR,KAAK,EAAE,CAAC;MAAEG,IAAI,EAAE,CAAC;MAAEC,eAAe,EAAEH,MAAM,CAACI;IAAW,CAAC,EAAEN,KAAK;EAAE,GAChE;AAEN"}
|
|
@@ -18,7 +18,7 @@ function HeaderBackButton(_ref) {
|
|
|
18
18
|
backImage,
|
|
19
19
|
label,
|
|
20
20
|
labelStyle,
|
|
21
|
-
labelVisible,
|
|
21
|
+
labelVisible = _reactNative.Platform.OS === 'ios',
|
|
22
22
|
onLabelLayout,
|
|
23
23
|
onPress,
|
|
24
24
|
pressColor,
|
|
@@ -35,6 +35,9 @@ function HeaderBackButton(_ref) {
|
|
|
35
35
|
colors,
|
|
36
36
|
fonts
|
|
37
37
|
} = (0, _native.useTheme)();
|
|
38
|
+
const {
|
|
39
|
+
direction
|
|
40
|
+
} = (0, _native.useLocale)();
|
|
38
41
|
const [initialLabelWidth, setInitialLabelWidth] = React.useState(undefined);
|
|
39
42
|
const tintColor = customTintColor !== undefined ? customTintColor : _reactNative.Platform.select({
|
|
40
43
|
ios: colors.primary,
|
|
@@ -42,7 +45,10 @@ function HeaderBackButton(_ref) {
|
|
|
42
45
|
});
|
|
43
46
|
const handleLabelLayout = e => {
|
|
44
47
|
onLabelLayout === null || onLabelLayout === void 0 ? void 0 : onLabelLayout(e);
|
|
45
|
-
|
|
48
|
+
const {
|
|
49
|
+
layout
|
|
50
|
+
} = e.nativeEvent;
|
|
51
|
+
setInitialLabelWidth((direction === 'rtl' ? layout.y : layout.x) + layout.width);
|
|
46
52
|
};
|
|
47
53
|
const shouldTruncateLabel = () => {
|
|
48
54
|
return !label || initialLabelWidth && titleLayout && screenLayout && (screenLayout.width - titleLayout.width) / 2 < initialLabelWidth + 26;
|
|
@@ -54,7 +60,7 @@ function HeaderBackButton(_ref) {
|
|
|
54
60
|
});
|
|
55
61
|
} else {
|
|
56
62
|
return /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
57
|
-
style: [styles.icon, Boolean(labelVisible) && styles.iconWithLabel, Boolean(tintColor) && {
|
|
63
|
+
style: [styles.icon, direction === 'rtl' && styles.flip, Boolean(labelVisible) && styles.iconWithLabel, Boolean(tintColor) && {
|
|
58
64
|
tintColor
|
|
59
65
|
}],
|
|
60
66
|
source: require('../assets/back-icon.png'),
|
|
@@ -96,7 +102,7 @@ function HeaderBackButton(_ref) {
|
|
|
96
102
|
style: styles.iconMaskContainer
|
|
97
103
|
}, /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
98
104
|
source: require('../assets/back-icon-mask.png'),
|
|
99
|
-
style: styles.iconMask
|
|
105
|
+
style: [styles.iconMask, direction === 'rtl' && styles.flip]
|
|
100
106
|
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
101
107
|
style: styles.iconMaskFillerRect
|
|
102
108
|
}))
|
|
@@ -112,9 +118,7 @@ function HeaderBackButton(_ref) {
|
|
|
112
118
|
onPress: disabled ? undefined : handlePress,
|
|
113
119
|
pressColor: pressColor,
|
|
114
120
|
pressOpacity: pressOpacity,
|
|
115
|
-
android_ripple:
|
|
116
|
-
borderless: true
|
|
117
|
-
},
|
|
121
|
+
android_ripple: androidRipple,
|
|
118
122
|
style: [styles.container, disabled && styles.disabled, style],
|
|
119
123
|
hitSlop: _reactNative.Platform.select({
|
|
120
124
|
ios: undefined,
|
|
@@ -127,6 +131,11 @@ function HeaderBackButton(_ref) {
|
|
|
127
131
|
})
|
|
128
132
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, renderBackImage(), renderLabel()));
|
|
129
133
|
}
|
|
134
|
+
const androidRipple = {
|
|
135
|
+
borderless: true,
|
|
136
|
+
foreground: _reactNative.Platform.OS === 'android' && _reactNative.Platform.Version >= 23,
|
|
137
|
+
radius: 20
|
|
138
|
+
};
|
|
130
139
|
const styles = _reactNative.StyleSheet.create({
|
|
131
140
|
container: {
|
|
132
141
|
alignItems: 'center',
|
|
@@ -163,19 +172,13 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
163
172
|
marginLeft: 8,
|
|
164
173
|
marginRight: 22,
|
|
165
174
|
marginVertical: 12,
|
|
166
|
-
resizeMode: 'contain'
|
|
167
|
-
transform: [{
|
|
168
|
-
scaleX: _reactNative.I18nManager.getConstants().isRTL ? -1 : 1
|
|
169
|
-
}]
|
|
175
|
+
resizeMode: 'contain'
|
|
170
176
|
},
|
|
171
177
|
default: {
|
|
172
178
|
height: 24,
|
|
173
179
|
width: 24,
|
|
174
180
|
margin: 3,
|
|
175
|
-
resizeMode: 'contain'
|
|
176
|
-
transform: [{
|
|
177
|
-
scaleX: _reactNative.I18nManager.getConstants().isRTL ? -1 : 1
|
|
178
|
-
}]
|
|
181
|
+
resizeMode: 'contain'
|
|
179
182
|
}
|
|
180
183
|
}),
|
|
181
184
|
iconWithLabel: _reactNative.Platform.OS === 'ios' ? {
|
|
@@ -196,9 +199,11 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
196
199
|
marginLeft: -14.5,
|
|
197
200
|
marginVertical: 12,
|
|
198
201
|
alignSelf: 'center',
|
|
199
|
-
resizeMode: 'contain'
|
|
202
|
+
resizeMode: 'contain'
|
|
203
|
+
},
|
|
204
|
+
flip: {
|
|
200
205
|
transform: [{
|
|
201
|
-
scaleX:
|
|
206
|
+
scaleX: -1
|
|
202
207
|
}]
|
|
203
208
|
}
|
|
204
209
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HeaderBackButton","disabled","allowFontScaling","backImage","label","labelStyle","labelVisible","onLabelLayout","onPress","pressColor","pressOpacity","screenLayout","tintColor","customTintColor","titleLayout","truncatedLabel","accessibilityLabel","testID","style","colors","fonts","useTheme","initialLabelWidth","setInitialLabelWidth","React","useState","undefined","
|
|
1
|
+
{"version":3,"names":["HeaderBackButton","disabled","allowFontScaling","backImage","label","labelStyle","labelVisible","Platform","OS","onLabelLayout","onPress","pressColor","pressOpacity","screenLayout","tintColor","customTintColor","titleLayout","truncatedLabel","accessibilityLabel","testID","style","colors","fonts","useTheme","direction","useLocale","initialLabelWidth","setInitialLabelWidth","React","useState","undefined","select","ios","primary","default","text","handleLabelLayout","e","layout","nativeEvent","y","x","width","shouldTruncateLabel","renderBackImage","styles","icon","flip","Boolean","iconWithLabel","require","renderLabel","leftLabelText","labelElement","labelWrapper","minWidth","color","regular","iconMaskContainer","iconMask","iconMaskFillerRect","handlePress","requestAnimationFrame","androidRipple","container","top","right","bottom","left","borderless","foreground","Version","radius","StyleSheet","create","alignItems","flexDirection","hairlineWidth","marginVertical","marginHorizontal","opacity","fontSize","letterSpacing","height","marginLeft","marginRight","resizeMode","margin","flex","justifyContent","backgroundColor","alignSelf","transform","scaleX"],"sourceRoot":"../../../src","sources":["Header/HeaderBackButton.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AASA;AACA;AAAyD;AAAA;AAGlD,SAASA,gBAAgB,OAkBN;EAAA,IAlBO;IAC/BC,QAAQ;IACRC,gBAAgB;IAChBC,SAAS;IACTC,KAAK;IACLC,UAAU;IACVC,YAAY,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;IACpCC,aAAa;IACbC,OAAO;IACPC,UAAU;IACVC,YAAY;IACZC,YAAY;IACZC,SAAS,EAAEC,eAAe;IAC1BC,WAAW;IACXC,cAAc,GAAG,MAAM;IACvBC,kBAAkB,GAAGd,KAAK,IAAIA,KAAK,KAAK,MAAM,GAAI,GAAEA,KAAM,QAAO,GAAG,SAAS;IAC7Ee,MAAM;IACNC;EACqB,CAAC;EACtB,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gBAAQ,GAAE;EACpC,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,iBAAS,GAAE;EAEjC,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGC,KAAK,CAACC,QAAQ,CAE9DC,SAAS,CAAC;EAEZ,MAAMhB,SAAS,GACbC,eAAe,KAAKe,SAAS,GACzBf,eAAe,GACfR,qBAAQ,CAACwB,MAAM,CAAC;IACdC,GAAG,EAAEX,MAAM,CAACY,OAAO;IACnBC,OAAO,EAAEb,MAAM,CAACc;EAClB,CAAC,CAAC;EAER,MAAMC,iBAAiB,GAAIC,CAAoB,IAAK;IAClD5B,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAG4B,CAAC,CAAC;IAElB,MAAM;MAAEC;IAAO,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AAK,EAAE,EAAE;MACT0C,UAAU,EAAE,CAAC;MACbC,WAAW,EAAE,EAAE;MACfP,cAAc,EAAE,EAAE;MAClBQ,UAAU,EAAE;IACd,CAAC;IACDpD,OAAO,EAAE;MACPiD,MAAM,EAAE,EAAE;MACVzC,KAAK,EAAE,EAAE;MACT6C,MAAM,EAAE,CAAC;MACTD,UAAU,EAAE;IACd;EACF,CAAC,CAAC;EACFrC,aAAa,EACX1C,qBAAQ,CAACC,EAAE,KAAK,KAAK,GACjB;IACE6E,WAAW,EAAE;EACf,CAAC,GACD,CAAC,CAAC;EACR3B,iBAAiB,EAAE;IACjB8B,IAAI,EAAE,CAAC;IACPZ,aAAa,EAAE,KAAK;IACpBa,cAAc,EAAE;EAClB,CAAC;EACD7B,kBAAkB,EAAE;IAClB4B,IAAI,EAAE,CAAC;IACPE,eAAe,EAAE;EACnB,CAAC;EACD/B,QAAQ,EAAE;IACRwB,MAAM,EAAE,EAAE;IACVzC,KAAK,EAAE,EAAE;IACT0C,UAAU,EAAE,CAAC,IAAI;IACjBN,cAAc,EAAE,EAAE;IAClBa,SAAS,EAAE,QAAQ;IACnBL,UAAU,EAAE;EACd,CAAC;EACDvC,IAAI,EAAE;IACJ6C,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE,CAAC;IAAE,CAAC;EAC5B;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Label = Label;
|
|
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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
+
function Label(_ref) {
|
|
14
|
+
let {
|
|
15
|
+
tintColor,
|
|
16
|
+
style,
|
|
17
|
+
...rest
|
|
18
|
+
} = _ref;
|
|
19
|
+
const {
|
|
20
|
+
colors,
|
|
21
|
+
fonts
|
|
22
|
+
} = (0, _native.useTheme)();
|
|
23
|
+
return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({
|
|
24
|
+
numberOfLines: 1
|
|
25
|
+
}, rest, {
|
|
26
|
+
style: [fonts.regular, styles.label, {
|
|
27
|
+
color: tintColor === undefined ? colors.text : tintColor
|
|
28
|
+
}, style]
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
const styles = _reactNative.StyleSheet.create({
|
|
32
|
+
label: {
|
|
33
|
+
textAlign: 'center',
|
|
34
|
+
backgroundColor: 'transparent'
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Label","tintColor","style","rest","colors","fonts","useTheme","regular","styles","label","color","undefined","text","StyleSheet","create","textAlign","backgroundColor"],"sourceRoot":"../../../src","sources":["Label/Label.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAMsB;AAAA;AAAA;AAQf,SAASA,KAAK,OAAuC;EAAA,IAAtC;IAAEC,SAAS;IAAEC,KAAK;IAAE,GAAGC;EAAY,CAAC;EACxD,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gBAAQ,GAAE;EAEpC,oBACE,oBAAC,iBAAI;IACH,aAAa,EAAE;EAAE,GACbH,IAAI;IACR,KAAK,EAAE,CACLE,KAAK,CAACE,OAAO,EACbC,MAAM,CAACC,KAAK,EACZ;MAAEC,KAAK,EAAET,SAAS,KAAKU,SAAS,GAAGP,MAAM,CAACQ,IAAI,GAAGX;IAAU,CAAC,EAC5DC,KAAK;EACL,GACF;AAEN;AAEA,MAAMM,MAAM,GAAGK,uBAAU,CAACC,MAAM,CAAC;EAC/BL,KAAK,EAAE;IACLM,SAAS,EAAE,QAAQ;IACnBC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getLabel = getLabel;
|
|
7
|
+
function getLabel(options, fallback) {
|
|
8
|
+
return options.label !== undefined ? options.label : options.title !== undefined ? options.title : fallback;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=getLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getLabel","options","fallback","label","undefined","title"],"sourceRoot":"../../../src","sources":["Label/getLabel.tsx"],"mappings":";;;;;;AAAO,SAASA,QAAQ,CACtBC,OAA2C,EAC3CC,QAAgB,EACR;EACR,OAAOD,OAAO,CAACE,KAAK,KAAKC,SAAS,GAC9BH,OAAO,CAACE,KAAK,GACbF,OAAO,CAACI,KAAK,KAAKD,SAAS,GAC3BH,OAAO,CAACI,KAAK,GACbH,QAAQ;AACd"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDefaultSidebarWidth = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const getDefaultSidebarWidth = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
height,
|
|
11
|
+
width
|
|
12
|
+
} = _ref;
|
|
13
|
+
/*
|
|
14
|
+
* Default sidebar width is screen width - header height
|
|
15
|
+
* with a max width of 280 on mobile and 320 on tablet
|
|
16
|
+
* https://material.io/components/navigation-drawer
|
|
17
|
+
*/
|
|
18
|
+
const smallerAxisSize = Math.min(height, width);
|
|
19
|
+
const isLandscape = width > height;
|
|
20
|
+
const isTablet = smallerAxisSize >= 600;
|
|
21
|
+
const appBarHeight = _reactNative.Platform.OS === 'ios' ? isLandscape ? 32 : 44 : 56;
|
|
22
|
+
const maxWidth = isTablet ? 320 : 280;
|
|
23
|
+
return Math.min(smallerAxisSize - appBarHeight, maxWidth);
|
|
24
|
+
};
|
|
25
|
+
exports.getDefaultSidebarWidth = getDefaultSidebarWidth;
|
|
26
|
+
//# sourceMappingURL=getDefaultSidebarWidth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getDefaultSidebarWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","Platform","OS","maxWidth"],"sourceRoot":"../../src","sources":["getDefaultSidebarWidth.tsx"],"mappings":";;;;;;AAAA;AAEO,MAAMA,sBAAsB,GAAG,QAMhC;EAAA,IANiC;IACrCC,MAAM;IACNC;EAIF,CAAC;EACC;AACF;AACA;AACA;AACA;EACE,MAAMC,eAAe,GAAGC,IAAI,CAACC,GAAG,CAACJ,MAAM,EAAEC,KAAK,CAAC;EAC/C,MAAMI,WAAW,GAAGJ,KAAK,GAAGD,MAAM;EAClC,MAAMM,QAAQ,GAAGJ,eAAe,IAAI,GAAG;EACvC,MAAMK,YAAY,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAIJ,WAAW,GAAG,EAAE,GAAG,EAAE,GAAI,EAAE;EACzE,MAAMK,QAAQ,GAAGJ,QAAQ,GAAG,GAAG,GAAG,GAAG;EAErC,OAAOH,IAAI,CAACC,GAAG,CAACF,eAAe,GAAGK,YAAY,EAAEG,QAAQ,CAAC;AAC3D,CAAC;AAAC"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Assets: true,
|
|
8
8
|
Background: true,
|
|
9
|
+
getDefaultSidebarWidth: true,
|
|
9
10
|
getDefaultHeaderHeight: true,
|
|
10
11
|
getHeaderTitle: true,
|
|
11
12
|
Header: true,
|
|
@@ -16,6 +17,8 @@ var _exportNames = {
|
|
|
16
17
|
HeaderShownContext: true,
|
|
17
18
|
HeaderTitle: true,
|
|
18
19
|
useHeaderHeight: true,
|
|
20
|
+
getLabel: true,
|
|
21
|
+
Label: true,
|
|
19
22
|
MissingIcon: true,
|
|
20
23
|
PlatformPressable: true,
|
|
21
24
|
ResourceSavingView: true,
|
|
@@ -71,6 +74,12 @@ Object.defineProperty(exports, "HeaderTitle", {
|
|
|
71
74
|
return _HeaderTitle.HeaderTitle;
|
|
72
75
|
}
|
|
73
76
|
});
|
|
77
|
+
Object.defineProperty(exports, "Label", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return _Label.Label;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
74
83
|
Object.defineProperty(exports, "MissingIcon", {
|
|
75
84
|
enumerable: true,
|
|
76
85
|
get: function () {
|
|
@@ -107,12 +116,24 @@ Object.defineProperty(exports, "getDefaultHeaderHeight", {
|
|
|
107
116
|
return _getDefaultHeaderHeight.getDefaultHeaderHeight;
|
|
108
117
|
}
|
|
109
118
|
});
|
|
119
|
+
Object.defineProperty(exports, "getDefaultSidebarWidth", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
get: function () {
|
|
122
|
+
return _getDefaultSidebarWidth.getDefaultSidebarWidth;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
110
125
|
Object.defineProperty(exports, "getHeaderTitle", {
|
|
111
126
|
enumerable: true,
|
|
112
127
|
get: function () {
|
|
113
128
|
return _getHeaderTitle.getHeaderTitle;
|
|
114
129
|
}
|
|
115
130
|
});
|
|
131
|
+
Object.defineProperty(exports, "getLabel", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _getLabel.getLabel;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
116
137
|
Object.defineProperty(exports, "useHeaderHeight", {
|
|
117
138
|
enumerable: true,
|
|
118
139
|
get: function () {
|
|
@@ -120,6 +141,7 @@ Object.defineProperty(exports, "useHeaderHeight", {
|
|
|
120
141
|
}
|
|
121
142
|
});
|
|
122
143
|
var _Background = require("./Background");
|
|
144
|
+
var _getDefaultSidebarWidth = require("./getDefaultSidebarWidth");
|
|
123
145
|
var _getDefaultHeaderHeight = require("./Header/getDefaultHeaderHeight");
|
|
124
146
|
var _getHeaderTitle = require("./Header/getHeaderTitle");
|
|
125
147
|
var _Header = require("./Header/Header");
|
|
@@ -130,6 +152,8 @@ var _HeaderHeightContext = require("./Header/HeaderHeightContext");
|
|
|
130
152
|
var _HeaderShownContext = require("./Header/HeaderShownContext");
|
|
131
153
|
var _HeaderTitle = require("./Header/HeaderTitle");
|
|
132
154
|
var _useHeaderHeight = require("./Header/useHeaderHeight");
|
|
155
|
+
var _getLabel = require("./Label/getLabel");
|
|
156
|
+
var _Label = require("./Label/Label");
|
|
133
157
|
var _MissingIcon = require("./MissingIcon");
|
|
134
158
|
var _PlatformPressable = require("./PlatformPressable");
|
|
135
159
|
var _ResourceSavingView = require("./ResourceSavingView");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Assets","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Assets","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAPO,MAAMA,MAAM,GAAG;AACpB;AACAC,OAAO,CAAC,wBAAwB,CAAC;AACjC;AACAA,OAAO,CAAC,6BAA6B,CAAC,CACvC;AAAC"}
|
package/lib/module/Background.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import { useTheme } from '@react-navigation/native';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { Animated } from 'react-native';
|
|
5
5
|
export function Background(_ref) {
|
|
6
6
|
let {
|
|
7
7
|
style,
|
|
@@ -10,7 +10,7 @@ export function Background(_ref) {
|
|
|
10
10
|
const {
|
|
11
11
|
colors
|
|
12
12
|
} = useTheme();
|
|
13
|
-
return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
|
|
13
|
+
return /*#__PURE__*/React.createElement(Animated.View, _extends({}, rest, {
|
|
14
14
|
style: [{
|
|
15
15
|
flex: 1,
|
|
16
16
|
backgroundColor: colors.background
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useTheme","React","
|
|
1
|
+
{"version":3,"names":["useTheme","React","Animated","Background","style","rest","colors","flex","backgroundColor","background"],"sourceRoot":"../../src","sources":["Background.tsx"],"mappings":";AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAyC,cAAc;AAOxE,OAAO,SAASC,UAAU,OAA4B;EAAA,IAA3B;IAAEC,KAAK;IAAE,GAAGC;EAAY,CAAC;EAClD,MAAM;IAAEC;EAAO,CAAC,GAAGN,QAAQ,EAAE;EAE7B,oBACE,oBAAC,QAAQ,CAAC,IAAI,eACRK,IAAI;IACR,KAAK,EAAE,CAAC;MAAEE,IAAI,EAAE,CAAC;MAAEC,eAAe,EAAEF,MAAM,CAACG;IAAW,CAAC,EAAEL,KAAK;EAAE,GAChE;AAEN"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useTheme } from '@react-navigation/native';
|
|
1
|
+
import { useLocale, useTheme } from '@react-navigation/native';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Animated,
|
|
3
|
+
import { Animated, Image, Platform, StyleSheet, View } from 'react-native';
|
|
4
4
|
import { MaskedView } from '../MaskedView';
|
|
5
5
|
import { PlatformPressable } from '../PlatformPressable';
|
|
6
6
|
export function HeaderBackButton(_ref) {
|
|
@@ -10,7 +10,7 @@ export function HeaderBackButton(_ref) {
|
|
|
10
10
|
backImage,
|
|
11
11
|
label,
|
|
12
12
|
labelStyle,
|
|
13
|
-
labelVisible,
|
|
13
|
+
labelVisible = Platform.OS === 'ios',
|
|
14
14
|
onLabelLayout,
|
|
15
15
|
onPress,
|
|
16
16
|
pressColor,
|
|
@@ -27,6 +27,9 @@ export function HeaderBackButton(_ref) {
|
|
|
27
27
|
colors,
|
|
28
28
|
fonts
|
|
29
29
|
} = useTheme();
|
|
30
|
+
const {
|
|
31
|
+
direction
|
|
32
|
+
} = useLocale();
|
|
30
33
|
const [initialLabelWidth, setInitialLabelWidth] = React.useState(undefined);
|
|
31
34
|
const tintColor = customTintColor !== undefined ? customTintColor : Platform.select({
|
|
32
35
|
ios: colors.primary,
|
|
@@ -34,7 +37,10 @@ export function HeaderBackButton(_ref) {
|
|
|
34
37
|
});
|
|
35
38
|
const handleLabelLayout = e => {
|
|
36
39
|
onLabelLayout === null || onLabelLayout === void 0 ? void 0 : onLabelLayout(e);
|
|
37
|
-
|
|
40
|
+
const {
|
|
41
|
+
layout
|
|
42
|
+
} = e.nativeEvent;
|
|
43
|
+
setInitialLabelWidth((direction === 'rtl' ? layout.y : layout.x) + layout.width);
|
|
38
44
|
};
|
|
39
45
|
const shouldTruncateLabel = () => {
|
|
40
46
|
return !label || initialLabelWidth && titleLayout && screenLayout && (screenLayout.width - titleLayout.width) / 2 < initialLabelWidth + 26;
|
|
@@ -46,7 +52,7 @@ export function HeaderBackButton(_ref) {
|
|
|
46
52
|
});
|
|
47
53
|
} else {
|
|
48
54
|
return /*#__PURE__*/React.createElement(Image, {
|
|
49
|
-
style: [styles.icon, Boolean(labelVisible) && styles.iconWithLabel, Boolean(tintColor) && {
|
|
55
|
+
style: [styles.icon, direction === 'rtl' && styles.flip, Boolean(labelVisible) && styles.iconWithLabel, Boolean(tintColor) && {
|
|
50
56
|
tintColor
|
|
51
57
|
}],
|
|
52
58
|
source: require('../assets/back-icon.png'),
|
|
@@ -88,7 +94,7 @@ export function HeaderBackButton(_ref) {
|
|
|
88
94
|
style: styles.iconMaskContainer
|
|
89
95
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
90
96
|
source: require('../assets/back-icon-mask.png'),
|
|
91
|
-
style: styles.iconMask
|
|
97
|
+
style: [styles.iconMask, direction === 'rtl' && styles.flip]
|
|
92
98
|
}), /*#__PURE__*/React.createElement(View, {
|
|
93
99
|
style: styles.iconMaskFillerRect
|
|
94
100
|
}))
|
|
@@ -104,9 +110,7 @@ export function HeaderBackButton(_ref) {
|
|
|
104
110
|
onPress: disabled ? undefined : handlePress,
|
|
105
111
|
pressColor: pressColor,
|
|
106
112
|
pressOpacity: pressOpacity,
|
|
107
|
-
android_ripple:
|
|
108
|
-
borderless: true
|
|
109
|
-
},
|
|
113
|
+
android_ripple: androidRipple,
|
|
110
114
|
style: [styles.container, disabled && styles.disabled, style],
|
|
111
115
|
hitSlop: Platform.select({
|
|
112
116
|
ios: undefined,
|
|
@@ -119,6 +123,11 @@ export function HeaderBackButton(_ref) {
|
|
|
119
123
|
})
|
|
120
124
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, renderBackImage(), renderLabel()));
|
|
121
125
|
}
|
|
126
|
+
const androidRipple = {
|
|
127
|
+
borderless: true,
|
|
128
|
+
foreground: Platform.OS === 'android' && Platform.Version >= 23,
|
|
129
|
+
radius: 20
|
|
130
|
+
};
|
|
122
131
|
const styles = StyleSheet.create({
|
|
123
132
|
container: {
|
|
124
133
|
alignItems: 'center',
|
|
@@ -155,19 +164,13 @@ const styles = StyleSheet.create({
|
|
|
155
164
|
marginLeft: 8,
|
|
156
165
|
marginRight: 22,
|
|
157
166
|
marginVertical: 12,
|
|
158
|
-
resizeMode: 'contain'
|
|
159
|
-
transform: [{
|
|
160
|
-
scaleX: I18nManager.getConstants().isRTL ? -1 : 1
|
|
161
|
-
}]
|
|
167
|
+
resizeMode: 'contain'
|
|
162
168
|
},
|
|
163
169
|
default: {
|
|
164
170
|
height: 24,
|
|
165
171
|
width: 24,
|
|
166
172
|
margin: 3,
|
|
167
|
-
resizeMode: 'contain'
|
|
168
|
-
transform: [{
|
|
169
|
-
scaleX: I18nManager.getConstants().isRTL ? -1 : 1
|
|
170
|
-
}]
|
|
173
|
+
resizeMode: 'contain'
|
|
171
174
|
}
|
|
172
175
|
}),
|
|
173
176
|
iconWithLabel: Platform.OS === 'ios' ? {
|
|
@@ -188,9 +191,11 @@ const styles = StyleSheet.create({
|
|
|
188
191
|
marginLeft: -14.5,
|
|
189
192
|
marginVertical: 12,
|
|
190
193
|
alignSelf: 'center',
|
|
191
|
-
resizeMode: 'contain'
|
|
194
|
+
resizeMode: 'contain'
|
|
195
|
+
},
|
|
196
|
+
flip: {
|
|
192
197
|
transform: [{
|
|
193
|
-
scaleX:
|
|
198
|
+
scaleX: -1
|
|
194
199
|
}]
|
|
195
200
|
}
|
|
196
201
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useTheme","React","Animated","
|
|
1
|
+
{"version":3,"names":["useLocale","useTheme","React","Animated","Image","Platform","StyleSheet","View","MaskedView","PlatformPressable","HeaderBackButton","disabled","allowFontScaling","backImage","label","labelStyle","labelVisible","OS","onLabelLayout","onPress","pressColor","pressOpacity","screenLayout","tintColor","customTintColor","titleLayout","truncatedLabel","accessibilityLabel","testID","style","colors","fonts","direction","initialLabelWidth","setInitialLabelWidth","useState","undefined","select","ios","primary","default","text","handleLabelLayout","e","layout","nativeEvent","y","x","width","shouldTruncateLabel","renderBackImage","styles","icon","flip","Boolean","iconWithLabel","require","renderLabel","leftLabelText","labelElement","labelWrapper","minWidth","color","regular","iconMaskContainer","iconMask","iconMaskFillerRect","handlePress","requestAnimationFrame","androidRipple","container","top","right","bottom","left","borderless","foreground","Version","radius","create","alignItems","flexDirection","hairlineWidth","marginVertical","marginHorizontal","opacity","fontSize","letterSpacing","height","marginLeft","marginRight","resizeMode","margin","flex","justifyContent","backgroundColor","alignSelf","transform","scaleX"],"sourceRoot":"../../../src","sources":["Header/HeaderBackButton.tsx"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,0BAA0B;AAC9D,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,KAAK,EAELC,QAAQ,EACRC,UAAU,EACVC,IAAI,QACC,cAAc;AAErB,SAASC,UAAU,QAAQ,eAAe;AAC1C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XlD,QAAQ,CAACY,EAAE,KAAK,KAAK,GACjB;IACEyE,WAAW,EAAE;EACf,CAAC,GACD,CAAC,CAAC;EACR1B,iBAAiB,EAAE;IACjB6B,IAAI,EAAE,CAAC;IACPZ,aAAa,EAAE,KAAK;IACpBa,cAAc,EAAE;EAClB,CAAC;EACD5B,kBAAkB,EAAE;IAClB2B,IAAI,EAAE,CAAC;IACPE,eAAe,EAAE;EACnB,CAAC;EACD9B,QAAQ,EAAE;IACRuB,MAAM,EAAE,EAAE;IACVxC,KAAK,EAAE,EAAE;IACTyC,UAAU,EAAE,CAAC,IAAI;IACjBN,cAAc,EAAE,EAAE;IAClBa,SAAS,EAAE,QAAQ;IACnBL,UAAU,EAAE;EACd,CAAC;EACDtC,IAAI,EAAE;IACJ4C,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE,CAAC;IAAE,CAAC;EAC5B;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { useTheme } from '@react-navigation/native';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { StyleSheet, Text } from 'react-native';
|
|
5
|
+
export function Label(_ref) {
|
|
6
|
+
let {
|
|
7
|
+
tintColor,
|
|
8
|
+
style,
|
|
9
|
+
...rest
|
|
10
|
+
} = _ref;
|
|
11
|
+
const {
|
|
12
|
+
colors,
|
|
13
|
+
fonts
|
|
14
|
+
} = useTheme();
|
|
15
|
+
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
16
|
+
numberOfLines: 1
|
|
17
|
+
}, rest, {
|
|
18
|
+
style: [fonts.regular, styles.label, {
|
|
19
|
+
color: tintColor === undefined ? colors.text : tintColor
|
|
20
|
+
}, style]
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
label: {
|
|
25
|
+
textAlign: 'center',
|
|
26
|
+
backgroundColor: 'transparent'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useTheme","React","StyleSheet","Text","Label","tintColor","style","rest","colors","fonts","regular","styles","label","color","undefined","text","create","textAlign","backgroundColor"],"sourceRoot":"../../../src","sources":["Label/Label.tsx"],"mappings":";AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAEEC,UAAU,EACVC,IAAI,QAGC,cAAc;AAQrB,OAAO,SAASC,KAAK,OAAuC;EAAA,IAAtC;IAAEC,SAAS;IAAEC,KAAK;IAAE,GAAGC;EAAY,CAAC;EACxD,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGT,QAAQ,EAAE;EAEpC,oBACE,oBAAC,IAAI;IACH,aAAa,EAAE;EAAE,GACbO,IAAI;IACR,KAAK,EAAE,CACLE,KAAK,CAACC,OAAO,EACbC,MAAM,CAACC,KAAK,EACZ;MAAEC,KAAK,EAAER,SAAS,KAAKS,SAAS,GAAGN,MAAM,CAACO,IAAI,GAAGV;IAAU,CAAC,EAC5DC,KAAK;EACL,GACF;AAEN;AAEA,MAAMK,MAAM,GAAGT,UAAU,CAACc,MAAM,CAAC;EAC/BJ,KAAK,EAAE;IACLK,SAAS,EAAE,QAAQ;IACnBC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getLabel","options","fallback","label","undefined","title"],"sourceRoot":"../../../src","sources":["Label/getLabel.tsx"],"mappings":"AAAA,OAAO,SAASA,QAAQ,CACtBC,OAA2C,EAC3CC,QAAgB,EACR;EACR,OAAOD,OAAO,CAACE,KAAK,KAAKC,SAAS,GAC9BH,OAAO,CAACE,KAAK,GACbF,OAAO,CAACI,KAAK,KAAKD,SAAS,GAC3BH,OAAO,CAACI,KAAK,GACbH,QAAQ;AACd"}
|
package/lib/module/Screen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NavigationContext","NavigationRouteContext","React","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","Background","getDefaultHeaderHeight","HeaderHeightContext","HeaderShownContext","Screen","props","dimensions","insets","isParentHeaderShown","useContext","parentHeaderHeight","focused","modal","header","headerShown","headerTransparent","headerStatusBarHeight","top","navigation","route","children","style","headerHeight","setHeaderHeight","useState","styles","container","content","e","height","nativeEvent","layout","absolute","create","flex","flexDirection","position","left","right"],"sourceRoot":"../../src","sources":["Screen.tsx"],"mappings":"AAAA,SACEA,iBAAiB,EAEjBC,sBAAsB,QAGjB,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,
|
|
1
|
+
{"version":3,"names":["NavigationContext","NavigationRouteContext","React","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","Background","getDefaultHeaderHeight","HeaderHeightContext","HeaderShownContext","Screen","props","dimensions","insets","isParentHeaderShown","useContext","parentHeaderHeight","focused","modal","header","headerShown","headerTransparent","headerStatusBarHeight","top","navigation","route","children","style","headerHeight","setHeaderHeight","useState","styles","container","content","e","height","nativeEvent","layout","absolute","create","flex","flexDirection","position","left","right"],"sourceRoot":"../../src","sources":["Screen.tsx"],"mappings":"AAAA,SACEA,iBAAiB,EAEjBC,sBAAsB,QAGjB,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAA8BC,UAAU,EAAEC,IAAI,QAAmB,cAAc;AAC/E,SACEC,gBAAgB,EAChBC,iBAAiB,QACZ,gCAAgC;AAEvC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,sBAAsB,QAAQ,iCAAiC;AACxE,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SA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AsB,CAAC,QAAQ;IAAC,KAAK,EAAEC;EAAM,gBAC5C,oBAAC,IAAI;IACH,QAAQ,EAAGS,CAAC,IAAK;MACf,MAAM;QAAEC;MAAO,CAAC,GAAGD,CAAC,CAACE,WAAW,CAACC,MAAM;MAEvCR,eAAe,CAACM,MAAM,CAAC;IACzB,CAAE;IACF,KAAK,EAAEd,iBAAiB,GAAGU,MAAM,CAACO,QAAQ,GAAG;EAAK,GAEjDnB,MAAM,CACF,CACyB,CACP,GAC3B,IAAI,CACG;AAEjB;AAEA,MAAMY,MAAM,GAAG7B,UAAU,CAACqC,MAAM,CAAC;EAC/BP,SAAS,EAAE;IACTQ,IAAI,EAAE,CAAC;IACPC,aAAa,EAAE;EACjB,CAAC;EACD;EACAR,OAAO,EAAE;IACPO,IAAI,EAAE;EACR,CAAC;EACDF,QAAQ,EAAE;IACRI,QAAQ,EAAE,UAAU;IACpBnB,GAAG,EAAE,CAAC;IACNoB,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
export const getDefaultSidebarWidth = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
height,
|
|
5
|
+
width
|
|
6
|
+
} = _ref;
|
|
7
|
+
/*
|
|
8
|
+
* Default sidebar width is screen width - header height
|
|
9
|
+
* with a max width of 280 on mobile and 320 on tablet
|
|
10
|
+
* https://material.io/components/navigation-drawer
|
|
11
|
+
*/
|
|
12
|
+
const smallerAxisSize = Math.min(height, width);
|
|
13
|
+
const isLandscape = width > height;
|
|
14
|
+
const isTablet = smallerAxisSize >= 600;
|
|
15
|
+
const appBarHeight = Platform.OS === 'ios' ? isLandscape ? 32 : 44 : 56;
|
|
16
|
+
const maxWidth = isTablet ? 320 : 280;
|
|
17
|
+
return Math.min(smallerAxisSize - appBarHeight, maxWidth);
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=getDefaultSidebarWidth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","getDefaultSidebarWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","OS","maxWidth"],"sourceRoot":"../../src","sources":["getDefaultSidebarWidth.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,sBAAsB,GAAG,QAMhC;EAAA,IANiC;IACrCC,MAAM;IACNC;EAIF,CAAC;EACC;AACF;AACA;AACA;AACA;EACE,MAAMC,eAAe,GAAGC,IAAI,CAACC,GAAG,CAACJ,MAAM,EAAEC,KAAK,CAAC;EAC/C,MAAMI,WAAW,GAAGJ,KAAK,GAAGD,MAAM;EAClC,MAAMM,QAAQ,GAAGJ,eAAe,IAAI,GAAG;EACvC,MAAMK,YAAY,GAAGT,QAAQ,CAACU,EAAE,KAAK,KAAK,GAAIH,WAAW,GAAG,EAAE,GAAG,EAAE,GAAI,EAAE;EACzE,MAAMI,QAAQ,GAAGH,QAAQ,GAAG,GAAG,GAAG,GAAG;EAErC,OAAOH,IAAI,CAACC,GAAG,CAACF,eAAe,GAAGK,YAAY,EAAEE,QAAQ,CAAC;AAC3D,CAAC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Background } from './Background';
|
|
2
|
+
export { getDefaultSidebarWidth } from './getDefaultSidebarWidth';
|
|
2
3
|
export { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
|
|
3
4
|
export { getHeaderTitle } from './Header/getHeaderTitle';
|
|
4
5
|
export { Header } from './Header/Header';
|
|
@@ -9,6 +10,8 @@ export { HeaderHeightContext } from './Header/HeaderHeightContext';
|
|
|
9
10
|
export { HeaderShownContext } from './Header/HeaderShownContext';
|
|
10
11
|
export { HeaderTitle } from './Header/HeaderTitle';
|
|
11
12
|
export { useHeaderHeight } from './Header/useHeaderHeight';
|
|
13
|
+
export { getLabel } from './Label/getLabel';
|
|
14
|
+
export { Label } from './Label/Label';
|
|
12
15
|
export { MissingIcon } from './MissingIcon';
|
|
13
16
|
export { PlatformPressable } from './PlatformPressable';
|
|
14
17
|
export { ResourceSavingView } from './ResourceSavingView';
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Background","getDefaultHeaderHeight","getHeaderTitle","Header","HeaderBackButton","HeaderBackContext","HeaderBackground","HeaderHeightContext","HeaderShownContext","HeaderTitle","useHeaderHeight","MissingIcon","PlatformPressable","ResourceSavingView","SafeAreaProviderCompat","Screen","Assets","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,sBAAsB,QAAQ,iCAAiC;AACxE,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,MAAM,QAAQ,UAAU;AAEjC,OAAO,MAAMC,MAAM,GAAG;AACpB;AACAC,OAAO,CAAC,wBAAwB,CAAC;AACjC;AACAA,OAAO,CAAC,6BAA6B,CAAC,CACvC;AAED,cAAc,SAAS"}
|
|
1
|
+
{"version":3,"names":["Background","getDefaultSidebarWidth","getDefaultHeaderHeight","getHeaderTitle","Header","HeaderBackButton","HeaderBackContext","HeaderBackground","HeaderHeightContext","HeaderShownContext","HeaderTitle","useHeaderHeight","getLabel","Label","MissingIcon","PlatformPressable","ResourceSavingView","SafeAreaProviderCompat","Screen","Assets","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,sBAAsB,QAAQ,iCAAiC;AACxE,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,KAAK,QAAQ,eAAe;AACrC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,MAAM,QAAQ,UAAU;AAEjC,OAAO,MAAMC,MAAM,GAAG;AACpB;AACAC,OAAO,CAAC,wBAAwB,CAAC;AACjC;AACAA,OAAO,CAAC,6BAA6B,CAAC,CACvC;AAED,cAAc,SAAS"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ViewProps } from 'react-native';
|
|
3
|
-
type Props = ViewProps & {
|
|
2
|
+
import { Animated, StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
type Props = Omit<ViewProps, 'style'> & {
|
|
4
|
+
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
};
|
|
6
7
|
export declare function Background({ style, ...rest }: Props): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/Background.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/Background.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzE,KAAK,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG;IACtC,KAAK,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eASnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderBackButton.d.ts","sourceRoot":"","sources":["../../../../src/Header/HeaderBackButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HeaderBackButton.d.ts","sourceRoot":"","sources":["../../../../src/Header/HeaderBackButton.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,UAAU,EACV,YAAoC,EACpC,aAAa,EACb,OAAO,EACP,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EAAE,eAAe,EAC1B,WAAW,EACX,cAAuB,EACvB,kBAA6E,EAC7E,MAAM,EACN,KAAK,GACN,EAAE,qBAAqB,eA6IvB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StyleProp, TextProps, TextStyle } from 'react-native';
|
|
2
|
+
type Props = Omit<TextProps, 'style'> & {
|
|
3
|
+
tintColor?: string;
|
|
4
|
+
children?: string;
|
|
5
|
+
style?: StyleProp<TextStyle>;
|
|
6
|
+
};
|
|
7
|
+
export declare function Label({ tintColor, style, ...rest }: Props): JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/Label/Label.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EAGT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,KAAK,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAgB,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAezD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLabel.d.ts","sourceRoot":"","sources":["../../../../src/Label/getLabel.tsx"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CACtB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC3C,QAAQ,EAAE,MAAM,GACf,MAAM,CAMR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NavigationProp, ParamListBase, RouteProp } from '@react-navigation/native';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { Animated, StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
type Props = {
|
|
5
5
|
focused: boolean;
|
|
6
6
|
modal?: boolean;
|
|
@@ -10,7 +10,7 @@ type Props = {
|
|
|
10
10
|
headerShown?: boolean;
|
|
11
11
|
headerStatusBarHeight?: number;
|
|
12
12
|
headerTransparent?: boolean;
|
|
13
|
-
style?: StyleProp<ViewStyle
|
|
13
|
+
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
};
|
|
16
16
|
export declare function Screen(props: Props): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../src/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,aAAa,EACb,SAAS,EACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../src/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,aAAa,EACb,SAAS,EACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAWhF,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC1C,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,eA2DlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDefaultSidebarWidth.d.ts","sourceRoot":"","sources":["../../../src/getDefaultSidebarWidth.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB;YAIzB,MAAM;WACP,MAAM;YAcd,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Background } from './Background';
|
|
2
|
+
export { getDefaultSidebarWidth } from './getDefaultSidebarWidth';
|
|
2
3
|
export { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
|
|
3
4
|
export { getHeaderTitle } from './Header/getHeaderTitle';
|
|
4
5
|
export { Header } from './Header/Header';
|
|
@@ -9,6 +10,8 @@ export { HeaderHeightContext } from './Header/HeaderHeightContext';
|
|
|
9
10
|
export { HeaderShownContext } from './Header/HeaderShownContext';
|
|
10
11
|
export { HeaderTitle } from './Header/HeaderTitle';
|
|
11
12
|
export { useHeaderHeight } from './Header/useHeaderHeight';
|
|
13
|
+
export { getLabel } from './Label/getLabel';
|
|
14
|
+
export { Label } from './Label/Label';
|
|
12
15
|
export { MissingIcon } from './MissingIcon';
|
|
13
16
|
export { PlatformPressable } from './PlatformPressable';
|
|
14
17
|
export { ResourceSavingView } from './ResourceSavingView';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAA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BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,MAAM,OAKlB,CAAC;AAEF,cAAc,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/elements",
|
|
3
3
|
"description": "UI Components for React Navigation",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-alpha.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"react-navigation",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@react-native-masked-view/masked-view": "0.2.9",
|
|
41
|
-
"@react-navigation/native": "^7.0.0-alpha.
|
|
41
|
+
"@react-navigation/native": "^7.0.0-alpha.3",
|
|
42
42
|
"@testing-library/react-native": "^11.5.0",
|
|
43
43
|
"@types/react": "~18.0.27",
|
|
44
44
|
"@types/react-native": "~0.70.8",
|
|
45
45
|
"del-cli": "^5.0.0",
|
|
46
46
|
"react": "18.2.0",
|
|
47
47
|
"react-native": "0.71.8",
|
|
48
|
-
"react-native-builder-bob": "^0.
|
|
48
|
+
"react-native-builder-bob": "^0.21.0",
|
|
49
49
|
"typescript": "^4.9.4"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
]
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "17d212fd04d2c8d000f9fc38ae7ab9e888a0111d"
|
|
72
72
|
}
|
package/src/Background.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useTheme } from '@react-navigation/native';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Animated, StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
4
4
|
|
|
5
|
-
type Props = ViewProps & {
|
|
5
|
+
type Props = Omit<ViewProps, 'style'> & {
|
|
6
|
+
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
6
7
|
children: React.ReactNode;
|
|
7
8
|
};
|
|
8
9
|
|
|
@@ -10,7 +11,7 @@ export function Background({ style, ...rest }: Props) {
|
|
|
10
11
|
const { colors } = useTheme();
|
|
11
12
|
|
|
12
13
|
return (
|
|
13
|
-
<View
|
|
14
|
+
<Animated.View
|
|
14
15
|
{...rest}
|
|
15
16
|
style={[{ flex: 1, backgroundColor: colors.background }, style]}
|
|
16
17
|
/>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { useTheme } from '@react-navigation/native';
|
|
1
|
+
import { useLocale, useTheme } from '@react-navigation/native';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import {
|
|
4
4
|
Animated,
|
|
5
|
-
I18nManager,
|
|
6
5
|
Image,
|
|
7
6
|
LayoutChangeEvent,
|
|
8
7
|
Platform,
|
|
@@ -20,7 +19,7 @@ export function HeaderBackButton({
|
|
|
20
19
|
backImage,
|
|
21
20
|
label,
|
|
22
21
|
labelStyle,
|
|
23
|
-
labelVisible,
|
|
22
|
+
labelVisible = Platform.OS === 'ios',
|
|
24
23
|
onLabelLayout,
|
|
25
24
|
onPress,
|
|
26
25
|
pressColor,
|
|
@@ -34,6 +33,7 @@ export function HeaderBackButton({
|
|
|
34
33
|
style,
|
|
35
34
|
}: HeaderBackButtonProps) {
|
|
36
35
|
const { colors, fonts } = useTheme();
|
|
36
|
+
const { direction } = useLocale();
|
|
37
37
|
|
|
38
38
|
const [initialLabelWidth, setInitialLabelWidth] = React.useState<
|
|
39
39
|
undefined | number
|
|
@@ -50,7 +50,11 @@ export function HeaderBackButton({
|
|
|
50
50
|
const handleLabelLayout = (e: LayoutChangeEvent) => {
|
|
51
51
|
onLabelLayout?.(e);
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
const { layout } = e.nativeEvent;
|
|
54
|
+
|
|
55
|
+
setInitialLabelWidth(
|
|
56
|
+
(direction === 'rtl' ? layout.y : layout.x) + layout.width
|
|
57
|
+
);
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
const shouldTruncateLabel = () => {
|
|
@@ -71,6 +75,7 @@ export function HeaderBackButton({
|
|
|
71
75
|
<Image
|
|
72
76
|
style={[
|
|
73
77
|
styles.icon,
|
|
78
|
+
direction === 'rtl' && styles.flip,
|
|
74
79
|
Boolean(labelVisible) && styles.iconWithLabel,
|
|
75
80
|
Boolean(tintColor) && { tintColor },
|
|
76
81
|
]}
|
|
@@ -131,7 +136,7 @@ export function HeaderBackButton({
|
|
|
131
136
|
<View style={styles.iconMaskContainer}>
|
|
132
137
|
<Image
|
|
133
138
|
source={require('../assets/back-icon-mask.png')}
|
|
134
|
-
style={styles.iconMask}
|
|
139
|
+
style={[styles.iconMask, direction === 'rtl' && styles.flip]}
|
|
135
140
|
/>
|
|
136
141
|
<View style={styles.iconMaskFillerRect} />
|
|
137
142
|
</View>
|
|
@@ -154,7 +159,7 @@ export function HeaderBackButton({
|
|
|
154
159
|
onPress={disabled ? undefined : handlePress}
|
|
155
160
|
pressColor={pressColor}
|
|
156
161
|
pressOpacity={pressOpacity}
|
|
157
|
-
android_ripple={
|
|
162
|
+
android_ripple={androidRipple}
|
|
158
163
|
style={[styles.container, disabled && styles.disabled, style]}
|
|
159
164
|
hitSlop={Platform.select({
|
|
160
165
|
ios: undefined,
|
|
@@ -169,6 +174,12 @@ export function HeaderBackButton({
|
|
|
169
174
|
);
|
|
170
175
|
}
|
|
171
176
|
|
|
177
|
+
const androidRipple = {
|
|
178
|
+
borderless: true,
|
|
179
|
+
foreground: Platform.OS === 'android' && Platform.Version >= 23,
|
|
180
|
+
radius: 20,
|
|
181
|
+
};
|
|
182
|
+
|
|
172
183
|
const styles = StyleSheet.create({
|
|
173
184
|
container: {
|
|
174
185
|
alignItems: 'center',
|
|
@@ -205,14 +216,12 @@ const styles = StyleSheet.create({
|
|
|
205
216
|
marginRight: 22,
|
|
206
217
|
marginVertical: 12,
|
|
207
218
|
resizeMode: 'contain',
|
|
208
|
-
transform: [{ scaleX: I18nManager.getConstants().isRTL ? -1 : 1 }],
|
|
209
219
|
},
|
|
210
220
|
default: {
|
|
211
221
|
height: 24,
|
|
212
222
|
width: 24,
|
|
213
223
|
margin: 3,
|
|
214
224
|
resizeMode: 'contain',
|
|
215
|
-
transform: [{ scaleX: I18nManager.getConstants().isRTL ? -1 : 1 }],
|
|
216
225
|
},
|
|
217
226
|
}),
|
|
218
227
|
iconWithLabel:
|
|
@@ -237,6 +246,8 @@ const styles = StyleSheet.create({
|
|
|
237
246
|
marginVertical: 12,
|
|
238
247
|
alignSelf: 'center',
|
|
239
248
|
resizeMode: 'contain',
|
|
240
|
-
|
|
249
|
+
},
|
|
250
|
+
flip: {
|
|
251
|
+
transform: [{ scaleX: -1 }],
|
|
241
252
|
},
|
|
242
253
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useTheme } from '@react-navigation/native';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
StyleProp,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Text,
|
|
7
|
+
TextProps,
|
|
8
|
+
TextStyle,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
type Props = Omit<TextProps, 'style'> & {
|
|
12
|
+
tintColor?: string;
|
|
13
|
+
children?: string;
|
|
14
|
+
style?: StyleProp<TextStyle>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function Label({ tintColor, style, ...rest }: Props) {
|
|
18
|
+
const { colors, fonts } = useTheme();
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Text
|
|
22
|
+
numberOfLines={1}
|
|
23
|
+
{...rest}
|
|
24
|
+
style={[
|
|
25
|
+
fonts.regular,
|
|
26
|
+
styles.label,
|
|
27
|
+
{ color: tintColor === undefined ? colors.text : tintColor },
|
|
28
|
+
style,
|
|
29
|
+
]}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const styles = StyleSheet.create({
|
|
35
|
+
label: {
|
|
36
|
+
textAlign: 'center',
|
|
37
|
+
backgroundColor: 'transparent',
|
|
38
|
+
},
|
|
39
|
+
});
|
package/src/Screen.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
RouteProp,
|
|
7
7
|
} from '@react-navigation/native';
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
|
9
|
+
import { Animated, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
|
10
10
|
import {
|
|
11
11
|
useSafeAreaFrame,
|
|
12
12
|
useSafeAreaInsets,
|
|
@@ -26,7 +26,7 @@ type Props = {
|
|
|
26
26
|
headerShown?: boolean;
|
|
27
27
|
headerStatusBarHeight?: number;
|
|
28
28
|
headerTransparent?: boolean;
|
|
29
|
-
style?: StyleProp<ViewStyle
|
|
29
|
+
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
30
30
|
children: React.ReactNode;
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const getDefaultSidebarWidth = ({
|
|
4
|
+
height,
|
|
5
|
+
width,
|
|
6
|
+
}: {
|
|
7
|
+
height: number;
|
|
8
|
+
width: number;
|
|
9
|
+
}) => {
|
|
10
|
+
/*
|
|
11
|
+
* Default sidebar width is screen width - header height
|
|
12
|
+
* with a max width of 280 on mobile and 320 on tablet
|
|
13
|
+
* https://material.io/components/navigation-drawer
|
|
14
|
+
*/
|
|
15
|
+
const smallerAxisSize = Math.min(height, width);
|
|
16
|
+
const isLandscape = width > height;
|
|
17
|
+
const isTablet = smallerAxisSize >= 600;
|
|
18
|
+
const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56;
|
|
19
|
+
const maxWidth = isTablet ? 320 : 280;
|
|
20
|
+
|
|
21
|
+
return Math.min(smallerAxisSize - appBarHeight, maxWidth);
|
|
22
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Background } from './Background';
|
|
2
|
+
export { getDefaultSidebarWidth } from './getDefaultSidebarWidth';
|
|
2
3
|
export { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
|
|
3
4
|
export { getHeaderTitle } from './Header/getHeaderTitle';
|
|
4
5
|
export { Header } from './Header/Header';
|
|
@@ -9,6 +10,8 @@ export { HeaderHeightContext } from './Header/HeaderHeightContext';
|
|
|
9
10
|
export { HeaderShownContext } from './Header/HeaderShownContext';
|
|
10
11
|
export { HeaderTitle } from './Header/HeaderTitle';
|
|
11
12
|
export { useHeaderHeight } from './Header/useHeaderHeight';
|
|
13
|
+
export { getLabel } from './Label/getLabel';
|
|
14
|
+
export { Label } from './Label/Label';
|
|
12
15
|
export { MissingIcon } from './MissingIcon';
|
|
13
16
|
export { PlatformPressable } from './PlatformPressable';
|
|
14
17
|
export { ResourceSavingView } from './ResourceSavingView';
|