BottomModal.js 1.1 KB

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