@react-navigation/drawer 8.0.0-alpha.1 → 8.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/views/DrawerToggleButton.js +37 -7
- package/lib/module/views/DrawerToggleButton.js.map +1 -1
- package/lib/typescript/src/views/DrawerToggleButton.d.ts +7 -3
- package/lib/typescript/src/views/DrawerToggleButton.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/views/DrawerToggleButton.tsx +60 -18
- package/lib/module/views/assets/toggle-drawer-icon@1x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@1x.ios.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@2x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@2x.ios.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@3x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@3x.ios.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@4x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@4x.ios.png +0 -0
- package/src/views/assets/toggle-drawer-icon@1x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@1x.ios.png +0 -0
- package/src/views/assets/toggle-drawer-icon@2x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@2x.ios.png +0 -0
- package/src/views/assets/toggle-drawer-icon@3x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@3x.ios.png +0 -0
- package/src/views/assets/toggle-drawer-icon@4x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@4x.ios.png +0 -0
|
@@ -1,34 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { HeaderButton } from '@react-navigation/elements';
|
|
4
|
-
import { DrawerActions, useNavigation } from '@react-navigation/native';
|
|
5
|
-
import
|
|
4
|
+
import { DrawerActions, MaterialSymbol, SFSymbol, useNavigation } from '@react-navigation/native';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Image, Platform, StyleSheet } from 'react-native';
|
|
6
7
|
import toggleDrawerIcon from './assets/toggle-drawer-icon.png';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
export function DrawerToggleButton({
|
|
10
|
+
icon,
|
|
9
11
|
tintColor,
|
|
10
12
|
accessibilityLabel = 'Show navigation menu',
|
|
11
|
-
imageSource = toggleDrawerIcon,
|
|
12
13
|
...rest
|
|
13
14
|
}) {
|
|
14
15
|
const navigation = useNavigation();
|
|
16
|
+
const drawerIcon = icon ?? Platform.select({
|
|
17
|
+
ios: {
|
|
18
|
+
type: 'sfSymbol',
|
|
19
|
+
name: 'line.3.horizontal'
|
|
20
|
+
},
|
|
21
|
+
android: {
|
|
22
|
+
type: 'materialSymbol',
|
|
23
|
+
name: 'menu'
|
|
24
|
+
},
|
|
25
|
+
default: {
|
|
26
|
+
type: 'image',
|
|
27
|
+
source: toggleDrawerIcon
|
|
28
|
+
}
|
|
29
|
+
});
|
|
15
30
|
return /*#__PURE__*/_jsx(HeaderButton, {
|
|
16
31
|
...rest,
|
|
17
32
|
accessibilityLabel: accessibilityLabel,
|
|
18
33
|
onPress: () => navigation.dispatch(DrawerActions.toggleDrawer()),
|
|
19
|
-
children:
|
|
34
|
+
children: typeof drawerIcon === 'function' ? drawerIcon({
|
|
35
|
+
tintColor
|
|
36
|
+
}) : drawerIcon.type === 'sfSymbol' ? /*#__PURE__*/_jsx(SFSymbol, {
|
|
37
|
+
name: drawerIcon.name,
|
|
38
|
+
size: ICON_SIZE,
|
|
39
|
+
color: tintColor,
|
|
40
|
+
style: styles.icon
|
|
41
|
+
}) : drawerIcon.type === 'materialSymbol' ? /*#__PURE__*/_jsx(MaterialSymbol, {
|
|
42
|
+
name: drawerIcon.name,
|
|
43
|
+
variant: drawerIcon.variant,
|
|
44
|
+
weight: drawerIcon.weight,
|
|
45
|
+
size: ICON_SIZE,
|
|
46
|
+
color: tintColor,
|
|
47
|
+
style: styles.icon
|
|
48
|
+
}) : /*#__PURE__*/_jsx(Image, {
|
|
20
49
|
resizeMode: "contain",
|
|
21
|
-
source:
|
|
50
|
+
source: drawerIcon.source,
|
|
22
51
|
fadeDuration: 0,
|
|
23
52
|
tintColor: tintColor,
|
|
24
53
|
style: styles.icon
|
|
25
54
|
})
|
|
26
55
|
});
|
|
27
56
|
}
|
|
57
|
+
const ICON_SIZE = 24;
|
|
28
58
|
const styles = StyleSheet.create({
|
|
29
59
|
icon: {
|
|
30
|
-
height:
|
|
31
|
-
width:
|
|
60
|
+
height: ICON_SIZE,
|
|
61
|
+
width: ICON_SIZE,
|
|
32
62
|
marginVertical: 8,
|
|
33
63
|
marginHorizontal: 5
|
|
34
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HeaderButton","DrawerActions","useNavigation","Image","StyleSheet","toggleDrawerIcon","jsx","_jsx","DrawerToggleButton","
|
|
1
|
+
{"version":3,"names":["HeaderButton","DrawerActions","MaterialSymbol","SFSymbol","useNavigation","React","Image","Platform","StyleSheet","toggleDrawerIcon","jsx","_jsx","DrawerToggleButton","icon","tintColor","accessibilityLabel","rest","navigation","drawerIcon","select","ios","type","name","android","default","source","onPress","dispatch","toggleDrawer","children","size","ICON_SIZE","color","style","styles","variant","weight","resizeMode","fadeDuration","create","height","width","marginVertical","marginHorizontal"],"sourceRoot":"../../../src","sources":["views/DrawerToggleButton.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAyB,4BAA4B;AAC1E,SACEC,aAAa,EACbC,cAAc,EACdC,QAAQ,EACRC,aAAa,QACR,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAA0BC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAE3E,OAAOC,gBAAgB,MAAM,iCAAiC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAY/D,OAAO,SAASC,kBAAkBA,CAAC;EACjCC,IAAI;EACJC,SAAS;EACTC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Z,MAAM,EAAEP,UAAU,CAACO,MAAO;MAC1Ba,YAAY,EAAE,CAAE;MAChBxB,SAAS,EAAEA,SAAU;MACrBmB,KAAK,EAAEC,MAAM,CAACrB;IAAK,CACpB;EACF,CACW,CAAC;AAEnB;AAEA,MAAMkB,SAAS,GAAG,EAAE;AAEpB,MAAMG,MAAM,GAAG1B,UAAU,CAAC+B,MAAM,CAAC;EAC/B1B,IAAI,EAAE;IACJ2B,MAAM,EAAET,SAAS;IACjBU,KAAK,EAAEV,SAAS;IAChBW,cAAc,EAAE,CAAC;IACjBC,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type HeaderIcon } from '@react-navigation/elements';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { type ColorValue } from 'react-native';
|
|
2
4
|
type Props = {
|
|
5
|
+
icon?: HeaderIcon | ((props: {
|
|
6
|
+
tintColor: ColorValue | undefined;
|
|
7
|
+
}) => React.ReactNode);
|
|
3
8
|
accessibilityLabel?: string;
|
|
4
9
|
pressColor?: ColorValue;
|
|
5
10
|
pressOpacity?: number;
|
|
6
11
|
tintColor?: ColorValue;
|
|
7
|
-
imageSource?: ImageSourcePropType;
|
|
8
12
|
};
|
|
9
|
-
export declare function DrawerToggleButton({ tintColor, accessibilityLabel,
|
|
13
|
+
export declare function DrawerToggleButton({ icon, tintColor, accessibilityLabel, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
14
|
export {};
|
|
11
15
|
//# sourceMappingURL=DrawerToggleButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerToggleButton.d.ts","sourceRoot":"","sources":["../../../../src/views/DrawerToggleButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DrawerToggleButton.d.ts","sourceRoot":"","sources":["../../../../src/views/DrawerToggleButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAO3E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,UAAU,EAA+B,MAAM,cAAc,CAAC;AAI5E,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EACD,UAAU,GACV,CAAC,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,UAAU,GAAG,SAAS,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IACxE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,SAAS,EACT,kBAA2C,EAC3C,GAAG,IAAI,EACR,EAAE,KAAK,2CAuDP"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/drawer",
|
|
3
3
|
"description": "Integration for the drawer component from react-native-drawer-layout",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.10",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"clean": "del lib"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@react-navigation/elements": "^3.0.0-alpha.
|
|
49
|
+
"@react-navigation/elements": "^3.0.0-alpha.10",
|
|
50
50
|
"color": "^4.2.3",
|
|
51
51
|
"react-native-drawer-layout": "^5.0.0-alpha.0",
|
|
52
52
|
"use-latest-callback": "^0.3.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@jest/globals": "^30.0.0",
|
|
56
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
56
|
+
"@react-navigation/native": "^8.0.0-alpha.10",
|
|
57
57
|
"@testing-library/react-native": "^13.2.1",
|
|
58
58
|
"@types/react": "~19.1.10",
|
|
59
59
|
"del-cli": "^6.0.0",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"react-native-gesture-handler": "~2.28.0",
|
|
64
64
|
"react-native-reanimated": "4.1.3",
|
|
65
65
|
"react-native-safe-area-context": "~5.6.0",
|
|
66
|
-
"react-native-screens": "^4.
|
|
66
|
+
"react-native-screens": "^4.21.0",
|
|
67
67
|
"react-native-worklets": "0.6.1",
|
|
68
68
|
"react-test-renderer": "19.1.0",
|
|
69
69
|
"typescript": "^5.9.2"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
72
|
+
"@react-navigation/native": "^8.0.0-alpha.10",
|
|
73
73
|
"react": ">= 19.0.0",
|
|
74
74
|
"react-native": "*",
|
|
75
75
|
"react-native-gesture-handler": ">= 2.0.0",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
]
|
|
96
96
|
]
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "4bf35245d085655607d8c658407a4a0c8e641f8d"
|
|
99
99
|
}
|
|
@@ -1,51 +1,93 @@
|
|
|
1
|
-
import { HeaderButton } from '@react-navigation/elements';
|
|
2
|
-
import { DrawerActions, useNavigation } from '@react-navigation/native';
|
|
1
|
+
import { HeaderButton, type HeaderIcon } from '@react-navigation/elements';
|
|
3
2
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from 'react-native';
|
|
3
|
+
DrawerActions,
|
|
4
|
+
MaterialSymbol,
|
|
5
|
+
SFSymbol,
|
|
6
|
+
useNavigation,
|
|
7
|
+
} from '@react-navigation/native';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { type ColorValue, Image, Platform, StyleSheet } from 'react-native';
|
|
9
10
|
|
|
10
11
|
import toggleDrawerIcon from './assets/toggle-drawer-icon.png';
|
|
11
12
|
|
|
12
13
|
type Props = {
|
|
14
|
+
icon?:
|
|
15
|
+
| HeaderIcon
|
|
16
|
+
| ((props: { tintColor: ColorValue | undefined }) => React.ReactNode);
|
|
13
17
|
accessibilityLabel?: string;
|
|
14
18
|
pressColor?: ColorValue;
|
|
15
19
|
pressOpacity?: number;
|
|
16
20
|
tintColor?: ColorValue;
|
|
17
|
-
imageSource?: ImageSourcePropType;
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
export function DrawerToggleButton({
|
|
24
|
+
icon,
|
|
21
25
|
tintColor,
|
|
22
26
|
accessibilityLabel = 'Show navigation menu',
|
|
23
|
-
imageSource = toggleDrawerIcon,
|
|
24
27
|
...rest
|
|
25
28
|
}: Props) {
|
|
26
29
|
const navigation = useNavigation();
|
|
27
30
|
|
|
31
|
+
const drawerIcon =
|
|
32
|
+
icon ??
|
|
33
|
+
Platform.select<HeaderIcon>({
|
|
34
|
+
ios: {
|
|
35
|
+
type: 'sfSymbol',
|
|
36
|
+
name: 'line.3.horizontal',
|
|
37
|
+
},
|
|
38
|
+
android: {
|
|
39
|
+
type: 'materialSymbol',
|
|
40
|
+
name: 'menu',
|
|
41
|
+
},
|
|
42
|
+
default: {
|
|
43
|
+
type: 'image',
|
|
44
|
+
source: toggleDrawerIcon,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
28
48
|
return (
|
|
29
49
|
<HeaderButton
|
|
30
50
|
{...rest}
|
|
31
51
|
accessibilityLabel={accessibilityLabel}
|
|
32
52
|
onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}
|
|
33
53
|
>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
{typeof drawerIcon === 'function' ? (
|
|
55
|
+
drawerIcon({ tintColor })
|
|
56
|
+
) : drawerIcon.type === 'sfSymbol' ? (
|
|
57
|
+
<SFSymbol
|
|
58
|
+
name={drawerIcon.name}
|
|
59
|
+
size={ICON_SIZE}
|
|
60
|
+
color={tintColor}
|
|
61
|
+
style={styles.icon}
|
|
62
|
+
/>
|
|
63
|
+
) : drawerIcon.type === 'materialSymbol' ? (
|
|
64
|
+
<MaterialSymbol
|
|
65
|
+
name={drawerIcon.name}
|
|
66
|
+
variant={drawerIcon.variant}
|
|
67
|
+
weight={drawerIcon.weight}
|
|
68
|
+
size={ICON_SIZE}
|
|
69
|
+
color={tintColor}
|
|
70
|
+
style={styles.icon}
|
|
71
|
+
/>
|
|
72
|
+
) : (
|
|
73
|
+
<Image
|
|
74
|
+
resizeMode="contain"
|
|
75
|
+
source={drawerIcon.source}
|
|
76
|
+
fadeDuration={0}
|
|
77
|
+
tintColor={tintColor}
|
|
78
|
+
style={styles.icon}
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
41
81
|
</HeaderButton>
|
|
42
82
|
);
|
|
43
83
|
}
|
|
44
84
|
|
|
85
|
+
const ICON_SIZE = 24;
|
|
86
|
+
|
|
45
87
|
const styles = StyleSheet.create({
|
|
46
88
|
icon: {
|
|
47
|
-
height:
|
|
48
|
-
width:
|
|
89
|
+
height: ICON_SIZE,
|
|
90
|
+
width: ICON_SIZE,
|
|
49
91
|
marginVertical: 8,
|
|
50
92
|
marginHorizontal: 5,
|
|
51
93
|
},
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|