diff --git a/components/owner/rights/memberCard.tsx b/components/owner/rights/memberCard.tsx index e579d1b..6323c90 100644 --- a/components/owner/rights/memberCard.tsx +++ b/components/owner/rights/memberCard.tsx @@ -1,6 +1,6 @@ import MemberBgSvg from '@/assets/icons/svg/memberBg.svg'; -import ProSecondTextSvg from '@/assets/icons/svg/proSecondText.svg'; import ProTextSvg from '@/assets/icons/svg/proText.svg'; +import GradientText from '@/components/textLinear'; import { ThemedText } from '@/components/ThemedText'; import { useRouter } from 'expo-router'; import { useTranslation } from "react-i18next"; @@ -31,12 +31,20 @@ const MemberCard = ({ pro }: { pro: string }) => { {/* 会员标识 */} - {"成为会员"} + {t("personal:member.goPremium")} {/* 解锁更多魔法 */} - - {/* {"解锁更多魔法"} */} - + + ); diff --git a/components/textLinear.tsx b/components/textLinear.tsx new file mode 100644 index 0000000..8ddc8a4 --- /dev/null +++ b/components/textLinear.tsx @@ -0,0 +1,89 @@ +import React from 'react'; +import { StyleSheet, View } from 'react-native'; +import Svg, { Defs, LinearGradient, Stop, Text as SvgText, TSpan } from 'react-native-svg'; + +interface GradientTextProps { + text: string; + color?: { offset: string, color: string }[]; + fontSize?: number; + fontWeight?: string; + width?: number; + lineHeight?: number; +} + +export default function GradientText(props: GradientTextProps) { + const { text, color, fontSize = 48, fontWeight = "700", width = 300, lineHeight = 1.2 } = props; + + // Split text into words and create lines that fit within the specified width + const createLines = (text: string, maxWidth: number) => { + const words = text.split(' '); + const lines: string[] = []; + let currentLine = ''; + + words.forEach(word => { + const testLine = currentLine ? `${currentLine} ${word}` : word; + // Approximate text width (this is a simple estimation) + const testWidth = testLine.length * (fontSize * 0.6); + + if (testWidth > maxWidth && currentLine) { + lines.push(currentLine); + currentLine = word; + } else { + currentLine = testLine; + } + }); + + if (currentLine) { + lines.push(currentLine); + } + + return lines; + }; + + const lines = createLines(text, width - 40); // 40px padding + const lineHeightPx = fontSize * lineHeight; + const totalHeight = lines.length * lineHeightPx; + + return ( + + + + + {color?.map((item, index) => ( + + ))} + + + + + {lines.map((line, index) => ( + + {line} + + ))} + + + + ); +} + +const styles = StyleSheet.create({ + container: { + justifyContent: 'center', + alignItems: 'center', + alignSelf: 'center', + }, +}); \ No newline at end of file diff --git a/i18n/index.ts b/i18n/index.ts index a66e823..6149129 100644 --- a/i18n/index.ts +++ b/i18n/index.ts @@ -36,7 +36,7 @@ i18n defaultNS: 'common', // 设置默认语言为中文 - lng: 'zh', + lng: 'en', fallbackLng: 'en', debug: process.env.NODE_ENV === 'development', diff --git a/i18n/locales/en/personal.json b/i18n/locales/en/personal.json index 547f175..db5751c 100644 --- a/i18n/locales/en/personal.json +++ b/i18n/locales/en/personal.json @@ -125,5 +125,9 @@ "agreement": "I have read and agree to", "membership": "《Membership Agreement》", "agreementError": "Please read and agree to the agreement" + }, + "member": { + "goPremium": "Go Premium", + "unlock": "Unlock more memory magic" } } \ No newline at end of file diff --git a/i18n/locales/zh/personal.json b/i18n/locales/zh/personal.json index 72a9341..c7888c6 100644 --- a/i18n/locales/zh/personal.json +++ b/i18n/locales/zh/personal.json @@ -125,5 +125,9 @@ "agreement": "我已阅读并同意", "membership": "《会员协议》", "agreementError": "请先阅读并同意协议" + }, + "member": { + "goPremium": "开通会员", + "unlock": "解锁更多记忆魔法" } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5d89026..50da0cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,7 +74,7 @@ "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "5.4.0", "react-native-screens": "~4.11.1", - "react-native-svg": "^15.11.2", + "react-native-svg": "15.11.2", "react-native-toast-message": "^2.3.0", "react-native-uuid": "^2.0.3", "react-native-view-shot": "4.0.3", diff --git a/package.json b/package.json index 59aa509..e9dd680 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "5.4.0", "react-native-screens": "~4.11.1", - "react-native-svg": "^15.11.2", + "react-native-svg": "15.11.2", "react-native-toast-message": "^2.3.0", "react-native-uuid": "^2.0.3", "react-native-view-shot": "4.0.3",