ladjs / react-native-loading-spinner-overlay

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

Stuck in IOS #72

Closed vyasishanatc194 closed 5 years ago

vyasishanatc194 commented 5 years ago

When alert and spinner overlay working together,

alter will dismiss but spinner overlay stuck and nothing happened.

cedoucette commented 5 years ago

I'm having this exact same issue. For some reason, it only fails on an iPad, not on an iPhone.

hanyuei commented 5 years ago

same issue here. (works on Android, but not work on IOS)

sryze commented 5 years ago

I'm working on a patch for this issue: https://github.com/facebook/react-native/pull/22666, you are welcome to try it out

hery commented 5 years ago

Hello! Same issue here, even without using an Alert though. I've made sure to include the Spinner only in my top-level screen, but I still occasionally get a sticky spinner.

Something interesting to note is that it doesn't happen in Debug and Release builds that I build on my device, but it seems to only affect Fabric Crashlytics ad-hoc builds we deploy remotely.

This is super weird. Keeping an eye out for a fix.

just4fun commented 5 years ago

Is there any workaround? Currently this issue will make the app frozen, users can only exit the app then open it again.

hanyuei commented 5 years ago

@just4fun you could add a delay to alert as workaround.

global.alert = (message, title) => {
  setTimeout(() => Alert.alert(title || "Oops!", message), 500);
};
just4fun commented 5 years ago

@zhuang17 - Thanks, it seems like Alert and Modal are running in same event loop then cause the issue? I remembered Modal will not be supported soon in React Native, so for long term, I think the best solution is to replace Modal with something like the modal in react navigation.

amireds commented 5 years ago

do we have any fix for this right now

hery commented 5 years ago

What if I'm not using an Alert, and only have a spinner in the topmost component? Any idea why I get that sticky spinner sometimes?

On 12 Jan 2019, at 15:10, Tailor at Hand notifications@github.com wrote:

do we have any fix for this right now

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

just4fun commented 5 years ago

My solution for this issue is to replace Alert(IOS) with another message library like react-native-message-bar, instead of using wired workaround setTimeout which may has timing issue.

JeffGuKang commented 5 years ago

Make spinner hidden after pressing Alert buttons. I think it is the safe and easy way on now.

Alert.alert("!!!", "Error", [
    { text: "OK", onPress: () => this.setState({ spinner: false }) }
]);
niftylettuce commented 5 years ago

PR accepted. Please provide a reproducible test case.