react-native-activity-feed icon indicating copy to clipboard operation
react-native-activity-feed copied to clipboard

[Feature Request] Placeholder prop for FlatFeed

Open jasonwonghl opened this issue 5 years ago • 7 comments

Could we have a Placeholder prop for FlatFeed component, much like react-activity-feed's FlatFeed component, such that if initial data has been requested and the response is empty, the Placeholder component will load?

Alternatively, a loading indicator prop to show a loader on initial request.

jasonwonghl avatar Dec 09 '19 10:12 jasonwonghl

Hi @jasonwonghl .

There is a prop called flatListProps in FlatFeed. You can override every props coming from FlatList. You can use ListEmptyComponent key inside your object: (https://facebook.github.io/react-native/docs/flatlist#listemptycomponent).

Here is an example

 <FlatFeed
                ...
                flatListProps={{
                  ListEmptyComponent: <FeedPlaceHolder />,
                }} 
/>

asvine-p avatar Dec 12 '19 16:12 asvine-p

Thanks @asvine-p

I'm already using that to display a placeholder if the list is empty. However it shows while the feed is still initially loading and that is undesired behaviour for me. I was wondering if there is a way to show a custom loader.

jwonghl avatar Dec 13 '19 01:12 jwonghl

@asvine-p The problem comes from the fact that the empty placeholder content shows briefly before the content loads. So from a ui it shows [No Results Message] => [Content]. This isn't a nice experience at all. It should show a loading state before it loads the content in first time. Only after it has returned data, should it decide whether or not to show the empty placeholder.

nzerk avatar Dec 16 '19 06:12 nzerk

@nzerk @jwonghl I see. Maybe some developper of this lib can help you, I admit, it's not easy to have control over the requests and it's behavior.

asvine-p avatar Dec 16 '19 09:12 asvine-p

Any news on this?

AdamGold avatar Mar 23 '20 15:03 AdamGold

+1, would be awesome if this was supported!

giaset avatar Apr 28 '20 22:04 giaset

Any news on this?

any updates on handling the empty field?

yumoraby avatar Jun 30 '21 05:06 yumoraby