fix: bug
This commit is contained in:
@@ -26,6 +26,7 @@ import { useTemplateGenerations, type TemplateGeneration } from '@/hooks'
|
|||||||
import { MySkeleton } from '@/components/skeleton/MySkeleton'
|
import { MySkeleton } from '@/components/skeleton/MySkeleton'
|
||||||
|
|
||||||
import { useUserBalance } from '@/hooks/use-user-balance'
|
import { useUserBalance } from '@/hooks/use-user-balance'
|
||||||
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-controller'
|
||||||
|
|
||||||
const { width: screenWidth } = Dimensions.get('window')
|
const { width: screenWidth } = Dimensions.get('window')
|
||||||
const GALLERY_GAP = 2
|
const GALLERY_GAP = 2
|
||||||
@@ -182,6 +183,8 @@ export default function My() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={styles.container} edges={['top', 'bottom']}>
|
<SafeAreaView style={styles.container} edges={['top', 'bottom']}>
|
||||||
|
<KeyboardAwareScrollView bottomOffset={50}>
|
||||||
|
|
||||||
<StatusBar style="light" />
|
<StatusBar style="light" />
|
||||||
<RNStatusBar barStyle="light-content" />
|
<RNStatusBar barStyle="light-content" />
|
||||||
|
|
||||||
@@ -223,7 +226,10 @@ export default function My() {
|
|||||||
</View>
|
</View>
|
||||||
<Pressable
|
<Pressable
|
||||||
style={styles.editButton}
|
style={styles.editButton}
|
||||||
onPress={() => setEditDrawerVisible(true)}
|
onPress={() => {
|
||||||
|
console.log('[my.tsx] Edit Profile button pressed')
|
||||||
|
setEditDrawerVisible(true)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.editButtonText}>{t('my.editProfile')}</Text>
|
<Text style={styles.editButtonText}>{t('my.editProfile')}</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
@@ -335,6 +341,7 @@ export default function My() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 编辑资料抽屉 */}
|
{/* 编辑资料抽屉 */}
|
||||||
|
|
||||||
<EditProfileDrawer
|
<EditProfileDrawer
|
||||||
visible={editDrawerVisible}
|
visible={editDrawerVisible}
|
||||||
onClose={() => setEditDrawerVisible(false)}
|
onClose={() => setEditDrawerVisible(false)}
|
||||||
@@ -344,6 +351,7 @@ export default function My() {
|
|||||||
setProfileName(data.name)
|
setProfileName(data.name)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
</KeyboardAwareScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
16
app/auth.tsx
16
app/auth.tsx
@@ -4,6 +4,7 @@ import { StatusBar } from 'expo-status-bar'
|
|||||||
import { SafeAreaView } from 'react-native-safe-area-context'
|
import { SafeAreaView } from 'react-native-safe-area-context'
|
||||||
import { useRouter } from 'expo-router'
|
import { useRouter } from 'expo-router'
|
||||||
import { LinearGradient } from 'expo-linear-gradient'
|
import { LinearGradient } from 'expo-linear-gradient'
|
||||||
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-controller'
|
||||||
import { AuthForm } from '@/components/blocks/AuthForm'
|
import { AuthForm } from '@/components/blocks/AuthForm'
|
||||||
import { useSession } from '@/lib/auth'
|
import { useSession } from '@/lib/auth'
|
||||||
|
|
||||||
@@ -48,9 +49,15 @@ export default function Auth() {
|
|||||||
<StatusBar style="light" />
|
<StatusBar style="light" />
|
||||||
<RNStatusBar barStyle="light-content" />
|
<RNStatusBar barStyle="light-content" />
|
||||||
|
|
||||||
|
<KeyboardAwareScrollView
|
||||||
|
style={styles.scrollView}
|
||||||
|
contentContainerStyle={styles.scrollContent}
|
||||||
|
bottomOffset={50}
|
||||||
|
>
|
||||||
<View style={styles.content}>
|
<View style={styles.content}>
|
||||||
<AuthForm onSuccess={handleSuccess} />
|
<AuthForm onSuccess={handleSuccess} />
|
||||||
</View>
|
</View>
|
||||||
|
</KeyboardAwareScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
</LinearGradient>
|
</LinearGradient>
|
||||||
)
|
)
|
||||||
@@ -66,10 +73,17 @@ const styles = StyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
},
|
},
|
||||||
content: {
|
scrollView: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
},
|
||||||
|
scrollContent: {
|
||||||
|
flexGrow: 1,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
paddingHorizontal: 20,
|
paddingHorizontal: 20,
|
||||||
},
|
},
|
||||||
|
content: {
|
||||||
|
width: '100%',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {
|
|||||||
View,
|
View,
|
||||||
Text,
|
Text,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
ScrollView,
|
|
||||||
Pressable,
|
Pressable,
|
||||||
Platform,
|
Platform,
|
||||||
TextInput,
|
TextInput,
|
||||||
@@ -14,6 +13,7 @@ import { SafeAreaView } from 'react-native-safe-area-context'
|
|||||||
import { useRouter } from 'expo-router'
|
import { useRouter } from 'expo-router'
|
||||||
import { StatusBar as RNStatusBar } from 'react-native'
|
import { StatusBar as RNStatusBar } from 'react-native'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-controller'
|
||||||
import { LeftArrowIcon } from '@/components/icon'
|
import { LeftArrowIcon } from '@/components/icon'
|
||||||
import { LinearGradient } from 'expo-linear-gradient'
|
import { LinearGradient } from 'expo-linear-gradient'
|
||||||
import { useChangePassword } from '@/hooks/use-change-password'
|
import { useChangePassword } from '@/hooks/use-change-password'
|
||||||
@@ -140,11 +140,10 @@ export default function ChangePasswordScreen() {
|
|||||||
<Text style={styles.headerTitle}>{t('changePassword.title')}</Text>
|
<Text style={styles.headerTitle}>{t('changePassword.title')}</Text>
|
||||||
<View style={styles.headerSpacer} />
|
<View style={styles.headerSpacer} />
|
||||||
</View>
|
</View>
|
||||||
<ScrollView
|
<KeyboardAwareScrollView
|
||||||
style={styles.scrollView}
|
style={styles.scrollView}
|
||||||
contentContainerStyle={styles.scrollContent}
|
contentContainerStyle={styles.scrollContent}
|
||||||
showsVerticalScrollIndicator={false}
|
bottomOffset={50}
|
||||||
keyboardShouldPersistTaps="handled"
|
|
||||||
>
|
>
|
||||||
<View style={styles.form}>
|
<View style={styles.form}>
|
||||||
<View style={styles.inputGroup}>
|
<View style={styles.inputGroup}>
|
||||||
@@ -257,7 +256,7 @@ export default function ChangePasswordScreen() {
|
|||||||
</LinearGradient>
|
</LinearGradient>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</KeyboardAwareScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import {
|
|||||||
Pressable,
|
Pressable,
|
||||||
StatusBar as RNStatusBar,
|
StatusBar as RNStatusBar,
|
||||||
Platform,
|
Platform,
|
||||||
KeyboardAvoidingView,
|
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import { StatusBar } from 'expo-status-bar'
|
import { StatusBar } from 'expo-status-bar'
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context'
|
import { SafeAreaView } from 'react-native-safe-area-context'
|
||||||
import { Image } from 'expo-image'
|
import { Image } from 'expo-image'
|
||||||
import { useRouter, useLocalSearchParams } from 'expo-router'
|
import { useRouter, useLocalSearchParams } from 'expo-router'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-controller'
|
||||||
|
|
||||||
import { LeftArrowIcon, WhitePointsIcon } from '@/components/icon'
|
import { LeftArrowIcon, WhitePointsIcon } from '@/components/icon'
|
||||||
import UploadReferenceImageDrawer from '@/components/drawer/UploadReferenceImageDrawer'
|
import UploadReferenceImageDrawer from '@/components/drawer/UploadReferenceImageDrawer'
|
||||||
@@ -95,16 +95,10 @@ export default function GenerateVideoScreen() {
|
|||||||
translucent
|
translucent
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<KeyboardAvoidingView
|
<KeyboardAwareScrollView
|
||||||
style={styles.keyboardAvoidingView}
|
|
||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
|
||||||
keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 0}
|
|
||||||
>
|
|
||||||
<ScrollView
|
|
||||||
style={styles.scrollView}
|
style={styles.scrollView}
|
||||||
contentContainerStyle={styles.scrollContent}
|
contentContainerStyle={styles.scrollContent}
|
||||||
showsVerticalScrollIndicator={false}
|
bottomOffset={50}
|
||||||
keyboardShouldPersistTaps="handled"
|
|
||||||
>
|
>
|
||||||
{/* 顶部导航栏 */}
|
{/* 顶部导航栏 */}
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
@@ -152,6 +146,7 @@ export default function GenerateVideoScreen() {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
onOpenDrawer={handleOpenDrawer}
|
onOpenDrawer={handleOpenDrawer}
|
||||||
points={templateDetail?.price}
|
points={templateDetail?.price}
|
||||||
|
disableScroll
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<View style={styles.emptyContainer}>
|
<View style={styles.emptyContainer}>
|
||||||
@@ -162,8 +157,7 @@ export default function GenerateVideoScreen() {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</KeyboardAwareScrollView>
|
||||||
</KeyboardAvoidingView>
|
|
||||||
|
|
||||||
{/* 图片上传抽屉 */}
|
{/* 图片上传抽屉 */}
|
||||||
<UploadReferenceImageDrawer
|
<UploadReferenceImageDrawer
|
||||||
@@ -197,9 +191,6 @@ const styles = StyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '#090A0B',
|
backgroundColor: '#090A0B',
|
||||||
},
|
},
|
||||||
keyboardAvoidingView: {
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
scrollView: {
|
scrollView: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '#090A0B',
|
backgroundColor: '#090A0B',
|
||||||
|
|||||||
@@ -6,12 +6,11 @@ import {
|
|||||||
StyleSheet,
|
StyleSheet,
|
||||||
Platform,
|
Platform,
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
ScrollView,
|
|
||||||
KeyboardAvoidingView,
|
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import { Image } from 'expo-image'
|
import { Image } from 'expo-image'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import * as ImagePicker from 'expo-image-picker'
|
import * as ImagePicker from 'expo-image-picker'
|
||||||
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-controller'
|
||||||
|
|
||||||
import { Button } from './ui/button'
|
import { Button } from './ui/button'
|
||||||
import Text from './ui/Text'
|
import Text from './ui/Text'
|
||||||
@@ -81,10 +80,12 @@ interface DynamicFormProps {
|
|||||||
loading?: boolean
|
loading?: boolean
|
||||||
onOpenDrawer?: (nodeId: string) => void
|
onOpenDrawer?: (nodeId: string) => void
|
||||||
points?: number
|
points?: number
|
||||||
|
/** 当外层已有滚动视图时,禁用内部滚动 */
|
||||||
|
disableScroll?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DynamicForm = forwardRef<DynamicFormRef, DynamicFormProps>(
|
export const DynamicForm = forwardRef<DynamicFormRef, DynamicFormProps>(
|
||||||
function DynamicForm({ formSchema, onSubmit, loading = false, onOpenDrawer, points }, ref) {
|
function DynamicForm({ formSchema, onSubmit, loading = false, onOpenDrawer, points, disableScroll = false }, ref) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const startNodes = formSchema.startNodes || []
|
const startNodes = formSchema.startNodes || []
|
||||||
|
|
||||||
@@ -456,18 +457,8 @@ export const DynamicForm = forwardRef<DynamicFormRef, DynamicFormProps>(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
const formContent = (
|
||||||
<KeyboardAvoidingView
|
<>
|
||||||
style={styles.keyboardAvoidingView}
|
|
||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
|
||||||
keyboardVerticalOffset={0}
|
|
||||||
>
|
|
||||||
<ScrollView
|
|
||||||
style={styles.scrollView}
|
|
||||||
contentContainerStyle={styles.scrollContent}
|
|
||||||
showsVerticalScrollIndicator={false}
|
|
||||||
keyboardShouldPersistTaps="handled"
|
|
||||||
>
|
|
||||||
{startNodes.map(renderField)}
|
{startNodes.map(renderField)}
|
||||||
|
|
||||||
<View style={styles.submitButtonContainer}>
|
<View style={styles.submitButtonContainer}>
|
||||||
@@ -495,16 +486,31 @@ export const DynamicForm = forwardRef<DynamicFormRef, DynamicFormProps>(
|
|||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</>
|
||||||
</KeyboardAvoidingView>
|
)
|
||||||
|
|
||||||
|
// 当外层已有滚动视图时,不使用内部滚动
|
||||||
|
if (disableScroll) {
|
||||||
|
return (
|
||||||
|
<View style={styles.scrollContent}>
|
||||||
|
{formContent}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<KeyboardAwareScrollView
|
||||||
|
style={styles.scrollView}
|
||||||
|
contentContainerStyle={styles.scrollContent}
|
||||||
|
bottomOffset={50}
|
||||||
|
>
|
||||||
|
{formContent}
|
||||||
|
</KeyboardAwareScrollView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
keyboardAvoidingView: {
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
scrollView: {
|
scrollView: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,21 +4,19 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Pressable,
|
Pressable,
|
||||||
TextInput,
|
|
||||||
Dimensions,
|
|
||||||
Platform,
|
Platform,
|
||||||
Keyboard,
|
Keyboard,
|
||||||
ScrollView,
|
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import { Image } from 'expo-image'
|
import { Image } from 'expo-image'
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import BottomSheet, { BottomSheetModal, BottomSheetView, BottomSheetBackdrop, BottomSheetScrollView } from '@gorhom/bottom-sheet'
|
import { BottomSheetModal, BottomSheetBackdrop, BottomSheetTextInput, BottomSheetView } from '@gorhom/bottom-sheet'
|
||||||
import { CloseIcon, AvatarUploadIcon } from '@/components/icon'
|
import { CloseIcon, AvatarUploadIcon } from '@/components/icon'
|
||||||
import { LinearGradient } from 'expo-linear-gradient'
|
import { LinearGradient } from 'expo-linear-gradient'
|
||||||
import { type ImagePickerAsset } from 'expo-image-picker'
|
import { type ImagePickerAsset } from 'expo-image-picker'
|
||||||
import { useUpdateProfile } from '@/hooks'
|
import { useUpdateProfile } from '@/hooks'
|
||||||
|
import { KeyboardAwareScrollView, useKeyboardContext, useKeyboardState } from 'react-native-keyboard-controller'
|
||||||
|
import { TextInput } from 'react-native-gesture-handler'
|
||||||
|
|
||||||
|
|
||||||
interface EditProfileDrawerProps {
|
interface EditProfileDrawerProps {
|
||||||
@@ -41,13 +39,14 @@ export default function EditProfileDrawer({
|
|||||||
const [name, setName] = useState(initialName)
|
const [name, setName] = useState(initialName)
|
||||||
const [avatar, setAvatar] = useState<string | undefined>(initialAvatar)
|
const [avatar, setAvatar] = useState<string | undefined>(initialAvatar)
|
||||||
const [selectedImage, setSelectedImage] = useState<ImagePickerAsset | null>(null)
|
const [selectedImage, setSelectedImage] = useState<ImagePickerAsset | null>(null)
|
||||||
const insets = useSafeAreaInsets()
|
|
||||||
|
const keyboardState = useKeyboardState()
|
||||||
|
|
||||||
const { loading, pickImage, updateProfile } = useUpdateProfile()
|
const { loading, pickImage, updateProfile } = useUpdateProfile()
|
||||||
|
|
||||||
// 增加高度以避免被底部 Tab 栏遮挡,考虑底部安全区域
|
// 增加高度以避免被底部 Tab 栏遮挡,考虑底部安全区域
|
||||||
// 使用百分比让 BottomSheet 在键盘弹出时能够自动调整
|
// 使用百分比让 BottomSheet 在键盘弹出时能够自动调整
|
||||||
const snapPoints = useMemo(() => ['50%'], [])
|
const snapPoints = useMemo(() => ['80%'], [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@@ -56,11 +55,21 @@ export default function EditProfileDrawer({
|
|||||||
setName(initialName)
|
setName(initialName)
|
||||||
setAvatar(initialAvatar)
|
setAvatar(initialAvatar)
|
||||||
setSelectedImage(null)
|
setSelectedImage(null)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bottomSheetRef.current?.dismiss()
|
bottomSheetRef.current?.dismiss()
|
||||||
}
|
}
|
||||||
}, [visible, initialName, initialAvatar])
|
}, [visible, initialName, initialAvatar])
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (keyboardState && keyboardState.height) {
|
||||||
|
bottomSheetRef.current?.expand()
|
||||||
|
} else {
|
||||||
|
bottomSheetRef.current?.collapse()
|
||||||
|
}
|
||||||
|
}, [keyboardState])
|
||||||
|
|
||||||
const handleSheetChanges = useCallback((index: number) => {
|
const handleSheetChanges = useCallback((index: number) => {
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
onClose()
|
onClose()
|
||||||
@@ -132,13 +141,7 @@ export default function EditProfileDrawer({
|
|||||||
keyboardBlurBehavior="restore"
|
keyboardBlurBehavior="restore"
|
||||||
android_keyboardInputMode="adjustResize"
|
android_keyboardInputMode="adjustResize"
|
||||||
>
|
>
|
||||||
<BottomSheetScrollView
|
<BottomSheetView style={styles.container}>
|
||||||
style={styles.scrollView}
|
|
||||||
contentContainerStyle={styles.scrollContent}
|
|
||||||
keyboardShouldPersistTaps="handled"
|
|
||||||
showsVerticalScrollIndicator={false}
|
|
||||||
>
|
|
||||||
<View style={styles.container}>
|
|
||||||
{/* 顶部关闭按钮 */}
|
{/* 顶部关闭按钮 */}
|
||||||
<Pressable
|
<Pressable
|
||||||
style={styles.closeButton}
|
style={styles.closeButton}
|
||||||
@@ -173,7 +176,7 @@ export default function EditProfileDrawer({
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 输入框 */}
|
{/* 输入框 */}
|
||||||
<TextInput
|
{/* <BottomSheetTextInput
|
||||||
style={styles.input}
|
style={styles.input}
|
||||||
value={name}
|
value={name}
|
||||||
onChangeText={setName}
|
onChangeText={setName}
|
||||||
@@ -181,9 +184,17 @@ export default function EditProfileDrawer({
|
|||||||
placeholderTextColor="#666666"
|
placeholderTextColor="#666666"
|
||||||
returnKeyType="done"
|
returnKeyType="done"
|
||||||
onSubmitEditing={handleSave}
|
onSubmitEditing={handleSave}
|
||||||
blurOnSubmit={true}
|
|
||||||
editable={!loading}
|
editable={!loading}
|
||||||
/>
|
/> */}
|
||||||
|
|
||||||
|
<TextInput style={styles.input}
|
||||||
|
value={name}
|
||||||
|
onChangeText={setName}
|
||||||
|
placeholder={t('editProfile.namePlaceholder')}
|
||||||
|
placeholderTextColor="#666666"
|
||||||
|
returnKeyType="done"
|
||||||
|
onSubmitEditing={handleSave}
|
||||||
|
editable={!loading}></TextInput>
|
||||||
|
|
||||||
{/* 保存按钮 */}
|
{/* 保存按钮 */}
|
||||||
<Pressable
|
<Pressable
|
||||||
@@ -205,8 +216,8 @@ export default function EditProfileDrawer({
|
|||||||
)}
|
)}
|
||||||
</LinearGradient>
|
</LinearGradient>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</BottomSheetView>
|
||||||
</BottomSheetScrollView>
|
|
||||||
</BottomSheetModal>
|
</BottomSheetModal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -222,15 +233,8 @@ const styles = StyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '#1C1E22',
|
backgroundColor: '#1C1E22',
|
||||||
paddingHorizontal: 16,
|
paddingHorizontal: 16,
|
||||||
},
|
|
||||||
scrollView: {
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
scrollContent: {
|
|
||||||
paddingTop: 32,
|
paddingTop: 32,
|
||||||
paddingBottom: Platform.OS === 'ios' ? 25 : 17,
|
paddingBottom: Platform.OS === 'ios' ? 25 : 17,
|
||||||
paddingHorizontal: 0,
|
|
||||||
flexGrow: 1,
|
|
||||||
},
|
},
|
||||||
closeButton: {
|
closeButton: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
|||||||
@@ -110,17 +110,6 @@ export default function PointsDrawer({
|
|||||||
<View style={styles.balance}>
|
<View style={styles.balance}>
|
||||||
<Text style={styles.balanceValue}>{totalPoints}</Text>
|
<Text style={styles.balanceValue}>{totalPoints}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 积分类型细分 */}
|
|
||||||
<View style={styles.breakdown}>
|
|
||||||
<Text style={styles.breakdownText}>{t('pointsDrawer.subscriptionPoints')}
|
|
||||||
<Text style={styles.breakdownTextValue}>{subscriptionPoints}</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={styles.breakdownTextSeparator} />
|
|
||||||
<Text style={styles.breakdownText}>{t('pointsDrawer.topUpPoints')}
|
|
||||||
<Text style={styles.breakdownTextValue}>{topUpPoints}</Text>
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 底部按钮 */}
|
{/* 底部按钮 */}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default function TopUpDrawer({
|
|||||||
// 获取余额 store 的方法
|
// 获取余额 store 的方法
|
||||||
const { load: loadBalance, restartPolling } = useUserBalanceStore()
|
const { load: loadBalance, restartPolling } = useUserBalanceStore()
|
||||||
|
|
||||||
const snapPoints = useMemo(() => [420], [])
|
const snapPoints = useMemo(() => [500], [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|||||||
@@ -222,7 +222,13 @@
|
|||||||
"agreementText": "I have read and agree to",
|
"agreementText": "I have read and agree to",
|
||||||
"terms": "Terms of Service",
|
"terms": "Terms of Service",
|
||||||
"privacy": "Privacy Policy",
|
"privacy": "Privacy Policy",
|
||||||
"agreementAnd": "and"
|
"agreementAnd": "and",
|
||||||
|
"alipayNotInstalled": "Alipay SDK not installed",
|
||||||
|
"createOrderFailed": "Failed to create order",
|
||||||
|
"paymentSuccess": "Payment successful! Points are being credited...",
|
||||||
|
"paymentCancelled": "Payment cancelled",
|
||||||
|
"paymentFailed": "Payment failed, please try again",
|
||||||
|
"paymentError": "Payment error"
|
||||||
},
|
},
|
||||||
"tabs": {
|
"tabs": {
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
|
|||||||
@@ -222,7 +222,13 @@
|
|||||||
"agreementText": "我已阅读并同意",
|
"agreementText": "我已阅读并同意",
|
||||||
"terms": "服务条款",
|
"terms": "服务条款",
|
||||||
"privacy": "隐私协议",
|
"privacy": "隐私协议",
|
||||||
"agreementAnd": "与"
|
"agreementAnd": "与",
|
||||||
|
"alipayNotInstalled": "支付宝 SDK 未安装",
|
||||||
|
"createOrderFailed": "创建订单失败",
|
||||||
|
"paymentSuccess": "支付成功!积分正在到账中...",
|
||||||
|
"paymentCancelled": "支付已取消",
|
||||||
|
"paymentFailed": "支付失败,请重试",
|
||||||
|
"paymentError": "支付出错"
|
||||||
},
|
},
|
||||||
"tabs": {
|
"tabs": {
|
||||||
"home": "首页",
|
"home": "首页",
|
||||||
|
|||||||
41
stores/editProfileStore.ts
Normal file
41
stores/editProfileStore.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { create } from 'zustand'
|
||||||
|
|
||||||
|
interface EditProfileState {
|
||||||
|
visible: boolean
|
||||||
|
initialName: string
|
||||||
|
initialAvatar?: string
|
||||||
|
onSaveCallback?: (data: { name: string; avatar?: string }) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EditProfileActions {
|
||||||
|
open: (params: {
|
||||||
|
initialName?: string
|
||||||
|
initialAvatar?: string
|
||||||
|
onSave?: (data: { name: string; avatar?: string }) => void
|
||||||
|
}) => void
|
||||||
|
close: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
type EditProfileStore = EditProfileState & EditProfileActions
|
||||||
|
|
||||||
|
export const useEditProfileStore = create<EditProfileStore>((set) => ({
|
||||||
|
visible: false,
|
||||||
|
initialName: '',
|
||||||
|
initialAvatar: undefined,
|
||||||
|
onSaveCallback: undefined,
|
||||||
|
|
||||||
|
open: ({ initialName = '', initialAvatar, onSave }) => {
|
||||||
|
set({
|
||||||
|
visible: true,
|
||||||
|
initialName,
|
||||||
|
initialAvatar,
|
||||||
|
onSaveCallback: onSave,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
close: () => {
|
||||||
|
set({
|
||||||
|
visible: false,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}))
|
||||||
Reference in New Issue
Block a user