f
This commit is contained in:
parent
780fc293e4
commit
326848de64
@ -5,8 +5,8 @@ import SendMessage from "@/components/ask/send";
|
|||||||
import { ThemedText } from "@/components/ThemedText";
|
import { ThemedText } from "@/components/ThemedText";
|
||||||
import { WEBSOCKET_ENDPOINT } from "@/lib/websocket-util";
|
import { WEBSOCKET_ENDPOINT } from "@/lib/websocket-util";
|
||||||
import { Message } from "@/types/ask";
|
import { Message } from "@/types/ask";
|
||||||
import { useFocusEffect, useLocalSearchParams, useRouter } from "expo-router";
|
import { useLocalSearchParams, useRouter } from "expo-router";
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useRef, useState } from 'react';
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
FlatList,
|
FlatList,
|
||||||
@ -201,29 +201,29 @@ export default function AskScreen() {
|
|||||||
// }
|
// }
|
||||||
// }, [sessionId, newSession]);
|
// }, [sessionId, newSession]);
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (!isHello && isMountedRef.current) {
|
// if (!isHello && isMountedRef.current) {
|
||||||
// 不再自动关闭键盘,让用户手动控制
|
// // 不再自动关闭键盘,让用户手动控制
|
||||||
// 这里可以添加其他需要在隐藏hello界面时执行的逻辑
|
// // 这里可以添加其他需要在隐藏hello界面时执行的逻辑
|
||||||
scrollToEnd(false);
|
// scrollToEnd(false);
|
||||||
}
|
// }
|
||||||
}, [isHello, scrollToEnd]);
|
// }, [isHello, scrollToEnd]);
|
||||||
|
|
||||||
useFocusEffect(
|
// useFocusEffect(
|
||||||
useCallback(() => {
|
// useCallback(() => {
|
||||||
if (!sessionId && isMountedRef.current) {
|
// if (!sessionId && isMountedRef.current) {
|
||||||
setIsHello(true);
|
// setIsHello(true);
|
||||||
setUserMessages([]);
|
// setUserMessages([]);
|
||||||
}
|
// }
|
||||||
}, [sessionId])
|
// }, [sessionId])
|
||||||
);
|
// );
|
||||||
|
|
||||||
// 组件卸载时的清理
|
// 组件卸载时的清理
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
return () => {
|
// return () => {
|
||||||
cleanup();
|
// cleanup();
|
||||||
};
|
// };
|
||||||
}, [cleanup]);
|
// }, [cleanup]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container, { paddingTop: insets.top, paddingBottom: insets.bottom }]}>
|
<View style={[styles.container, { paddingTop: insets.top, paddingBottom: insets.bottom }]}>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user