forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Expensify#30338 from JKobrynski/migrateModalToType…
…Script [TS Migration] Migrate withWindowDimensions and Modal directories to TypeScript
- Loading branch information
Showing
11 changed files
with
252 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
src/components/Modal/index.ios.js → src/components/Modal/index.ios.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
import React from 'react'; | ||
import withWindowDimensions from '@components/withWindowDimensions'; | ||
import BaseModal from './BaseModal'; | ||
import {defaultProps, propTypes} from './modalPropTypes'; | ||
import BaseModalProps from './types'; | ||
|
||
function Modal(props) { | ||
function Modal({children, ...rest}: BaseModalProps) { | ||
return ( | ||
<BaseModal | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
{...rest} | ||
> | ||
{props.children} | ||
{children} | ||
</BaseModal> | ||
); | ||
} | ||
|
||
Modal.propTypes = propTypes; | ||
Modal.defaultProps = defaultProps; | ||
Modal.displayName = 'Modal'; | ||
export default withWindowDimensions(Modal); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import {ViewStyle} from 'react-native'; | ||
import {ModalProps} from 'react-native-modal'; | ||
import {ValueOf} from 'type-fest'; | ||
import {WindowDimensionsProps} from '@components/withWindowDimensions/types'; | ||
import CONST from '@src/CONST'; | ||
|
||
type PopoverAnchorPosition = { | ||
top?: number; | ||
right?: number; | ||
bottom?: number; | ||
left?: number; | ||
}; | ||
|
||
type BaseModalProps = WindowDimensionsProps & | ||
ModalProps & { | ||
/** Decides whether the modal should cover fullscreen. FullScreen modal has backdrop */ | ||
fullscreen?: boolean; | ||
|
||
/** Should we close modal on outside click */ | ||
shouldCloseOnOutsideClick?: boolean; | ||
|
||
/** Should we announce the Modal visibility changes? */ | ||
shouldSetModalVisibility?: boolean; | ||
|
||
/** Callback method fired when the user requests to close the modal */ | ||
onClose: () => void; | ||
|
||
/** State that determines whether to display the modal or not */ | ||
isVisible: boolean; | ||
|
||
/** Callback method fired when the user requests to submit the modal content. */ | ||
onSubmit?: () => void; | ||
|
||
/** Callback method fired when the modal is hidden */ | ||
onModalHide?: () => void; | ||
|
||
/** Callback method fired when the modal is shown */ | ||
onModalShow?: () => void; | ||
|
||
/** Style of modal to display */ | ||
type?: ValueOf<typeof CONST.MODAL.MODAL_TYPE>; | ||
|
||
/** The anchor position of a popover modal. Has no effect on other modal types. */ | ||
popoverAnchorPosition?: PopoverAnchorPosition; | ||
|
||
outerStyle?: ViewStyle; | ||
|
||
/** Whether the modal should go under the system statusbar */ | ||
statusBarTranslucent?: boolean; | ||
|
||
/** Whether the modal should avoid the keyboard */ | ||
avoidKeyboard?: boolean; | ||
|
||
/** Modal container styles */ | ||
innerContainerStyle?: ViewStyle; | ||
|
||
/** | ||
* Whether the modal should hide its content while animating. On iOS, set to true | ||
* if `useNativeDriver` is also true, to avoid flashes in the UI. | ||
* | ||
* See: https://github.com/react-native-modal/react-native-modal/pull/116 | ||
* */ | ||
hideModalContentWhileAnimating?: boolean; | ||
}; | ||
|
||
export default BaseModalProps; |
Oops, something went wrong.