Skip to content

Commit 2fd5b8c

Browse files
authored
Merge pull request #246 from sendbird/fix/CLNP-6755-modal-not-showing-with-drawer-navigator
[CLNP-6755]fix : BottomSheet not appearing when using DrawerNabigator
2 parents 15ed2fd + c92a0c2 commit 2fd5b8c

File tree

1 file changed

+50
-41
lines changed
  • packages/uikit-react-native-foundation/src/components/Modal

1 file changed

+50
-41
lines changed

packages/uikit-react-native-foundation/src/components/Modal/index.tsx

Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
StyleProp,
1212
StyleSheet,
1313
TouchableWithoutFeedback,
14+
View,
1415
ViewStyle,
1516
useWindowDimensions,
1617
} from 'react-native';
@@ -66,51 +67,59 @@ const Modal = ({
6667
useOnDismiss(modalVisible, onDismiss);
6768

6869
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}
9582
>
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' })}
102101
pointerEvents={'box-none'}
103-
{...panResponder.panHandlers}
102+
keyboardVerticalOffset={enableKeyboardAvoid && statusBarTranslucent ? -topInset : 0}
104103
>
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}
108112
>
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>
114123
);
115124
};
116125

0 commit comments

Comments
 (0)