feat: 添加用户登录和法律协议页面
- 新增登录页面,支持 Apple 登录和游客登录功能 - 添加用户协议和隐私政策页面,用户需同意后才能登录 - 更新首页逻辑,首次进入时自动跳转到登录页面 - 修改个人信息页面,移除单位选择功能,统一使用 kg 和 cm - 更新依赖,添加 expo-apple-authentication 库以支持 Apple 登录 - 更新布局以适应新功能的展示和交互
This commit is contained in:
@@ -5,7 +5,7 @@ import { ThemedView } from '@/components/ThemedView';
|
||||
import { WorkoutCard } from '@/components/WorkoutCard';
|
||||
import { getChineseGreeting } from '@/utils/date';
|
||||
import { useRouter } from 'expo-router';
|
||||
import React from 'react';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
|
||||
|
||||
const workoutData = [
|
||||
@@ -24,6 +24,15 @@ const workoutData = [
|
||||
|
||||
export default function HomeScreen() {
|
||||
const router = useRouter();
|
||||
const hasOpenedLoginRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
// 仅在本次会话首次进入首页时打开登录页,可返回关闭
|
||||
if (!hasOpenedLoginRef.current) {
|
||||
hasOpenedLoginRef.current = true;
|
||||
router.push('/auth/login');
|
||||
}
|
||||
}, [router]);
|
||||
return (
|
||||
<SafeAreaView style={styles.safeArea}>
|
||||
<ThemedView style={styles.container}>
|
||||
|
||||
Reference in New Issue
Block a user