wellyshen / react-cool-img

😎 🏞 A React <Img /> component let you handle image UX and performance as a Pro!

Home Page:https://react-cool-img.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

this.img.decode is not a function

tong233 opened this issue · comments

commented

Bug Report

Describe the Bug

Hi,
getting the error in Android:
this.img.decode is not a function
User Agent:
Mozilla/5.0 (Linux; U; Android 9; zh-CN; MZ-16s Pro Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.97 MZBrowser/8.7.0 Mobile Safari/537.36

When I change another browser ,no error but get blank img
Quark browser User Agent:
Mozilla/5.0 (Linux; U; Android 9; zh-CN; 16s Pro Build/PKQ1.190616.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 Quark/3.8.5.129 Mobile Safari/537.36

Additional Information

console.log(window.IntersectionObserver) has value

@tong233 Can you turn off the decode from options to see whether the error goes away.

commented

thank you, error is gone. still have blank bug.

@tong233 Does it work well on Google Chrome? Sorry I don't have Android device, so I need your help for debugging.

commented

@wellyshen Chrome 80 and Safari does work well, may be my browser with Chrome kernel version 57 is too low. Sorry you can ignore it. In addition, would you consider compatibility img.decode()? don't use it without support.

@tong233 I also think about it. But I'm not sure if the root cause is from img.decode() or Image API itself. Would you mind to help me figure it out (here's the related file).

commented

@wellyshen I'm sure is img.decode() because console.log(img.decode) get undefined on chrome 62.Look at MDN chrome need higher than 64. I think just add if (decode && this.img.decode) on line 26

This happens in Microsoft Edge browser as well. Setting decode: false works.

Thank you guys. This issue has been fixed via v1.0.17. However I'd recommend you to use the latest version.