fix: remove lazy load

This commit is contained in:
Junhui Chen 2025-07-31 20:40:53 +08:00
parent 8efed74b92
commit 935753f6b3

View File

@ -6,11 +6,11 @@ import { FlatList, InteractionManager, PixelRatio, Platform, RefreshControl, Sty
import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { useSafeAreaInsets } from 'react-native-safe-area-context';
// 懒加载组件 // 懒加载组件
const ChatSvg = React.lazy(() => import('@/assets/icons/svg/chat.svg')); import ChatSvg from '@/assets/icons/svg/chat.svg';
const AskNavbar = React.lazy(() => import('@/components/layout/ask')); import AskNavbar from '@/components/layout/ask';
const UploaderProgress = React.lazy(() => import('@/components/file-upload/upload-progress/uploader-progress')); import UploaderProgress from '@/components/file-upload/upload-progress/uploader-progress';
const SkeletonItem = React.lazy(() => import('@/components/memo/SkeletonItem')); import SkeletonItem from '@/components/memo/SkeletonItem';
const ErrorBoundary = React.lazy(() => import('@/components/common/ErrorBoundary')); import ErrorBoundary from '@/components/common/ErrorBoundary';
// 类型定义 // 类型定义
import { useUploadManager } from '@/hooks/useUploadManager'; import { useUploadManager } from '@/hooks/useUploadManager';
@ -34,9 +34,7 @@ const preloadAssets = async () => {
const SkeletonList = () => ( const SkeletonList = () => (
<View style={styles.skeletonContainer}> <View style={styles.skeletonContainer}>
{Array(5).fill(0).map((_, index) => ( {Array(5).fill(0).map((_, index) => (
<React.Suspense key={`skeleton-${index}`} fallback={null}> <SkeletonItem key={`skeleton-${index}`} />
<SkeletonItem />
</React.Suspense>
))} ))}
</View> </View>
); );
@ -145,13 +143,11 @@ const MemoList = () => {
activeOpacity={0.7} activeOpacity={0.7}
> >
<View className="w-[3rem] h-[3rem] z-1"> <View className="w-[3rem] h-[3rem] z-1">
<React.Suspense fallback={<View style={styles.placeholderIcon} />}> <ChatSvg
<ChatSvg width="100%"
width="100%" height="100%"
height="100%" preserveAspectRatio="xMidYMid meet"
preserveAspectRatio="xMidYMid meet" />
/>
</React.Suspense>
</View> </View>
<View style={styles.memoContent}> <View style={styles.memoContent}>
<Text <Text
@ -180,9 +176,7 @@ const MemoList = () => {
</Text> </Text>
{/* 上传进度 */} {/* 上传进度 */}
<React.Suspense fallback={null}> <UploadProgressSection />
<UploadProgressSection />
</React.Suspense>
</View> </View>
), [insets.top]); ), [insets.top]);
@ -226,9 +220,7 @@ const MemoList = () => {
return ( return (
<View style={[styles.container, { paddingTop: insets.top }]}> <View style={[styles.container, { paddingTop: insets.top }]}>
<SkeletonList /> <SkeletonList />
<React.Suspense fallback={null}> <AskNavbar />
<AskNavbar />
</React.Suspense>
</View> </View>
); );
} }
@ -267,9 +259,6 @@ const MemoList = () => {
/> />
{/* 底部导航栏 */} {/* 底部导航栏 */}
<React.Suspense fallback={null}>
<AskNavbar />
</React.Suspense>
</View> </View>
</ErrorBoundary> </ErrorBoundary>
); );