There seems to be no problem with LOADING the images. But there is a problem after they are already loaded.
In my app I load card images one by one throughout the game. Once I get to a point that I loaded 40 card images, the whole app becomes slow. It always happens at the 40th image, and when I continue loading more card images after the 40th, it becomes slower after each image load.
Practical details:
- React native with expo
- Requiring Images from Local folder into an array and importing that array.
- Single Image size between 15KB - 120KB, all images together: 3.1MB
- Component used for displaying the image:
Image(react native simple image component) - Using
Array.mapto display all images
Switching all the images with ugly images with a total of 300KB - makes the app run fast without any problem
The required array imported:
const CardsUris = [
{uri:require('../assets/AC.png'), key:'AC'},
{uri:require('../assets/AD.png'), key:'AD'},
{uri:require('../assets/AH.png'), key:'AH'},
{uri:require('../assets/AS.png'), key:'AS'}...
]
Component tree structure:
- Base
- Container
- <Image source={CardsUris[index].uri} />
Is there a way I can troubleshoot this problem? I couldn't find anything about such a problem that appears after loading the images.