在react native中,当我使用Image
组件时,我有很多图像要显示。
<Image source={{ uri: 'https://img.google.com/1.jpg' }} />
<Image source={{ uri: 'https://img.google.com/2.jpg' }} />
<Image source={{ uri: 'https://img.google.com/3.jpg' }} />
........
非常平滑的
但是当加载本地缓存文件时
<Image source={{ uri: '/Users/Username/../1.jpg' }} />
<Image source={{ uri: '/Users/Username/../2.jpg' }} />
<Image source={{ uri: '/Users/Username/../3.jpg' }} />
........
手机会变得非常慢,尤其是IOS,甚至会导致崩溃
导致我无法使用模块react-native-cached-image
和react-native-img-cache
我试着用react-native-fast-image
替换Image
,但效果稍微好一点。
我该怎么办?帮我
ScrollView添加removeClippedSubviews={true}修复