Skip to content

Commit

Permalink
feat: Modal support animationDuration prop(#1386)
Browse files Browse the repository at this point in the history
  • Loading branch information
1uokun committed Oct 28, 2024
1 parent 3efabea commit 8d7b48a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions components/modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class AntmModal extends React.Component<ModalProps, any> {
children,
style,
animateAppear,
animationDuration,
maskClosable,
popup,
transparent,
Expand Down Expand Up @@ -161,6 +162,7 @@ class AntmModal extends React.Component<ModalProps, any> {
onAnimationEnd={onAnimationEnd}
onRequestClose={onRequestClose}
animateAppear={animateAppear}
animationDuration={animationDuration}
maskClosable={maskClosable}>
<KeyboardAvoidingView
behavior="padding"
Expand Down Expand Up @@ -200,6 +202,7 @@ class AntmModal extends React.Component<ModalProps, any> {
onAnimationEnd={onAnimationEnd}
onRequestClose={onRequestClose}
animateAppear={animateAppear}
animationDuration={animationDuration}
maskClosable={maskClosable}>
<View style={bodyStyle}>{children}</View>
</RCModal>
Expand All @@ -213,6 +216,7 @@ class AntmModal extends React.Component<ModalProps, any> {
modalType={modalType}
visible={visible}
animationType={animType}
animationDuration={animationDuration}
onRequestClose={onRequestClose}
onClose={onClose}>
<View style={style}>{children}</View>
Expand Down
1 change: 1 addition & 0 deletions components/modal/PropsType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ModalStyle } from './style/index'

export interface ModalPropsType {
animateAppear?: boolean
animationDuration?: number
animated?: boolean
animationType?: 'none' | 'fade' | 'slide-up' | 'slide-down' | 'slide'
bodyStyle?: StyleProp<ViewStyle>
Expand Down
3 changes: 2 additions & 1 deletion components/modal/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ Properties | Descrition | Type | Default | Version
| onClose | Callback for clicking close icon x or mask | (): void | - | |
| transparent | transparent mode or full screen mode | Boolean | false | |
| popup | popup mode | Boolean | false | |
| animationDuration | Animation duration, in ms | Number | 300 | `5.2.4` |
| animationType | Options: 'fade' / 'slide' | String | |fade |
| modalType | 弹窗的类型,<br/>`'portal'`时则从`<Provider />`根节点插入(默认),<br/>`'modal'`时则同[`react-native/Modal`](https://reactnative.dev/docs/modal)(用于获取当前context),<br/>`'view'`时则同`react-native/View`(用于弹窗中嵌套弹窗) | `'portal'` | `'modal'` | `'view'` | `'portal'` | `5.2.4` |
| modalType | The type of the popup. <br/>When it is `'portal'`, it is inserted from the `<Provider />` root node (default). <br/>When it is `'modal'`, it is the same as [`react-native/Modal`](https://reactnative.dev/docs/modal) (used to get the current context). <br/>When it is `'view'`, it is the same as `react-native/View` (used to nest popups in popups). | `'portal'` | `'modal'` | `'view'` | `'portal'` | `5.2.4` |
| title | title | React.Element | - | |
| footer | footer content | Array [{text, onPress}] | [] | |
| onRequestClose | The `onRequestClose` callback is called when the user taps the hardware back button on Android or the menu button on Apple TV. Returns `true` to prevent `BackHandler` events when modal is open.| (): boolean | false | |
Expand Down
1 change: 1 addition & 0 deletions components/modal/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ subtitle: 对话框
| onClose | 点击 x 或 mask 回调 | (): void || |
| transparent | 是否背景透明 | Boolean | false | |
| popup | 是否弹窗模式 | Boolean | false | |
| animationDuration | 动画持续时间,单位ms | Number | 300 | `5.2.4` |
| animationType | 可选: 'fade' / 'slide' | String | fade | |
| modalType | 弹窗的类型,<br/>为`'portal'`时则从`<Provider />`根节点插入(默认),<br/>为`'modal'`时则同[`react-native/Modal`](https://reactnative.dev/docs/modal)(用于获取当前context),<br/>为`'view'`时则同`react-native/View`(用于弹窗中嵌套弹窗) | `'portal'` | `'modal'` | `'view'` | `'portal'` | `5.2.4` |
| title | 标题 | React.Element || |
Expand Down

0 comments on commit 8d7b48a

Please sign in to comment.