diff --git a/src/libs/actions/Modal.js b/src/libs/actions/Modal.ts similarity index 74% rename from src/libs/actions/Modal.js rename to src/libs/actions/Modal.ts index ea3bfc351593..ff09731f59a7 100644 --- a/src/libs/actions/Modal.js +++ b/src/libs/actions/Modal.ts @@ -1,25 +1,20 @@ import Onyx from 'react-native-onyx'; import ONYXKEYS from '../../ONYXKEYS'; -let closeModal; -let onModalClose; +let closeModal: (isNavigating: boolean) => void; +let onModalClose: null | (() => void); /** * Allows other parts of the app to call modal close function - * - * @param {Function} [onClose] */ -function setCloseModal(onClose) { +function setCloseModal(onClose: () => void) { closeModal = onClose; } /** * Close modal in other parts of the app - * - * @param {Function} [onModalCloseCallback] - * @param {Boolean} isNavigating */ -function close(onModalCloseCallback, isNavigating = true) { +function close(onModalCloseCallback: () => void, isNavigating = true) { if (!closeModal) { // If modal is already closed, no need to wait for modal close. So immediately call callback. if (onModalCloseCallback) { @@ -42,20 +37,16 @@ function onModalDidClose() { /** * Allows other parts of the app to know when a modal has been opened or closed - * - * @param {Boolean} isVisible */ -function setModalVisibility(isVisible) { +function setModalVisibility(isVisible: boolean) { Onyx.merge(ONYXKEYS.MODAL, {isVisible}); } /** * Allows other parts of app to know that an alert modal is about to open. * This will trigger as soon as a modal is opened but not yet visible while animation is running. - * - * @param {Boolean} isVisible */ -function willAlertModalBecomeVisible(isVisible) { +function willAlertModalBecomeVisible(isVisible: boolean) { Onyx.merge(ONYXKEYS.MODAL, {willAlertModalBecomeVisible: isVisible}); }