Collapse match card header on keyboard open

This commit is contained in:
jjbrunton committed 2026-01-04 19:55:32 +00:00
1 parent 58209b94ef
commit 474bbb6829
2 files changed
+49 -7

No files matched your search

@@ -505,7 +505,10 @@
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\""; LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited) "; OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native"; REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@@ -560,7 +563,10 @@
); );
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\""; LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "$(inherited) "; OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native"; REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos; SDKROOT = iphoneos;
USE_HERMES = true; USE_HERMES = true;
@@ -3,7 +3,14 @@ import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import { Image } from 'expo-image'; import { Image } from 'expo-image';
import { Ionicons } from '@expo/vector-icons'; import { Ionicons } from '@expo/vector-icons';
import { LinearGradient } from 'expo-linear-gradient'; import { LinearGradient } from 'expo-linear-gradient';
import Animated, { FadeIn, FadeInDown } from 'react-native-reanimated'; import Animated, {
FadeIn,
FadeInDown,
useAnimatedKeyboard,
useAnimatedStyle,
interpolate,
Extrapolation
} from 'react-native-reanimated';
import { EdgeInsets } from 'react-native-safe-area-context'; import { EdgeInsets } from 'react-native-safe-area-context';
import { DecorativeSeparator } from '../../../components/ui'; import { DecorativeSeparator } from '../../../components/ui';
@@ -31,6 +38,29 @@ export const ChatHeader: React.FC<ChatHeaderProps> = ({
}) => { }) => {
const isYesYes = match?.match_type === 'yes_yes'; const isYesYes = match?.match_type === 'yes_yes';
// Modern reanimated keyboard hook
const keyboard = useAnimatedKeyboard();
const containerAnimatedStyle = useAnimatedStyle(() => {
// Collapse when keyboard height exceeds 50px
const animationValue = interpolate(
keyboard.height.value,
[0, 60],
[0, 1],
Extrapolation.CLAMP
);
return {
opacity: interpolate(animationValue, [0, 1], [1, 0]),
maxHeight: interpolate(animationValue, [0, 1], [500, 0]), // Assuming card max height
marginTop: interpolate(animationValue, [0, 1], [spacing.sm, 0]),
transform: [
{ scale: interpolate(animationValue, [0, 1], [1, 0.95]) }
],
overflow: 'hidden',
};
});
return ( return (
<> <>
<Animated.View <Animated.View
@@ -102,8 +132,9 @@ export const ChatHeader: React.FC<ChatHeaderProps> = ({
{match?.question && ( {match?.question && (
<Animated.View <Animated.View
entering={FadeInDown.delay(100).duration(400).springify()} entering={FadeInDown.delay(100).duration(400).springify()}
style={styles.matchCard} style={[styles.matchCardContainer, containerAnimatedStyle]}
> >
<View style={styles.matchCard}>
{/* Card gradient background */} {/* Card gradient background */}
<LinearGradient <LinearGradient
colors={isYesYes colors={isYesYes
@@ -202,6 +233,7 @@ export const ChatHeader: React.FC<ChatHeaderProps> = ({
styles.matchCardBorder, styles.matchCardBorder,
isYesYes && styles.matchCardBorderYesYes isYesYes && styles.matchCardBorderYesYes
]} pointerEvents="none" /> ]} pointerEvents="none" />
</View>
</Animated.View> </Animated.View>
)} )}
</> </>
@@ -301,10 +333,14 @@ const styles = StyleSheet.create({
height: 1, height: 1,
backgroundColor: `${ACCENT_RGBA}0.15)`, backgroundColor: `${ACCENT_RGBA}0.15)`,
}, },
matchCard: { matchCardContainer: {
marginHorizontal: spacing.md, marginHorizontal: spacing.md,
marginTop: spacing.sm, // Vertical margins are handled by animation
marginBottom: spacing.xs, borderRadius: radius.lg,
overflow: 'hidden',
},
matchCard: {
// Margins moved to container
borderRadius: radius.lg, borderRadius: radius.lg,
paddingVertical: spacing.md, paddingVertical: spacing.md,
paddingHorizontal: spacing.md, paddingHorizontal: spacing.md,