justinmahar / react-social-media-embed

📰 Easily embed social media posts from Facebook, Instagram, LinkedIn, Pinterest, TikTok, X (Twitter), and YouTube in React.
https://justinmahar.github.io/react-social-media-embed/
MIT License
228 stars 30 forks source link

way to receive loading state of the embed #28

Open Light-Wing opened 1 year ago

Light-Wing commented 1 year ago

I'm using these embeds in a Swiper.js carousel, and loading on user request... I want to adjust the height of the swiper container after it finishes loading (swiper changes the height, but only onces when the slide comes into screen, and this causes the embed to get cut off)

what i thought, is to get the loading state of the embed, and when its done, to tell swiper to fix the height based on current content..

but i couldn't find how to get the onLoad or ready event or anything else that will allow for that change... i would also like to receive the error in case the embed fails to load, and then return the normal UI...

any ideas will be appreciated, thank you. this is an amazing all-in-one🙏

justinmahar commented 1 year ago

Related to https://github.com/justinmahar/react-social-media-embed/issues/11