duguyihou / react-native-turbo-image

Performant image component for React Native
https://www.npmjs.com/package/react-native-turbo-image
MIT License
130 stars 6 forks source link

is it possible to Override global imageLoader? #272

Open vokhuyetOz opened 2 months ago

vokhuyetOz commented 2 months ago

Is your feature request related to a problem? Please describe. it would be useful if we can register all components (decoders) at initialize instead of add it manually when load ImageURl. use this one we can remove format property.

Describe the solution you'd like have no idea now?

duguyihou commented 2 months ago

To be honest, I don't know the performance if we register all decoders. From my understanding, the aim of Nuke or Coil is to handle image loading and caching. Supporting special formats is a bonus. Even though Coil officially provides extensions for Gif and SVG, we still need to add it manually. For Nuke, it does not provide decoders officially. Besides, not all the apps need special format images. Let me know your thoughts 😄

vokhuyetOz commented 2 months ago

i checked on coil/image_pipeline/, it said Custom components must be added to the ImageLoader when constructing it through its ComponentRegistry. So i think it will not cause performance problems. of course we don't need to add all decoders to imageLoader by default, but if we can ask library to add some specials decoder as we want in initialize, it would be great. Sometimes, we don't know if our image is Gif or normal type.

duguyihou commented 2 months ago

yeah, I agree. It may be silly to set format manually. It is not elegant.

duguyihou commented 1 month ago

@vokhuyetOz

maybe we can use newBuilder in Android side to override imageLoader.

image
vokhuyetOz commented 3 weeks ago

Ok, I see I'll check it out at the weekend