Skip to content

Commit

Permalink
Merge pull request #104 from amn-max/master
Browse files Browse the repository at this point in the history
Fix issue on some devices drawer height was not 100%
  • Loading branch information
pedreviljoen authored Nov 8, 2022
2 parents a839463 + 7aa6147 commit 1bebfdd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -162,7 +163,8 @@ MenuDrawer.defaultProps = {
animationTime: 200,
overlay: true,
opacity: 0.4,
position: "left"
position: "left",
fullSize: false
}

MenuDrawer.propTypes = {
Expand All @@ -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({
Expand Down

0 comments on commit 1bebfdd

Please sign in to comment.