Closed pantchox closed 5 years ago
:+1: to this request. When loading multiple tweets at once if you know their text (e.g. have it from an API), it helps to show the text while the tweets load.
Hi,
I don't understand you comment as a solution can you please clarify with an example. My solution was a "hack"
import {TwitterTweetEmbed} from 'react-twitter-embed';
...
const {error, loading} = this.state;
...
{loading && <YourLoaderHere />
{!error && <TwitterTweetEmbed
tweetId={tweetId}
options={{width: 'auto'}}
onLoaded={(el) =>
(el ? this.setState({loading: false}) : this.setState({loading: false, error: true}))} />}
I was checking if the element was valid on the DOM if not I assume error happened, I checked this with giving invalid tweetId or creating a tweet and then intentional delete it to check.
@pantchox: please reopen the issue, as there is no solution. We also use a wrapper component on our site, and it would be nice to have the placeholder functionality built into this library.
The competing library react-tweet-embed has implemented this feature already but I can't get it to work.
@dandv @pantchox Yes. Its definitely a must have feature. We should definitely have it. So to address that I am opening a PR shortly.
Hello,
Wanted to know if there is an option to pass a component as a prop to show until the tweet is loaded.
thanks.