feat: 重构测试结构并添加动态表单组件
主要更改: - 重构测试文件结构,删除旧的测试文件并添加新的测试覆盖 - 添加 DynamicForm 组件及其测试 - 更新 Jest 配置以支持新的测试结构 - 更新组件、抽屉和国际化文件 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState, useRef, useMemo, useCallback, useEffect } from 'react'
|
||||
import React, { useState, useRef, useMemo, useCallback, useEffect } from 'react'
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
@@ -20,9 +20,9 @@ interface UploadReferenceImageDrawerProps {
|
||||
onSelectImage?: (imageUri: any) => void
|
||||
}
|
||||
|
||||
type TabType = 'ai-record' | 'recent'
|
||||
type TabType = 'ai-record' | 'recent' | 'project'
|
||||
|
||||
// 模拟图片数据
|
||||
// 模拟图片数据(保留用于兼容)
|
||||
const mockImages = Array.from({ length: 120 }, (_, i) => ({
|
||||
id: i + 1,
|
||||
uri: require('@/assets/images/android-icon-background.png'),
|
||||
@@ -158,6 +158,20 @@ export default function UploadReferenceImageDrawer({
|
||||
{t('uploadReference.recentUsed')}
|
||||
</Text>
|
||||
</Pressable>
|
||||
<Pressable
|
||||
style={[styles.tab, activeTab === 'project' && styles.tabActive]}
|
||||
onPress={() => {
|
||||
setActiveTab('project')
|
||||
setAiRecordDrawerVisible(true)
|
||||
}}
|
||||
>
|
||||
<View style={styles.tabIconContainer}>
|
||||
<View style={styles.tabIconFolder} />
|
||||
</View>
|
||||
<Text style={[styles.tabText, activeTab === 'project' && styles.tabTextActive]}>
|
||||
{t('uploadReference.recentProject')}
|
||||
</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
|
||||
{/* 筛选区域 */}
|
||||
@@ -238,7 +252,13 @@ export default function UploadReferenceImageDrawer({
|
||||
onSelectImage={(imageUri) => {
|
||||
handleImageSelect(imageUri)
|
||||
}}
|
||||
type={activeTab}
|
||||
type={
|
||||
activeTab === 'project'
|
||||
? selectedFilter === 'all'
|
||||
? 'project-all'
|
||||
: 'project-face'
|
||||
: activeTab
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
@@ -311,6 +331,12 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 6,
|
||||
backgroundColor: '#4A4C4F',
|
||||
},
|
||||
tabIconFolder: {
|
||||
width: 24,
|
||||
height: 24,
|
||||
borderRadius: 4,
|
||||
backgroundColor: '#4A4C4F',
|
||||
},
|
||||
tabText: {
|
||||
color: '#F5F5F5',
|
||||
fontSize: 12,
|
||||
|
||||
Reference in New Issue
Block a user