fix: 修复所有 TypeScript 类型错误

- 修复 webpPreviewUrl -> previewUrl 字段名错误
- 修复 video.tsx 中的 useTemplates 参数类型问题
- 修复 video.tsx 中 position 重复定义问题
- 修复 searchResults.tsx 中的 SearchResultItem 类型不匹配
- 修复 SearchResultsGrid.tsx 中不存在的 scrollContent 样式
- 修复 use-templates.ts 中 page 可能是 undefined 的类型问题
- 添加 tsconfig.json 的 exclude 配置
- 修复 use-template-actions.ts 中 null 不能赋值给 ApiError 的问题

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
imeepos
2026-01-16 12:14:04 +08:00
parent ae120f24d3
commit 4d1e901032
7 changed files with 406 additions and 343 deletions

View File

@@ -10,63 +10,38 @@ import { useRouter, useLocalSearchParams } from 'expo-router'
import SearchResultsGrid from '@/components/SearchResultsGrid'
import SearchBar from '@/components/SearchBar'
import type { TemplateGeneration } from '@/hooks'
const createMockResult = (id: string, height: number): TemplateGeneration & { height: number; title: string; image: any } => ({
id,
userId: 'test',
templateId: `template-${id}`,
type: 'VIDEO',
resultUrl: [],
status: 'completed',
createdAt: new Date(),
updatedAt: new Date(),
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height,
template: {
id: `template-${id}`,
title: '猫咪圣诞写真',
titleEn: 'Cat Christmas',
coverImageUrl: '',
},
})
// 搜索结果数据
const searchResults = [
{
id: 1,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 236,
},
{
id: 2,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 131,
},
{
id: 3,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 236,
},
{
id: 4,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 236,
},
{
id: 5,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 95,
},
{
id: 6,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 236,
},
{
id: 7,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 228,
},
{
id: 8,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 95,
},
{
id: 9,
title: '猫咪圣诞写真',
image: require('@/assets/images/android-icon-background.png'),
height: 228,
},
createMockResult('1', 236),
createMockResult('2', 131),
createMockResult('3', 236),
createMockResult('4', 236),
createMockResult('5', 95),
createMockResult('6', 236),
createMockResult('7', 228),
createMockResult('8', 95),
createMockResult('9', 228),
]
export default function SearchResultsScreen() {
@@ -79,13 +54,10 @@ export default function SearchResultsScreen() {
<StatusBar style="light" />
<RNStatusBar barStyle="light-content" />
{/* Top Bar with Search */}
<SearchBar
searchText={searchText}
onSearchTextChange={setSearchText}
onSearch={(text) => {
// 搜索结果页面的搜索按钮可以保持当前页面或执行搜索
}}
onSearch={(text) => {}}
onBack={() => router.back()}
readOnly={true}
onInputPress={() => {
@@ -103,7 +75,6 @@ export default function SearchResultsScreen() {
marginBottom={12}
/>
{/* 搜索结果网格 */}
<SearchResultsGrid results={searchResults} />
</SafeAreaView>
)
@@ -115,4 +86,3 @@ const styles = StyleSheet.create({
backgroundColor: '#090A0B',
},
})