From 885ae2c29fbda921ccc87614cc384455f4c65479 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Thu, 27 Jul 2023 15:10:22 +0300 Subject: [PATCH] Fix keyboard overlap with recent search items in the search tab (#7465) (#7474) * Fix keyboard overlap recent search item in search tab * Set the behavior of KeyboardAvoidingView on Android to 'undefined' to avoid losing some content at the bottom (cherry picked from commit 79994bf159c375c383fd21751940853f4132f5d6) Co-authored-by: namanh-asher --- app/screens/home/search/search.tsx | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/screens/home/search/search.tsx b/app/screens/home/search/search.tsx index a18515820..cfa0107b4 100644 --- a/app/screens/home/search/search.tsx +++ b/app/screens/home/search/search.tsx @@ -4,7 +4,7 @@ import {useIsFocused, useNavigation} from '@react-navigation/native'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {useIntl} from 'react-intl'; -import {FlatList, type LayoutChangeEvent, Platform, StyleSheet, type ViewStyle} from 'react-native'; +import {FlatList, type LayoutChangeEvent, Platform, StyleSheet, type ViewStyle, KeyboardAvoidingView} from 'react-native'; import HWKeyboardEvent from 'react-native-hw-keyboard-event'; import Animated, {useAnimatedStyle, useDerivedValue, withTiming} from 'react-native-reanimated'; import {type Edge, SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context'; @@ -363,10 +363,14 @@ const SearchScreen = ({teamId, teams}: Props) => { onLayout={onLayout} testID='search_messages.screen' > - - - - {lastSearchedValue && !loading && + + + + + {lastSearchedValue && !loading &&
{ selectedFilter={filter} teams={teams} /> - } - - {!showResults && + } + + {!showResults && { ref={scrollRef} renderItem={renderInitialOrLoadingItem} /> - } - {showResults && !loading && + } + {showResults && !loading && { scrollPaddingTop={lockValue.value} fileChannelIds={fileChannelIds} /> - } - + } + + {searchIsFocused &&