feat: ask

This commit is contained in:
jinyaqiu 2025-08-05 15:53:32 +08:00
parent 81be115dad
commit 5fa25e225f
3 changed files with 13 additions and 5 deletions

View File

@ -253,7 +253,7 @@ export default function AskScreen() {
return ( return (
<GestureDetector gesture={gesture}> <GestureDetector gesture={gesture}>
<View style={[styles.container, { paddingTop: insets.top }]}> <View style={[styles.container, { paddingTop: insets.top, paddingBottom: insets.bottom }]}>
{/* 导航栏 */} {/* 导航栏 */}
<View style={[styles.navbar, isHello && styles.hiddenNavbar]}> <View style={[styles.navbar, isHello && styles.hiddenNavbar]}>
<TouchableOpacity <TouchableOpacity
@ -340,7 +340,7 @@ export default function AskScreen() {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor: '#f8f8f8', backgroundColor: '#fff',
}, },
navbar: { navbar: {
flexDirection: 'row', flexDirection: 'row',
@ -359,6 +359,7 @@ const styles = StyleSheet.create({
hiddenNavbar: { hiddenNavbar: {
shadowOpacity: 0, shadowOpacity: 0,
elevation: 0, elevation: 0,
opacity: 0
}, },
backButton: { backButton: {
padding: 8, padding: 8,

View File

@ -1,5 +1,5 @@
import { Asset } from 'expo-asset'; import { Asset } from 'expo-asset';
import { useRouter } from 'expo-router'; import { useFocusEffect, useRouter } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen'; import * as SplashScreen from 'expo-splash-screen';
import React, { useCallback, useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import { FlatList, InteractionManager, PixelRatio, Platform, RefreshControl, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { FlatList, InteractionManager, PixelRatio, Platform, RefreshControl, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
@ -135,6 +135,13 @@ const MemoList = () => {
}; };
}, [fetchHistoryList]); }, [fetchHistoryList]);
// 每次进入页面就刷新
useFocusEffect(
useCallback(() => {
handleRefresh();
}, [])
);
// 渲染列表项 // 渲染列表项
const renderItem = useCallback(({ item }: { item: Chat }) => ( const renderItem = useCallback(({ item }: { item: Chat }) => (
<TouchableOpacity <TouchableOpacity

View File

@ -1,10 +1,10 @@
import IP from "@/assets/icons/svg/ip.svg"; import IP from "@/assets/icons/svg/ip.svg";
import { ThemedText } from "@/components/ThemedText"; import { ThemedText } from "@/components/ThemedText";
import { webSocketManager } from "@/lib/websocket-util";
import { Message } from "@/types/ask"; import { Message } from "@/types/ask";
import { Dispatch, SetStateAction } from "react"; import { Dispatch, SetStateAction } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native'; import { ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';
import { webSocketManager } from "@/lib/websocket-util";
import { createNewConversation } from "./utils"; import { createNewConversation } from "./utils";
interface AskHelloProps { interface AskHelloProps {
@ -57,7 +57,7 @@ export default function AskHello({ setUserMessages, setConversationId, setIsHell
keyboardShouldPersistTaps="handled" keyboardShouldPersistTaps="handled"
> >
<View className="items-center"> <View className="items-center">
<ThemedText className="text-3xl font-bold text-center"> <ThemedText style={{ fontSize: 32, fontWeight: 'bold', textAlign: 'center', lineHeight: 40, }}>
{t('ask.hi', { ns: 'ask' })} {t('ask.hi', { ns: 'ask' })}
{"\n"} {"\n"}
{t('ask.iAmMemo', { ns: 'ask' })} {t('ask.iAmMemo', { ns: 'ask' })}