feat: 重构测试结构并添加动态表单组件

主要更改:
- 重构测试文件结构,删除旧的测试文件并添加新的测试覆盖
- 添加 DynamicForm 组件及其测试
- 更新 Jest 配置以支持新的测试结构
- 更新组件、抽屉和国际化文件

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
imeepos
2026-01-19 14:31:48 +08:00
parent 6e85460b2e
commit 1fc79d29ed
23 changed files with 3425 additions and 1232 deletions

View File

@@ -1,4 +1,4 @@
import { useState, useRef, useEffect, useCallback, memo } from 'react'
import React, { useState, useRef, useEffect, useCallback, memo } from 'react'
import {
View,
Text,
@@ -76,7 +76,7 @@ const calculateImageSize = (
: { width: videoHeight * imageAspectRatio, height: videoHeight }
}
const VideoItem = memo(({ item, videoHeight }: { item: TemplateDetail; videoHeight: number }) => {
export const VideoItem = memo(({ item, videoHeight }: { item: TemplateDetail; videoHeight: number }) => {
const { t } = useTranslation()
const router = useRouter()
const [imageSize, setImageSize] = useState<{ width: number; height: number } | null>(null)
@@ -91,14 +91,14 @@ const VideoItem = memo(({ item, videoHeight }: { item: TemplateDetail; videoHeig
const handlePress = useCallback(() => {
router.push({
pathname: '/generateVideo' as any,
params: { template: JSON.stringify(item) },
params: { templateId: item.id },
})
}, [router, item])
}, [router, item.id])
const imageStyle = calculateImageSize(imageSize, videoHeight)
// 优先使用 WebP 格式(支持动画),回退到普通预览图
const displayUrl = item.webpPreviewUrl || item.previewUrl
const displayUrl = item.webpHighPreviewUrl || item.webpPreviewUrl || item.previewUrl
return (
<View style={[styles.videoContainer, { height: videoHeight }]}>