eBay / nice-modal-react

A modal state manager for React.
https://ebay.github.io/nice-modal-react
MIT License
1.96k stars 109 forks source link

disable hide on outside click #161

Open XxQuickSilverZz opened 2 weeks ago

XxQuickSilverZz commented 2 weeks ago

Which property can I use to prevent the modal from hiding when I click outside of it? I don't want it to hide when clicking outside, only through code.

supnate commented 1 week ago

It's handled by the UI library you use not Nice Modal. For example, set maskClosable=false in antd's modal. See API introduction here: https://ant.design/components/modal#api .

XxQuickSilverZz commented 1 week ago

It's handled by the UI library you use not Nice Modal. For example, set maskClosable=false in antd's modal. See API introduction here: https://ant.design/components/modal#api .

i use this

`const modal = useModal();

let schema = yup.object({
  order_id: yup.string(),
  purposeTransfer: yup.string().required(),
  paymentDate: yup.date().required(),
});

const [amount, setAmount] = useState<string | undefined>(undefined);

let {
  data,
  error,
  loading: loadingNotPayedOrders,
} = useGetNotPayedOrdersQuery();

return (
  <Formik
    initialValues={{ paymentDate: new Date() } as AddOrderPaymentInput}
    validationSchema={schema}
    validateOnMount
    onSubmit={(erfuellungsort) => {
      console.log("NEW FORM -> ", erfuellungsort);
    }}
  >
    {({ isValid, values, errors, setFieldValue, touched }) => (
      <Modal
        TransitionComponent={Transition}
        fullWidth
        open={modal.visible}
        onClose={() => {
          modal.resolve({ resolved: false });
          modal.hide();
        }}
        TransitionProps={{
          onExited: () => {
            modal.resolve({ resolved: false });
            modal.remove();
          },
        }}
      >
        <DialogTitle id="alert-dialog-slide-title">
          Zahlungseingang verbuchen (VR-Werdenfels)
        </DialogTitle>
        <DialogContent>`

        how fix this?
XxQuickSilverZz commented 10 hours ago

@supnate please help