fix: initialize height and width to zero if undefined

closes #6789
This commit is contained in:
Satyajit Sahoo
2020-03-19 19:03:23 +01:00
parent 5c4afc5cb4
commit 3df65e2819
3 changed files with 30 additions and 20 deletions

View File

@@ -89,9 +89,11 @@ export default function DrawerView({
sceneContainerStyle,
}: Props) {
const [loaded, setLoaded] = React.useState([state.index]);
const [drawerWidth, setDrawerWidth] = React.useState(() =>
getDefaultDrawerWidth(Dimensions.get('window'))
);
const [drawerWidth, setDrawerWidth] = React.useState(() => {
const { height = 0, width = 0 } = Dimensions.get('window');
return getDefaultDrawerWidth({ height, width });
});
const drawerGestureRef = React.useRef<PanGestureHandler>(null);