appbaseio / reactivesearch

Search UI components for React and Vue
https://opensource.appbase.io/reactivesearch
Apache License 2.0
4.89k stars 466 forks source link

What is the best way to show loading or side effect #422

Closed lan-nguyen91 closed 6 years ago

lan-nguyen91 commented 6 years ago

Issue Type: Suggestion

Platform: Native

Description: How to show Loading when processing search

Reactivesearch version: 0.8.0

Hi team, and thanks for this awesome module

I am running into scenario, where if my search comeback with empty data, I would like to display a not found Component. Something like :arrow_double_down:

no_result

I can use the hook onAllData, and check the result length, not sure if that is the best solution.

Also if I use onAllData, there is a second or two delay after searching, so ideally I want to display a spinner, what would be the best way to accomplish this. I know there is a loading for infinite scroll for web version, but im not sure if I can do something similar for native.

siddharthlatest commented 6 years ago

Hi @lan-nguyen91, you can do both of those using the following props: loader to load the data and onNoResults to render JSX of your choice when no results are found. You can find more info on the props here - https://opensource.appbase.io/reactive-manual/result-components/reactivelist.html#props.

siddharthlatest commented 6 years ago

I just saw that you filed this issue for Native. I am not sure if we support these props over there yet, but we would very much like to. cc @metagrover

lan-nguyen91 commented 6 years ago

@siddharthlatest yes it is in the native codebase now that I checked the code. It is just not release and documented yet. Thanks :)

metagrover commented 6 years ago

Thanks for pointing this out. We will do a native release shortly.