From 7aa614774d7318dfa274cadb9c218982b1f8bfeb Mon Sep 17 00:00:00 2001 From: Ayush Naik <41959740+amn-max@users.noreply.github.com> Date: Fri, 4 Nov 2022 13:16:59 +0530 Subject: [PATCH] Fix issue on some devices drawer height was not 100% --- index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 903f3e7..b4b44d7 100644 --- a/index.js +++ b/index.js @@ -6,15 +6,16 @@ import { View, Text, Platform, - TouchableOpacity + TouchableOpacity, + Dimensions, } from "react-native" import PropTypes from "prop-types" const MenuDrawer = props => { const fadeAnim = useRef(new Animated.Value(0)).current const window = useWindowDimensions() - const screenHeight = window.height - const screenWidth = window.width + const screenHeight = props.fullSize ? Dimensions.get('screen').height : window.height; + const screenWidth = props.fullSize? Dimensions.get('screen').width: window.width; const initialDrawerWidth = screenWidth * (props.drawerPercentage / 100) const drawerWidthRef = useRef(initialDrawerWidth) @@ -162,7 +163,8 @@ MenuDrawer.defaultProps = { animationTime: 200, overlay: true, opacity: 0.4, - position: "left" + position: "left", + fullSize: false } MenuDrawer.propTypes = { @@ -171,7 +173,8 @@ MenuDrawer.propTypes = { animationTime: PropTypes.number, overlay: PropTypes.bool, opacity: PropTypes.number, - position: PropTypes.oneOf(["left", "right"]) + position: PropTypes.oneOf(["left", "right"]), + fullSize: PropTypes.bool, } const styles = StyleSheet.create({