ladjs / react-native-loading-spinner-overlay

:barber: React Native loading spinner overlay
MIT License
1.59k stars 173 forks source link

Dismissing spinner also dismisses modal #110

Open elsurudo opened 3 years ago

elsurudo commented 3 years ago

On a promise resolution from a fetch call, I do two things:

  1. Hide the spinner by setting a state variable bound to `<Spinner visible={myVar} ... />
  2. Display a react-native-navigation modal using Navigation.showModal(...)

I have found that having (1) here means the modal is immediately hidden, right after being presented.

Any ideas what could be going wrong here, and how these two things can be reconciled?

I tried a setTimeout with low timeout > 0 and it works... sometimes. So it leads to non-deterministic behaviour.

luatvudinh commented 3 years ago

Same issue here!!!!!

elsurudo commented 3 years ago

FYI I wasn't able to resolve this any other way, and simply stopped using this library.

I ended up simply creating my own overlay, and simply displaying is as an Overlay with react-native-navigation, which ended up being really easy.

elsurudo commented 3 years ago

Here's a gist of my code which you could adapt: https://gist.github.com/elsurudo/0cc2edb118d63370f086cb5a8b1b0e00

You would just need to register the component in the typical RNN way.