Compare commits
2 Commits
7b9f523cc1
...
3d4ee1b210
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d4ee1b210 | |||
| d0c66baf45 |
10
app.json
10
app.json
@ -46,7 +46,15 @@
|
||||
"plugins": [
|
||||
"expo-router",
|
||||
"expo-secure-store",
|
||||
[
|
||||
[
|
||||
"expo-font",
|
||||
{
|
||||
"fonts": [
|
||||
"./assets/font/english.otf"
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"expo-background-task",
|
||||
{
|
||||
"minimumInterval": 15
|
||||
|
||||
@ -9,13 +9,16 @@ import { prefetchChats } from '@/lib/prefetch';
|
||||
import { fetchApi } from '@/lib/server-api-util';
|
||||
import { webSocketManager, WebSocketStatus } from '@/lib/websocket-util';
|
||||
import { TransitionPresets } from '@react-navigation/bottom-tabs';
|
||||
import { useFonts } from 'expo-font';
|
||||
import * as Notifications from 'expo-notifications';
|
||||
import { Tabs } from 'expo-router';
|
||||
import * as SecureStore from 'expo-secure-store';
|
||||
import * as SplashScreen from 'expo-splash-screen';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Platform } from 'react-native';
|
||||
|
||||
SplashScreen.preventAutoHideAsync();
|
||||
interface PollingData {
|
||||
title: string;
|
||||
id: string;
|
||||
@ -55,6 +58,17 @@ export default function TabLayout() {
|
||||
});
|
||||
};
|
||||
|
||||
// 加载字体
|
||||
const [loaded, error] = useFonts({
|
||||
english: require('@/assets/font/english.otf'),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (loaded || error) {
|
||||
SplashScreen.hideAsync();
|
||||
}
|
||||
}, [loaded, error]);
|
||||
|
||||
// 监听通知点击事件
|
||||
useEffect(() => {
|
||||
const notificationListener = Notifications.addNotificationResponseReceivedListener(response => {
|
||||
|
||||
@ -55,8 +55,6 @@ export default function AskScreen() {
|
||||
const threshold = 100; // 滑动阈值
|
||||
|
||||
if (translationX > threshold) {
|
||||
// 关闭键盘
|
||||
Keyboard.dismiss();
|
||||
// 从左向右滑动,跳转页面
|
||||
runOnJS(router.replace)("/memo-list");
|
||||
}
|
||||
|
||||
@ -460,6 +460,7 @@ const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: '#FFB645',
|
||||
fontFamily: 'english'
|
||||
},
|
||||
loadingContainer: {
|
||||
flex: 1,
|
||||
|
||||
BIN
assets/font/english.otf
Normal file
BIN
assets/font/english.otf
Normal file
Binary file not shown.
@ -1,11 +1,14 @@
|
||||
import { StyleSheet, Text, type TextProps } from 'react-native';
|
||||
import { StyleProp, StyleSheet, Text, TextStyle, type TextProps } from 'react-native';
|
||||
|
||||
import { Fonts } from '@/constants/Fonts';
|
||||
import { useThemeColor } from '@/hooks/useThemeColor';
|
||||
|
||||
export type ThemedTextProps = TextProps & {
|
||||
lightColor?: string;
|
||||
darkColor?: string;
|
||||
type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link';
|
||||
weight?: 'regular' | 'medium' | 'semiBold' | 'bold';
|
||||
size?: 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl';
|
||||
};
|
||||
|
||||
export function ThemedText({
|
||||
@ -13,14 +16,26 @@ export function ThemedText({
|
||||
lightColor,
|
||||
darkColor,
|
||||
type = 'default',
|
||||
weight = 'regular',
|
||||
size,
|
||||
...rest
|
||||
}: ThemedTextProps) {
|
||||
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text');
|
||||
|
||||
const baseStyle: StyleProp<TextStyle> = {
|
||||
fontFamily: Fonts.primary,
|
||||
color,
|
||||
fontWeight: Fonts[weight as keyof typeof Fonts] as TextStyle['fontWeight'],
|
||||
};
|
||||
|
||||
if (size) {
|
||||
baseStyle.fontSize = Fonts[size as keyof typeof Fonts];
|
||||
}
|
||||
|
||||
return (
|
||||
<Text
|
||||
style={[
|
||||
{ color },
|
||||
baseStyle,
|
||||
type === 'default' ? styles.default : undefined,
|
||||
type === 'title' ? styles.title : undefined,
|
||||
type === 'defaultSemiBold' ? styles.defaultSemiBold : undefined,
|
||||
@ -35,26 +50,28 @@ export function ThemedText({
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
default: {
|
||||
fontSize: 16,
|
||||
fontSize: Fonts.base,
|
||||
lineHeight: 24,
|
||||
},
|
||||
defaultSemiBold: {
|
||||
fontSize: 16,
|
||||
fontSize: Fonts.base,
|
||||
lineHeight: 24,
|
||||
fontWeight: '600',
|
||||
},
|
||||
title: {
|
||||
fontSize: 32,
|
||||
fontWeight: 'bold',
|
||||
fontSize: Fonts['2xl'],
|
||||
fontWeight: '700',
|
||||
lineHeight: 32,
|
||||
},
|
||||
subtitle: {
|
||||
fontSize: 20,
|
||||
fontWeight: 'bold',
|
||||
fontSize: Fonts.lg,
|
||||
fontWeight: '600',
|
||||
lineHeight: 28,
|
||||
},
|
||||
link: {
|
||||
lineHeight: 30,
|
||||
fontSize: 16,
|
||||
fontSize: Fonts.sm,
|
||||
lineHeight: 20,
|
||||
color: '#0a7ea4',
|
||||
textDecorationLine: 'underline',
|
||||
},
|
||||
});
|
||||
|
||||
@ -77,7 +77,6 @@ const PrivacyModal = ({ modalVisible, setModalVisible, type }: PrivacyModalProps
|
||||
</View>
|
||||
);
|
||||
}
|
||||
console.log(article);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
24
constants/Fonts.ts
Normal file
24
constants/Fonts.ts
Normal file
@ -0,0 +1,24 @@
|
||||
export const Fonts = {
|
||||
// Font family
|
||||
primary: 'english',
|
||||
|
||||
// Font weights
|
||||
regular: '400',
|
||||
medium: '500',
|
||||
semiBold: '600',
|
||||
bold: '700',
|
||||
|
||||
// Font sizes
|
||||
xs: 12,
|
||||
sm: 14,
|
||||
base: 16,
|
||||
lg: 18,
|
||||
xl: 20,
|
||||
'2xl': 24,
|
||||
'3xl': 30,
|
||||
'4xl': 36,
|
||||
'5xl': 48,
|
||||
} as const;
|
||||
|
||||
export type FontWeight = keyof Omit<typeof Fonts, 'primary' | 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl'>;
|
||||
export type FontSize = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl';
|
||||
Loading…
x
Reference in New Issue
Block a user