feat: 交互优化
This commit is contained in:
parent
a6cc33b7d6
commit
78a8d42ea1
@ -226,6 +226,9 @@ const MemoList = () => {
|
||||
return (
|
||||
<View style={[styles.container, { paddingTop: insets.top }]}>
|
||||
<SkeletonList />
|
||||
<React.Suspense fallback={null}>
|
||||
<AskNavbar />
|
||||
</React.Suspense>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@ -322,13 +325,13 @@ const styles = StyleSheet.create({
|
||||
justifyContent: 'center',
|
||||
},
|
||||
memoTitle: {
|
||||
fontSize: 14,
|
||||
fontSize: 16,
|
||||
fontWeight: '500',
|
||||
color: '#4C320C',
|
||||
marginBottom: 4,
|
||||
},
|
||||
memoSubtitle: {
|
||||
fontSize: 12,
|
||||
fontSize: 14,
|
||||
color: '#AC7E35',
|
||||
},
|
||||
separator: {
|
||||
|
||||
@ -11,6 +11,12 @@ interface ErrorBoundaryState {
|
||||
error?: Error;
|
||||
}
|
||||
|
||||
const translations = {
|
||||
error: 'Error',
|
||||
issue: 'An issue occurred',
|
||||
retry: 'Retry'
|
||||
};
|
||||
|
||||
class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||
constructor(props: ErrorBoundaryProps) {
|
||||
super(props);
|
||||
@ -37,12 +43,12 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>出错了</Text>
|
||||
<Text style={styles.title}>{translations.error}</Text>
|
||||
<Text style={styles.error}>
|
||||
{this.state.error?.message || '发生了一些问题'}
|
||||
{this.state.error?.message || translations.issue}
|
||||
</Text>
|
||||
<TouchableOpacity style={styles.retryButton} onPress={this.handleRetry}>
|
||||
<Text style={styles.retryText}>重试</Text>
|
||||
<Text style={styles.retryText}>{translations.retry}</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
|
||||
@ -94,7 +94,10 @@ const AskNavbar = () => {
|
||||
resizeMode: 'cover'
|
||||
},
|
||||
navButton: {
|
||||
padding: 16
|
||||
width: width / 2, // 半屏宽度
|
||||
height: 80, // 与 navbar 高度相同
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
},
|
||||
navContainer: {
|
||||
position: 'absolute',
|
||||
@ -134,7 +137,7 @@ const AskNavbar = () => {
|
||||
<View style={styles.navContainer}>
|
||||
<TouchableOpacity
|
||||
onPress={() => navigateTo('/memo-list')}
|
||||
style={styles.navButton}
|
||||
style={[styles.navButton, { alignItems: "flex-start", paddingLeft: 16 }]}
|
||||
>
|
||||
<TabIcon
|
||||
isActive={pathname === "/memo-list"}
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
"memoList": "Memo List",
|
||||
"noChat": "No Chat",
|
||||
"loading": "Loading...",
|
||||
"refresh": "Refresh"
|
||||
"refresh": "Refresh",
|
||||
"error": "have some error",
|
||||
"issue": "have some issue"
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,8 @@
|
||||
"memoList": "对话记录",
|
||||
"noChat": "暂无对话记录",
|
||||
"loading": "加载中...",
|
||||
"refresh": "刷新"
|
||||
"refresh": "刷新",
|
||||
"error": "出错了",
|
||||
"issue": "发生了一些问题"
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user