Закрытие модально программно (реагировать-материализоваться) - PullRequest
0 голосов
/ 06 марта 2020

Я не могу понять, как программно закрыть модальное окно (например, модальное имя входа после того, как пользователь вошел в систему).

Это выглядит примерно так:

<Modal
  actions={[
    <Button flat modal="close" node="button" waves="green">
      Close
    </Button>
  ]}
  bottomSheet={false}
  fixedFooter={false}
  header="Log in"
  id="modal-login"
  options={{
    dismissible: true,
    endingTop: "10%",
    inDuration: 250,
    onCloseEnd: null,
    onCloseStart: null,
    onOpenEnd: null,
    onOpenStart: null,
    opacity: 0.5,
    outDuration: 250,
    preventScrolling: true,
    startingTop: "4%"
  }}
>
  <form onSubmit={e => /* log in user */}>
    <input type="email"/>
    <input type="password"/>
    <button>Log in</button>
  </form>
</Modal>

1 Ответ

1 голос
/ 06 марта 2020

Используйте открытую опору, чтобы программно открыть или закрыть модальное

<Modal
  open={isModalOpen}
  ...
/>

Ref: https://react-materialize.github.io/react-materialize/?path= / story / javascript -modal - по умолчанию

...