@@ -11,6 +11,7 @@ import {
11
11
StyleProp ,
12
12
StyleSheet ,
13
13
TouchableWithoutFeedback ,
14
+ View ,
14
15
ViewStyle ,
15
16
useWindowDimensions ,
16
17
} from 'react-native' ;
@@ -66,51 +67,59 @@ const Modal = ({
66
67
useOnDismiss ( modalVisible , onDismiss ) ;
67
68
68
69
return (
69
- < RNModal
70
- statusBarTranslucent = { statusBarTranslucent }
71
- transparent
72
- hardwareAccelerated
73
- visible = { modalVisible }
74
- onRequestClose = { onClose }
75
- onShow = { ( ) => showTransition ( ) }
76
- onDismiss = { onDismiss }
77
- supportedOrientations = { [ 'portrait' , 'portrait-upside-down' , 'landscape' , 'landscape-left' , 'landscape-right' ] }
78
- animationType = { 'none' }
79
- { ...props }
80
- >
81
- < TouchableWithoutFeedback onPress = { disableBackgroundClose ? undefined : onClose } >
82
- < Animated . View
83
- style = { [ StyleSheet . absoluteFill , { opacity : backdrop . opacity , backgroundColor : palette . onBackgroundLight03 } ] }
84
- />
85
- </ TouchableWithoutFeedback >
86
- < KeyboardAvoidingView
87
- // NOTE: This is trick for Android.
88
- // When orientation is changed on Android, the offset that to avoid soft-keyboard is not updated normally.
89
- key = { Platform . OS === 'android' && enableKeyboardAvoid ? `${ width } -${ height } ` : undefined }
90
- enabled = { enableKeyboardAvoid }
91
- style = { styles . background }
92
- behavior = { Platform . select ( { ios : 'padding' , default : 'height' } ) }
93
- pointerEvents = { 'box-none' }
94
- keyboardVerticalOffset = { enableKeyboardAvoid && statusBarTranslucent ? - topInset : 0 }
70
+ < View >
71
+ < RNModal
72
+ statusBarTranslucent = { statusBarTranslucent }
73
+ transparent
74
+ hardwareAccelerated
75
+ visible = { modalVisible }
76
+ onRequestClose = { onClose }
77
+ onShow = { ( ) => showTransition ( ) }
78
+ onDismiss = { onDismiss }
79
+ supportedOrientations = { [ 'portrait' , 'portrait-upside-down' , 'landscape' , 'landscape-left' , 'landscape-right' ] }
80
+ animationType = { 'none' }
81
+ { ...props }
95
82
>
96
- < Animated . View
97
- style = { [
98
- styles . background ,
99
- backgroundStyle ,
100
- { opacity : content . opacity , transform : [ { translateY : content . translateY } ] } ,
101
- ] }
83
+ < TouchableWithoutFeedback onPress = { disableBackgroundClose ? undefined : onClose } >
84
+ < Animated . View
85
+ style = { [
86
+ StyleSheet . absoluteFill ,
87
+ {
88
+ opacity : backdrop . opacity ,
89
+ backgroundColor : palette . onBackgroundLight03 ,
90
+ } ,
91
+ ] }
92
+ />
93
+ </ TouchableWithoutFeedback >
94
+ < KeyboardAvoidingView
95
+ // NOTE: This is trick for Android.
96
+ // When orientation is changed on Android, the offset that to avoid soft-keyboard is not updated normally.
97
+ key = { Platform . OS === 'android' && enableKeyboardAvoid ? `${ width } -${ height } ` : undefined }
98
+ enabled = { enableKeyboardAvoid }
99
+ style = { styles . background }
100
+ behavior = { Platform . select ( { ios : 'padding' , default : 'height' } ) }
102
101
pointerEvents = { 'box-none' }
103
- { ... panResponder . panHandlers }
102
+ keyboardVerticalOffset = { enableKeyboardAvoid && statusBarTranslucent ? - topInset : 0 }
104
103
>
105
- < Pressable
106
- // NOTE: https://github.com/facebook/react-native/issues/14295
107
- // Due to 'Pressable', the width of the children must be explicitly specified as a number.
104
+ < Animated . View
105
+ style = { [
106
+ styles . background ,
107
+ backgroundStyle ,
108
+ { opacity : content . opacity , transform : [ { translateY : content . translateY } ] } ,
109
+ ] }
110
+ pointerEvents = { 'box-none' }
111
+ { ...panResponder . panHandlers }
108
112
>
109
- { children }
110
- </ Pressable >
111
- </ Animated . View >
112
- </ KeyboardAvoidingView >
113
- </ RNModal >
113
+ < Pressable
114
+ // NOTE: https://github.com/facebook/react-native/issues/14295
115
+ // Due to 'Pressable', the width of the children must be explicitly specified as a number.
116
+ >
117
+ { children }
118
+ </ Pressable >
119
+ </ Animated . View >
120
+ </ KeyboardAvoidingView >
121
+ </ RNModal >
122
+ </ View >
114
123
) ;
115
124
} ;
116
125
0 commit comments