MM-56391: fixed search bar moving up in ios (#7796)
* MM-56391: fixed search bar moving up in ios * chore: solved merging conflicts * chore: removed auto formating in package-lock.json * Update package-lock.json * chore: reverted changes in package-lock.json * resetted pr and fixed linting --------- Co-authored-by: Julio Villalvazo Carrera <j.carrera@cyberpuerta.mx> Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
c43656496e
commit
8b32bc73c4
2 changed files with 27 additions and 29 deletions
|
|
@ -62,13 +62,12 @@ const NavigationHeader = forwardRef<SearchRef, Props>(({
|
|||
|
||||
const {largeHeight, defaultHeight, headerOffset} = useHeaderHeight();
|
||||
const containerHeight = useAnimatedStyle(() => {
|
||||
const minHeight = defaultHeight;
|
||||
const value = -(scrollValue?.value || 0);
|
||||
const calculatedHeight = (isLargeTitle ? largeHeight : defaultHeight) + value;
|
||||
const height = lockValue?.value ? lockValue.value : calculatedHeight;
|
||||
return {
|
||||
height: Math.max(height, minHeight),
|
||||
minHeight,
|
||||
height: Math.max(height, defaultHeight),
|
||||
minHeight: defaultHeight,
|
||||
maxHeight: largeHeight + MAX_OVERSCROLL,
|
||||
};
|
||||
});
|
||||
|
|
@ -90,26 +89,25 @@ const NavigationHeader = forwardRef<SearchRef, Props>(({
|
|||
), [lockValue, headerOffset]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Animated.View style={[styles.container, containerHeight]}>
|
||||
<Header
|
||||
defaultHeight={defaultHeight}
|
||||
hasSearch={hasSearch}
|
||||
isLargeTitle={isLargeTitle}
|
||||
heightOffset={heightOffset.value}
|
||||
leftComponent={leftComponent}
|
||||
onBackPress={onBackPress}
|
||||
onTitlePress={onTitlePress}
|
||||
rightButtons={rightButtons}
|
||||
lockValue={lockValue}
|
||||
scrollValue={scrollValue}
|
||||
showBackButton={showBackButton}
|
||||
subtitle={subtitle}
|
||||
subtitleCompanion={subtitleCompanion}
|
||||
theme={theme}
|
||||
title={title}
|
||||
/>
|
||||
{isLargeTitle &&
|
||||
<Animated.View style={[styles.container, containerHeight]}>
|
||||
<Header
|
||||
defaultHeight={defaultHeight}
|
||||
hasSearch={hasSearch}
|
||||
isLargeTitle={isLargeTitle}
|
||||
heightOffset={heightOffset.value}
|
||||
leftComponent={leftComponent}
|
||||
onBackPress={onBackPress}
|
||||
onTitlePress={onTitlePress}
|
||||
rightButtons={rightButtons}
|
||||
lockValue={lockValue}
|
||||
scrollValue={scrollValue}
|
||||
showBackButton={showBackButton}
|
||||
subtitle={subtitle}
|
||||
subtitleCompanion={subtitleCompanion}
|
||||
theme={theme}
|
||||
title={title}
|
||||
/>
|
||||
{isLargeTitle &&
|
||||
<NavigationHeaderLargeTitle
|
||||
heightOffset={heightOffset.value}
|
||||
hasSearch={hasSearch}
|
||||
|
|
@ -118,8 +116,8 @@ const NavigationHeader = forwardRef<SearchRef, Props>(({
|
|||
title={title}
|
||||
translateY={translateY}
|
||||
/>
|
||||
}
|
||||
{hasSearch &&
|
||||
}
|
||||
{hasSearch &&
|
||||
<NavigationSearch
|
||||
{...searchProps}
|
||||
hideHeader={hideHeader}
|
||||
|
|
@ -127,9 +125,8 @@ const NavigationHeader = forwardRef<SearchRef, Props>(({
|
|||
topStyle={searchTopStyle}
|
||||
ref={ref}
|
||||
/>
|
||||
}
|
||||
</Animated.View>
|
||||
</>
|
||||
}
|
||||
</Animated.View>
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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, KeyboardAvoidingView} from 'react-native';
|
||||
import {FlatList, type LayoutChangeEvent, Platform, StyleSheet, type ViewStyle, KeyboardAvoidingView, Keyboard} from 'react-native';
|
||||
import HWKeyboardEvent from 'react-native-hw-keyboard-event';
|
||||
import Animated, {useAnimatedStyle, useDerivedValue, withTiming, type AnimatedStyle} from 'react-native-reanimated';
|
||||
import {type Edge, SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
|
|
@ -149,6 +149,7 @@ const SearchScreen = ({teamId, teams}: Props) => {
|
|||
|
||||
const handleClearSearch = useCallback(() => {
|
||||
clearRef.current = true;
|
||||
Keyboard.dismiss();
|
||||
resetToInitial();
|
||||
}, [resetToInitial]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue