BottomModal.js 909 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import { StyleSheet, View } from 'react-native';
  3. import Modal from 'react-native-modal';
  4. export const ModalProps = {
  5. avoidKeyboard: true,
  6. animationIn: "fadeIn",
  7. animationOut: "fadeOut",
  8. propagateSwipe: true,
  9. useNativeDriver: true,
  10. hideModalContentWhileAnimating: true
  11. }
  12. export default BottomModal = ({visible=false, onHide, children}) => {
  13. return (
  14. <Modal
  15. isVisible={visible}
  16. onBackButtonPress={onHide}
  17. onBackdropPress={onHide}
  18. useNativeDriver={true}
  19. style={styles.bottomModalView}>
  20. <View style={styles.bottomModalContent}>
  21. {children}
  22. </View>
  23. </Modal>
  24. );
  25. }
  26. const styles = StyleSheet.create({
  27. bottomModalView: {
  28. margin: 0,
  29. justifyContent: 'flex-end'
  30. },
  31. bottomModalContent: {
  32. maxHeight: $vht(isIOS ? 92 : 96),
  33. backgroundColor: pageBackground,
  34. ...$borderRadius(20, 20, 0, 0)
  35. },
  36. })