BottomModal.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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: !isIOS,
  10. hideModalContentWhileAnimating: true
  11. }
  12. export default BottomModal = ({
  13. visible=false,
  14. onHide,
  15. children,
  16. backdropOpacity=0.7,
  17. style=styles.bottomModalView,
  18. contentStyle=styles.bottomModalContent}) => {
  19. return (
  20. <Modal
  21. isVisible={visible}
  22. onBackButtonPress={onHide}
  23. onBackdropPress={onHide}
  24. useNativeDriver={!isIOS}
  25. backdropOpacity={backdropOpacity}
  26. style={style}>
  27. <View style={contentStyle}>
  28. {children}
  29. </View>
  30. </Modal>
  31. );
  32. }
  33. const styles = StyleSheet.create({
  34. bottomModalView: {
  35. margin: 0,
  36. justifyContent: 'flex-end'
  37. },
  38. bottomModalContent: {
  39. maxHeight: $vht(isIOS ? 92 : 96),
  40. backgroundColor: pageBackground,
  41. ...$borderRadius(20, 20, 0, 0)
  42. },
  43. })