Files
digital-pilates/components/PrivacyConsentModal.tsx
richarjiang a84c026599 feat(ui): 更新应用品牌名称为 Out Live 并优化睡眠详情页默认数据展示
- 将 Sealife 更名为 Out Live(登录页、隐私弹窗)
- 睡眠详情页无数据时显示 "--" 替代固定默认值
- 移除睡眠阶段卡片中的质量标签与总览徽章
- 修复体重历史卡片依赖监听字段与跳转路由
- 调整喝水提醒后台任务时间范围为 8-21 点
- 标签栏按钮新增 activeOpacity=1 禁用点击透明度变化
2025-09-12 09:59:01 +08:00

193 lines
4.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { PRIVACY_POLICY_URL, USER_AGREEMENT_URL } from '@/constants/Agree';
import React from 'react';
import {
Dimensions,
Linking,
Modal,
StyleSheet,
Text,
TouchableOpacity,
View
} from 'react-native';
const { width } = Dimensions.get('window');
interface PrivacyConsentModalProps {
visible: boolean;
onAgree: () => void;
onDisagree: () => void;
}
export default function PrivacyConsentModal({
visible,
onAgree,
onDisagree,
}: PrivacyConsentModalProps) {
const handleUserAgreementPress = () => {
Linking.openURL(USER_AGREEMENT_URL);
};
const handlePrivacyPolicyPress = () => {
Linking.openURL(PRIVACY_POLICY_URL);
};
return (
<Modal
visible={visible}
transparent
animationType="fade"
statusBarTranslucent
>
<View style={styles.overlay}>
<View style={styles.container}>
<Text style={styles.title}>Out Live</Text>
<View style={styles.contentContainer}>
<Text style={styles.description}>
"同意并继续"
</Text>
<View style={styles.linksContainer}>
<TouchableOpacity onPress={handleUserAgreementPress}>
<Text style={styles.link}></Text>
</TouchableOpacity>
<Text style={styles.and}> </Text>
<TouchableOpacity onPress={handlePrivacyPolicyPress}>
<Text style={styles.link}></Text>
</TouchableOpacity>
</View>
<Text style={styles.description}>
</Text>
<View style={styles.viewFullContainer}>
<Text style={styles.viewFull}> </Text>
<TouchableOpacity onPress={handleUserAgreementPress}>
<Text style={styles.link}></Text>
</TouchableOpacity>
<Text style={styles.viewFull}> </Text>
<TouchableOpacity onPress={handlePrivacyPolicyPress}>
<Text style={styles.link}></Text>
</TouchableOpacity>
</View>
</View>
<TouchableOpacity style={styles.agreeButton} onPress={onAgree}>
<Text style={styles.agreeButtonText}></Text>
</TouchableOpacity>
<TouchableOpacity style={styles.disagreeButton} onPress={onDisagree}>
<Text style={styles.disagreeButtonText}>退</Text>
</TouchableOpacity>
</View>
</View>
</Modal>
);
}
const styles = StyleSheet.create({
overlay: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 20,
},
container: {
backgroundColor: 'white',
borderRadius: 20,
padding: 24,
width: width * 0.85,
maxWidth: 400,
alignItems: 'center',
},
iconContainer: {
marginBottom: 20,
alignItems: 'center',
},
characterContainer: {
position: 'relative',
alignItems: 'center',
},
iconText: {
fontSize: 48,
marginBottom: 8,
},
balloons: {
position: 'absolute',
top: -5,
right: -25,
flexDirection: 'row',
gap: 4,
},
balloon: {
width: 12,
height: 16,
borderRadius: 6,
},
title: {
fontSize: 20,
fontWeight: '600',
color: '#1F2937',
marginBottom: 20,
textAlign: 'center',
},
contentContainer: {
marginBottom: 24,
},
description: {
fontSize: 14,
color: '#6B7280',
lineHeight: 20,
textAlign: 'center',
},
linksContainer: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
flexWrap: 'wrap',
},
link: {
fontSize: 14,
color: '#8B5FE6',
textDecorationLine: 'underline',
},
and: {
fontSize: 14,
color: '#6B7280',
},
viewFullContainer: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
flexWrap: 'wrap',
marginTop: 4,
},
viewFull: {
fontSize: 14,
color: '#6B7280',
},
agreeButton: {
backgroundColor: '#8B5FE6',
borderRadius: 25,
paddingVertical: 14,
paddingHorizontal: 40,
width: '100%',
marginBottom: 12,
},
agreeButtonText: {
color: 'white',
fontSize: 16,
fontWeight: '600',
textAlign: 'center',
},
disagreeButton: {
paddingVertical: 14,
paddingHorizontal: 40,
},
disagreeButtonText: {
color: '#9CA3AF',
fontSize: 16,
fontWeight: '500',
textAlign: 'center',
},
});