feat(base-chat): conditioned should set responder

This commit is contained in:
Calin-Teodor 2022-07-20 11:33:00 +03:00 committed by Calinteodor
parent 06491e2406
commit 4ef88aa90e
3 changed files with 16 additions and 2 deletions

View File

@ -34,6 +34,11 @@ type Props = {
*/ */
hasTabNavigator: boolean, hasTabNavigator: boolean,
/**
* Is the keyboard already dismissible?
*/
keyboardAlreadyDismissible?: boolean,
/** /**
* Additional style to be appended to the KeyboardAvoidingView. * Additional style to be appended to the KeyboardAvoidingView.
*/ */
@ -46,6 +51,7 @@ const JitsiKeyboardAvoidingView = (
contentContainerStyle, contentContainerStyle,
hasTabNavigator, hasTabNavigator,
hasBottomTextInput, hasBottomTextInput,
keyboardAlreadyDismissible,
style style
}: Props) => { }: Props) => {
const headerHeight = useHeaderHeight(); const headerHeight = useHeaderHeight();
@ -68,7 +74,7 @@ const JitsiKeyboardAvoidingView = (
? headerHeight + StatusBar.currentHeight : headerHeight; ? headerHeight + StatusBar.currentHeight : headerHeight;
// Tells the view what to do with taps // Tells the view what to do with taps
const shouldSetResponse = useCallback(() => true); const shouldSetResponse = useCallback(() => !keyboardAlreadyDismissible);
const onRelease = useCallback(() => Keyboard.dismiss()); const onRelease = useCallback(() => Keyboard.dismiss());
return ( return (

View File

@ -37,6 +37,11 @@ type Props = {
*/ */
hasTabNavigator?: boolean, hasTabNavigator?: boolean,
/**
* Is the keyboard already dismissible?
*/
keyboardAlreadyDismissible?: boolean,
/** /**
* Insets for the SafeAreaView. * Insets for the SafeAreaView.
*/ */
@ -54,6 +59,7 @@ const JitsiScreen = ({
footerComponent, footerComponent,
hasTabNavigator = false, hasTabNavigator = false,
hasBottomTextInput = false, hasBottomTextInput = false,
keyboardAlreadyDismissible = false,
safeAreaInsets = [ 'left', 'right' ], safeAreaInsets = [ 'left', 'right' ],
style style
}: Props) => ( }: Props) => (
@ -63,13 +69,14 @@ const JitsiScreen = ({
contentContainerStyle = { contentContainerStyle } contentContainerStyle = { contentContainerStyle }
hasBottomTextInput = { hasBottomTextInput } hasBottomTextInput = { hasBottomTextInput }
hasTabNavigator = { hasTabNavigator } hasTabNavigator = { hasTabNavigator }
keyboardAlreadyDismissible = { keyboardAlreadyDismissible }
style = { style }> style = { style }>
<SafeAreaView <SafeAreaView
edges = { safeAreaInsets } edges = { safeAreaInsets }
style = { styles.safeArea }> style = { styles.safeArea }>
{children} {children}
</SafeAreaView> </SafeAreaView>
{footerComponent && footerComponent()} { footerComponent && footerComponent() }
</JitsiKeyboardAvoidingView> </JitsiKeyboardAvoidingView>
</View> </View>
); );

View File

@ -55,6 +55,7 @@ class Chat extends AbstractChat<Props> {
<JitsiScreen <JitsiScreen
hasBottomTextInput = { true } hasBottomTextInput = { true }
hasTabNavigator = { true } hasTabNavigator = { true }
keyboardAlreadyDismissible = { true }
style = { styles.chatContainer }> style = { styles.chatContainer }>
<MessageContainer messages = { _messages } /> <MessageContainer messages = { _messages } />
<MessageRecipient privateMessageRecipient = { privateMessageRecipient } /> <MessageRecipient privateMessageRecipient = { privateMessageRecipient } />