diff --git a/README.md b/README.md index 306e58c..f31b638 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,11 @@ #### Step 1 Install [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons#installation) if you do not already have it. +Install [react-native-extra-dimensions-android](https://github.com/Sunhat/react-native-extra-dimensions-android#installation) if you do not already have it. ``` npm install react-native-vector-icons --save && react-native link react-native-vector-icons +npm install react-native-extra-dimensions-android --save && react-native link react-native-extra-dimensions-android ``` #### Step 2 diff --git a/package.json b/package.json index 771d0ca..c5e6eee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-bottom-drawer", - "version": "1.0.2", + "version": "1.0.3", "main": "index.js", "scripts": { "test": "jest" @@ -21,7 +21,8 @@ "drawer" ], "peerDependencies": { - "react-native-vector-icons": "^4.0.0" + "react-native-vector-icons": "^4.0.0", + "react-native-extra-dimensions-android": "^0.21.0" }, "devDependencies": { "babel-jest": "^19.0.0", diff --git a/src/Drawer.js b/src/Drawer.js index 20f5e04..73ca928 100644 --- a/src/Drawer.js +++ b/src/Drawer.js @@ -12,9 +12,11 @@ import { View } from 'react-native'; import Icon from 'react-native-vector-icons/Ionicons'; +import ExtraDimensions from 'react-native-extra-dimensions-android'; // Get screen dimensions -const { width, height } = Dimensions.get('window'); +const { width } = Dimensions.get('window'); +const height = Platform.OS === 'ios' ? Dimensions.get('screen').height : Dimensions.get('screen').height - ExtraDimensions.get('SOFT_MENU_BAR_HEIGHT'); export default class Drawer extends Component { @@ -30,6 +32,7 @@ export default class Drawer extends Component { headerHeight: PropTypes.number, // Height of the visible teaser area at the bottom of the screen teaserHeight: PropTypes.number, + onClose: PropTypes.func, }; // Set default prop values @@ -38,6 +41,7 @@ export default class Drawer extends Component { header: 'Messages', headerHeight: 70, teaserHeight: 75, + onClose:()=>{} }; // Define state @@ -306,6 +310,7 @@ export default class Drawer extends Component { // Minimize window and keep a teaser at the bottom close = () => { + this.props.onClose(); this._scrollView.scrollTo({ y: 0 }); Animated.timing(this._animatedPosition, { toValue: this.config.position.start, @@ -357,6 +362,7 @@ const styles = StyleSheet.create({ alignItems: 'center', // center children justifyContent: 'flex-end', // align popup at the bottom backgroundColor: 'transparent', // transparent background + elevation: 1, // fix android dynamic zindex issue }, // Semi-transparent background below popup backdrop: {