mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-20 10:12:01 +01:00
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { StyleSheet, useWindowDimensions } from 'react-native';
|
|
import Modal from 'react-native-modal';
|
|
|
|
const styles = StyleSheet.create({
|
|
root: {
|
|
justifyContent: 'flex-end',
|
|
margin: 0,
|
|
},
|
|
});
|
|
|
|
const BottomModal = ({ onBackButtonPress, onBackdropPress, onClose, windowHeight, windowWidth, ...props }) => {
|
|
const valueWindowHeight = useWindowDimensions().height;
|
|
const valueWindowWidth = useWindowDimensions().width;
|
|
const handleBackButtonPress = onBackButtonPress ?? onClose;
|
|
const handleBackdropPress = onBackdropPress ?? onClose;
|
|
|
|
return (
|
|
<Modal
|
|
style={styles.root}
|
|
deviceHeight={windowHeight ?? valueWindowHeight}
|
|
deviceWidth={windowWidth ?? valueWindowWidth}
|
|
onBackButtonPress={handleBackButtonPress}
|
|
onBackdropPress={handleBackdropPress}
|
|
{...props}
|
|
accessibilityViewIsModal
|
|
useNativeDriver
|
|
useNativeDriverForBackdrop
|
|
/>
|
|
);
|
|
};
|
|
|
|
BottomModal.propTypes = {
|
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element]),
|
|
onBackButtonPress: PropTypes.func,
|
|
onBackdropPress: PropTypes.func,
|
|
onClose: PropTypes.func,
|
|
windowHeight: PropTypes.number,
|
|
windowWidth: PropTypes.number,
|
|
};
|
|
|
|
export default BottomModal;
|