Modal

Wrapper around <Modal /> of react-native-modal. It accepts all the props react-native-modal offers.



Copy
import { Button, Modal, Icon } from 'react-native-magnus'

const modalRef = React.createRef();

<Button
  onPress={() => {
    if (modalRef.current) {
      modalRef.current.open();
    }
  }}
>
  Open Modal
</Button>

<Modal ref={modalRef}>
  <Button
    bg="gray400"
    h={35}
    w={35}
    position="absolute"
    top={50}
    right={15}
    rounded="circle"
    onPress={() => {
      if (modalRef.current) {
        modalRef.current.close();
      }
    }}
  >
    <Icon color="black900" name="close" />
  </Button>
</Modal>

Props

Property Description Type Default
h height of modal number 100%
bg background of modal string white

Apart from these props, The <Modal /> also accepts all props available in react-native-modal.