react-native-activity-feed
react-native-activity-feed copied to clipboard
[Feature Request] Placeholder prop for FlatFeed
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.
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 />,
}}
/>
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.
@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 @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.
Any news on this?
+1, would be awesome if this was supported!
Any news on this?
any updates on handling the empty field?