fix(app): stop composer flickering during keyboard changes
Keep layout-only styles on stable React Native style IDs when they share Reanimated hosts with keyboard transforms. This prevents style regeneration from disturbing the animated native views while preserving keyboard and safe-area behavior.
This commit is contained in:
@@ -11,7 +11,7 @@ import React, {
|
||||
useSyncExternalStore,
|
||||
} from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ActivityIndicator, Text, View } from "react-native";
|
||||
import { ActivityIndicator, StyleSheet as RNStyleSheet, Text, View } from "react-native";
|
||||
import ReanimatedAnimated from "react-native-reanimated";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
@@ -1024,7 +1024,7 @@ function ChatAgentContent({
|
||||
]);
|
||||
|
||||
const animatedContentStyle = useMemo(
|
||||
() => [styles.content, animatedKeyboardStyle],
|
||||
() => [animatedStaticStyles.content, animatedKeyboardStyle],
|
||||
[animatedKeyboardStyle],
|
||||
);
|
||||
|
||||
@@ -1468,7 +1468,11 @@ function ActiveAgentComposer({
|
||||
});
|
||||
|
||||
const inputAreaStyle = useMemo(
|
||||
() => [styles.inputAreaWrapper, { paddingBottom: insets.bottom }, composerKeyboardStyle],
|
||||
() => [
|
||||
animatedStaticStyles.inputAreaWrapper,
|
||||
{ paddingBottom: insets.bottom },
|
||||
composerKeyboardStyle,
|
||||
],
|
||||
[insets.bottom, composerKeyboardStyle],
|
||||
);
|
||||
|
||||
@@ -1593,6 +1597,15 @@ const foregroundColorMapping = (theme: Theme) => ({
|
||||
color: theme.colors.foreground,
|
||||
});
|
||||
|
||||
const animatedStaticStyles = RNStyleSheet.create({
|
||||
content: {
|
||||
flex: 1,
|
||||
},
|
||||
inputAreaWrapper: {
|
||||
width: "100%",
|
||||
},
|
||||
});
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
root: {
|
||||
flex: 1,
|
||||
@@ -1607,13 +1620,6 @@ const styles = StyleSheet.create((theme) => ({
|
||||
overflow: "hidden",
|
||||
...(isWeb ? { userSelect: "none" as const } : {}),
|
||||
},
|
||||
content: {
|
||||
flex: 1,
|
||||
},
|
||||
inputAreaWrapper: {
|
||||
width: "100%",
|
||||
backgroundColor: theme.colors.surface0,
|
||||
},
|
||||
historySyncOverlay: {
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
|
||||
Reference in New Issue
Block a user