Reputation: 838
I am working on an application where I have lot of images and icons(all png), I found out that the image folder's total size is close to 15MB, which is too much, as I am new to react-native so not sure how this size is impacting the total app size and also I am not sure about the best way to reduce this folder size(i.e., images/icons), should I use svg or any other format for this or is there any other way(i.e., compressing the image/icon size etc.)?
I can see that we can't able to use svg directly, we need to use some library and I don't want to burden my app with any libraries as it's already quite heavy
Thanks and looking for the best solution
Upvotes: 1
Views: 1366
Reputation: 21
Compress all images at build time using react-native-imagemin-asset-plugin
Upvotes: 1
Reputation: 3373
You have three options to minimize your image assets bundle size.
Using an image URL - instead of storing images on your app. You can upload images to a server and refer the link to App. some image provider servers.
Using SVG - you said that you don't want to include any libraries check the bundle size of react-native-svg
it's a pretty lightweight package.
Use any image compressor - compress your image and use it. you can use
Upvotes: 2