Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue on some devices drawer height was not 100% #104

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

const screenWidth = props.fullSize? Dimensions.get('screen').width: window.width;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).


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