react-native-webp-format icon indicating copy to clipboard operation
react-native-webp-format copied to clipboard

Image.getSize() always returns 0 on iOS when used the webP images

Open vikasg603 opened this issue 5 years ago • 1 comments

Image.getSize() always returns 0 width and 0 height.

Can anyone know how to fix this up?

vikasg603 avatar Dec 03 '20 11:12 vikasg603

Anyone ? :)

The library react-native-image-zoom uses Image.getSize() as well but it does return width=0 and height=0 when using webp on ios <14.

I have no knowledge of how this librarie work but could it be possible to "overload"/"change" how the getSize function work, so it can find webp dimensions as well ?

ACHP avatar Jul 05 '21 09:07 ACHP

You need to use: const {width, height} = Image.resolveAssetSource(require('./assets/1.sm.webp'));

instead of Image.getSize()

Aleksefo avatar Apr 04 '23 15:04 Aleksefo