Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

IonImg, ion-img ionImgDidLoad event not firing

$
0
0

@jamiechong wrote:

I’m trying to add a loaded class to IonImg when the image loads. According to docs I should be able to listen to a ionDidLoad event. But it doesn’t seem to trigger.

This is the simple component I’ve created:

const LazyImage = ({src}) => {
  const [ loaded, setLoaded ] = useState();
  return <IonImg src={src} onImgDidLoad={() => setLoaded('loaded')} className={loaded} />
}

Note that I’m using onImgDidLoad instead of ionImgDidLoad as it seems the convention for react is to drop the i for events? I’ve tried both, neither work.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>