@@ -12,7 +12,6 @@ import Image from '../image';
12
12
import ListItem from '../listItem' ;
13
13
import PanningProvider from '../panningViews/panningProvider' ;
14
14
15
-
16
15
const VERTICAL_PADDING = 8 ;
17
16
type ActionSheetOnOptionPress = ( index : number ) => void ;
18
17
@@ -75,19 +74,22 @@ type ActionSheetProps = {
75
74
* Render custom action
76
75
* Note: you will need to call onOptionPress so the option's onPress will be called
77
76
*/
78
- renderAction ?: (
79
- option : ButtonProps ,
80
- index : number ,
81
- onOptionPress : ActionSheetOnOptionPress
82
- ) => JSX . Element ;
77
+ renderAction ?: ( option : ButtonProps , index : number , onOptionPress : ActionSheetOnOptionPress ) => JSX . Element ;
83
78
/**
84
- * Called once the modal has been dismissed (iOS only, modal only)
79
+ * Called once the modal has been dismissed completely
85
80
*/
86
81
onModalDismissed ?: DialogProps [ 'onDialogDismissed' ] ;
87
82
/**
88
83
* Whether or not to handle SafeArea
89
84
*/
90
85
useSafeArea ?: boolean ;
86
+ /**
87
+ * Additional props to send to the Dialog
88
+ */
89
+ dialogProps ?: Omit <
90
+ DialogProps ,
91
+ 'useSafeArea' | 'testID' | 'containerStyle' | 'visible' | 'onDismiss' | 'onDialogDismissed'
92
+ > ;
91
93
/**
92
94
* testID for e2e tests
93
95
*/
@@ -124,16 +126,14 @@ class ActionSheet extends Component<ActionSheetProps> {
124
126
cancelBtnIndex = optionsArray . length - 1 ;
125
127
}
126
128
127
- ActionSheetIOS . showActionSheetWithOptions (
128
- {
129
- title,
130
- message,
131
- options : optionsArray . map ( option => option ?. label || '' ) ,
132
- cancelButtonIndex : cancelBtnIndex ,
133
- destructiveButtonIndex
134
- } ,
135
- this . onOptionPress
136
- ) ;
129
+ ActionSheetIOS . showActionSheetWithOptions ( {
130
+ title,
131
+ message,
132
+ options : optionsArray . map ( option => option ?. label || '' ) ,
133
+ cancelButtonIndex : cancelBtnIndex ,
134
+ destructiveButtonIndex
135
+ } ,
136
+ this . onOptionPress ) ;
137
137
}
138
138
}
139
139
@@ -146,7 +146,7 @@ class ActionSheet extends Component<ActionSheetProps> {
146
146
// @ts -ignore
147
147
let source = option . icon ;
148
148
if ( ! source ) {
149
- source = _ . isFunction ( option . iconSource ) ? option . iconSource ( ) : option . iconSource as ImageProps [ 'source' ] ;
149
+ source = _ . isFunction ( option . iconSource ) ? option . iconSource ( ) : ( option . iconSource as ImageProps [ 'source' ] ) ;
150
150
}
151
151
return source && this . renderIcon ( source ) ;
152
152
} ;
@@ -214,7 +214,7 @@ class ActionSheet extends Component<ActionSheetProps> {
214
214
}
215
215
216
216
render ( ) {
217
- const { useNativeIOS, visible, onDismiss, dialogStyle, onModalDismissed, testID, useSafeArea} =
217
+ const { useNativeIOS, visible, onDismiss, dialogStyle, onModalDismissed, testID, useSafeArea, dialogProps } =
218
218
this . props ;
219
219
220
220
if ( Constants . isIOS && useNativeIOS ) {
@@ -223,16 +223,17 @@ class ActionSheet extends Component<ActionSheetProps> {
223
223
224
224
return (
225
225
< Dialog
226
- useSafeArea = { useSafeArea }
227
- testID = { testID }
228
226
bottom
229
227
centerH
230
228
width = "100%"
229
+ panDirection = { PanningProvider . Directions . DOWN }
230
+ { ...dialogProps }
231
+ useSafeArea = { useSafeArea }
232
+ testID = { testID }
231
233
containerStyle = { [ styles . dialog , dialogStyle ] }
232
234
visible = { visible }
233
235
onDismiss = { onDismiss }
234
236
onDialogDismissed = { onModalDismissed }
235
- panDirection = { PanningProvider . Directions . DOWN }
236
237
>
237
238
{ this . renderSheet ( ) }
238
239
</ Dialog >
0 commit comments