colorfy-software / react-native-modalfy

🥞 Modal citizen of React Native.
https://colorfy-software.gitbook.io/react-native-modalfy
MIT License
1.08k stars 44 forks source link

Prevent from closing when touched outside #44

Closed KestasVenslauskas closed 3 years ago

KestasVenslauskas commented 3 years ago

Can we prevent modal from closing when touch outside happens? For example loading modal?

CharlesMangwa commented 3 years ago

Hi @KestasVenslauskas, yes you can do so by defining:

modalOptions = {
  backBehavior: 'none', // to disable back button & outside touches
  disableFlingGesture: true, // optionally: to disable fling-to-close gesture
}

as explained in the docs: https://colorfy-software.gitbook.io/react-native-modalfy/api/types/modaloptions#backbehavior

DWboutin commented 1 year ago

Related: https://github.com/colorfy-software/react-native-modalfy/issues/87

Is it possible to have one modal with backBehavior: 'none' without creating another stack just for this one?

sbaiahmed1 commented 1 year ago

Related: #87

Is it possible to have one modal with backBehavior: 'none' without creating another stack just for this one?

const modalConfig: ModalStackConfig = { ShareModal: { modal: ShareModal, position: 'bottom', backBehavior: 'none', // to disable back button & outside touches backdropColor: Colors.black, }, }; const defaultOptions: ModalOptions = { backdropOpacity: 0.3 };

const stack = createModalStack(modalConfig, defaultOptions);