Skip to content

Commit 7e5ecb3

Browse files
committed
fix: add px to drawer width on web. fixes react-navigation#12674
1 parent f2ca954 commit 7e5ecb3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/react-native-drawer-layout/src/utils/getDrawerWidth.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ export function getDrawerWidthWeb({
4040
drawerStyle,
4141
}: {
4242
drawerStyle?: StyleProp<ViewStyle>;
43-
}) {
43+
}): string {
4444
const { width } = StyleSheet.flatten(drawerStyle) || {};
4545

46-
return typeof width === 'string' || typeof width === 'number'
47-
? width
48-
: DRAWER_DEFAULT_WIDTH_WEB;
46+
if (typeof width === 'number') {
47+
return `${width}px`;
48+
}
49+
50+
if (typeof width === 'string') {
51+
return width;
52+
}
53+
54+
return DRAWER_DEFAULT_WIDTH_WEB;
4955
}

0 commit comments

Comments
 (0)