react-native - react-native 中如何优雅的管理图片资源?
问题描述
我有很多图片要在很多屏幕上管理。每次我加载图片时
<Image source={require("../../images/001.png")} style={styles.image1}/>
但是它太乏味了,因为它要编写的内容太多并且难以管理。
我想一起管理图像。像
export default function loadImages(){
return {
img1:require("../../images/001.png"),
img2:require("../../images/002.png"),
...
}
}
然后像这样使用它。
import Images from "image.js"
<Image source={Images.img1} />
但是我担心返回的对象会太大并且占用太多的内存资源。会是吗?有人有一些优雅的解决方案吗?
解决方案
推荐阅读
- ignite-ui - 使用 Ignite Grid 列标题中的输入控件
- kiwi-tcms - 从 v6.4 迁移到 v7.2 失败,并显示“列 'execution_id' 不能为空”
- java - 如何运行构建后生成的maven项目的jar文件?
- reactjs - 有什么方法可以让我知道在 Ag -grid 中滚动时是否已到达记录的末尾?
- javascript - 使用多个 Google 自动完成时出现“未定义”
- php - 为网站上的每个页面添加标识符
- javascript - 使用 MatterJS 防止强制拖动物体穿过其他物体
- html - 如何在 Vue Cli 生成的 WPA 项目的标题内编辑自动注入的网站图标标签?
- docker - 如何使用 docker 将 metricbeat 连接到 elasticsearch 和 kibana
- c++ - 如果输入偶数,C++ 中的显示问题