@react-navigation/elements 2.0.0-alpha.12 → 2.0.0-alpha.14
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/getDefaultSidebarWidth.js +10 -12
- package/lib/commonjs/getDefaultSidebarWidth.js.map +1 -1
- package/lib/module/getDefaultSidebarWidth.js +10 -12
- package/lib/module/getDefaultSidebarWidth.js.map +1 -1
- package/lib/typescript/src/getDefaultSidebarWidth.d.ts +1 -2
- package/lib/typescript/src/getDefaultSidebarWidth.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/getDefaultSidebarWidth.tsx +11 -18
|
@@ -4,23 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getDefaultSidebarWidth = void 0;
|
|
7
|
-
|
|
7
|
+
const APPROX_APP_BAR_HEIGHT = 56;
|
|
8
|
+
const DEFAULT_DRAWER_WIDTH = 360;
|
|
8
9
|
const getDefaultSidebarWidth = _ref => {
|
|
9
10
|
let {
|
|
10
|
-
height,
|
|
11
11
|
width
|
|
12
12
|
} = _ref;
|
|
13
|
-
|
|
14
|
-
* Default sidebar width is
|
|
15
|
-
*
|
|
16
|
-
* https://material.io/components/navigation-drawer
|
|
13
|
+
/**
|
|
14
|
+
* Default sidebar width is 360dp
|
|
15
|
+
* On screens smaller than 320dp, ideally the drawer would collapse to a tab bar
|
|
16
|
+
* https://m3.material.io/components/navigation-drawer/specs
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const maxWidth = isTablet ? 320 : 280;
|
|
23
|
-
return Math.min(smallerAxisSize - appBarHeight, maxWidth);
|
|
18
|
+
if (width - APPROX_APP_BAR_HEIGHT <= 360) {
|
|
19
|
+
return width - APPROX_APP_BAR_HEIGHT;
|
|
20
|
+
}
|
|
21
|
+
return DEFAULT_DRAWER_WIDTH;
|
|
24
22
|
};
|
|
25
23
|
exports.getDefaultSidebarWidth = getDefaultSidebarWidth;
|
|
26
24
|
//# sourceMappingURL=getDefaultSidebarWidth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["APPROX_APP_BAR_HEIGHT","DEFAULT_DRAWER_WIDTH","getDefaultSidebarWidth","_ref","width","exports"],"sourceRoot":"../../src","sources":["getDefaultSidebarWidth.tsx"],"mappings":";;;;;;AAAA,MAAMA,qBAAqB,GAAG,EAAE;AAChC,MAAMC,oBAAoB,GAAG,GAAG;AAEzB,MAAMC,sBAAsB,GAAGC,IAAA,IAAkC;EAAA,IAAjC;IAAEC;EAAyB,CAAC,GAAAD,IAAA;EACjE;AACF;AACA;AACA;AACA;EACE,IAAIC,KAAK,GAAGJ,qBAAqB,IAAI,GAAG,EAAE;IACxC,OAAOI,KAAK,GAAGJ,qBAAqB;EACtC;EAEA,OAAOC,oBAAoB;AAC7B,CAAC;AAACI,OAAA,CAAAH,sBAAA,GAAAA,sBAAA"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
const APPROX_APP_BAR_HEIGHT = 56;
|
|
2
|
+
const DEFAULT_DRAWER_WIDTH = 360;
|
|
2
3
|
export const getDefaultSidebarWidth = _ref => {
|
|
3
4
|
let {
|
|
4
|
-
height,
|
|
5
5
|
width
|
|
6
6
|
} = _ref;
|
|
7
|
-
|
|
8
|
-
* Default sidebar width is
|
|
9
|
-
*
|
|
10
|
-
* https://material.io/components/navigation-drawer
|
|
7
|
+
/**
|
|
8
|
+
* Default sidebar width is 360dp
|
|
9
|
+
* On screens smaller than 320dp, ideally the drawer would collapse to a tab bar
|
|
10
|
+
* https://m3.material.io/components/navigation-drawer/specs
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const maxWidth = isTablet ? 320 : 280;
|
|
17
|
-
return Math.min(smallerAxisSize - appBarHeight, maxWidth);
|
|
12
|
+
if (width - APPROX_APP_BAR_HEIGHT <= 360) {
|
|
13
|
+
return width - APPROX_APP_BAR_HEIGHT;
|
|
14
|
+
}
|
|
15
|
+
return DEFAULT_DRAWER_WIDTH;
|
|
18
16
|
};
|
|
19
17
|
//# sourceMappingURL=getDefaultSidebarWidth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["APPROX_APP_BAR_HEIGHT","DEFAULT_DRAWER_WIDTH","getDefaultSidebarWidth","_ref","width"],"sourceRoot":"../../src","sources":["getDefaultSidebarWidth.tsx"],"mappings":"AAAA,MAAMA,qBAAqB,GAAG,EAAE;AAChC,MAAMC,oBAAoB,GAAG,GAAG;AAEhC,OAAO,MAAMC,sBAAsB,GAAGC,IAAA,IAAkC;EAAA,IAAjC;IAAEC;EAAyB,CAAC,GAAAD,IAAA;EACjE;AACF;AACA;AACA;AACA;EACE,IAAIC,KAAK,GAAGJ,qBAAqB,IAAI,GAAG,EAAE;IACxC,OAAOI,KAAK,GAAGJ,qBAAqB;EACtC;EAEA,OAAOC,oBAAoB;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultSidebarWidth.d.ts","sourceRoot":"","sources":["../../../src/getDefaultSidebarWidth.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDefaultSidebarWidth.d.ts","sourceRoot":"","sources":["../../../src/getDefaultSidebarWidth.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB;WAAwB,MAAM;YAWhE,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": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.14",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"react-navigation",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@react-native-masked-view/masked-view": "0.3.0",
|
|
44
|
-
"@react-navigation/native": "^7.0.0-alpha.
|
|
44
|
+
"@react-navigation/native": "^7.0.0-alpha.16",
|
|
45
45
|
"@testing-library/react-native": "^12.4.3",
|
|
46
46
|
"@types/react": "~18.2.45",
|
|
47
47
|
"del-cli": "^5.1.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"typescript": "^5.3.3"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@react-navigation/native": "^7.0.0-alpha.
|
|
54
|
+
"@react-navigation/native": "^7.0.0-alpha.16",
|
|
55
55
|
"react": ">= 18.2.0",
|
|
56
56
|
"react-native": ">= 0.72.0",
|
|
57
57
|
"react-native-safe-area-context": ">= 4.0.0"
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
]
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "a601b72a5ae354900ab21f0e0293cb2c573ba8d0"
|
|
74
74
|
}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
const APPROX_APP_BAR_HEIGHT = 56;
|
|
2
|
+
const DEFAULT_DRAWER_WIDTH = 360;
|
|
2
3
|
|
|
3
|
-
export const getDefaultSidebarWidth = ({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
4
|
+
export const getDefaultSidebarWidth = ({ width }: { width: number }) => {
|
|
5
|
+
/**
|
|
6
|
+
* Default sidebar width is 360dp
|
|
7
|
+
* On screens smaller than 320dp, ideally the drawer would collapse to a tab bar
|
|
8
|
+
* https://m3.material.io/components/navigation-drawer/specs
|
|
14
9
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56;
|
|
19
|
-
const maxWidth = isTablet ? 320 : 280;
|
|
10
|
+
if (width - APPROX_APP_BAR_HEIGHT <= 360) {
|
|
11
|
+
return width - APPROX_APP_BAR_HEIGHT;
|
|
12
|
+
}
|
|
20
13
|
|
|
21
|
-
return
|
|
14
|
+
return DEFAULT_DRAWER_WIDTH;
|
|
22
15
|
};
|