Replies: 5 comments
-
Edit: I tried to hide the splash screen when headless and thought it was fixed but it actually wasn't - using expo-splash-screen it actually throws an error when trying to hide the splash screen in headless mode. |
Beta Was this translation helpful? Give feedback.
-
Just to note, I tried upgrading to Expo SDK 51 and the issue still remains. Edit: I tested it again and it seems to work fine if I have many apps open in the background, iOS must kill my app sooner in that case (I waited 1 minute). However if I have no apps open in the background, the issue still remains even after 5 minutes of waiting. |
Beta Was this translation helpful? Give feedback.
-
So I ended up switching to light + dark splash screens to overcome the "white flash" when showing the splash screen manually (previously only had dark), and now that I know iOS will quit the app when headless, this is less of a concern to me now. I thought something was broken when the app was still "warm" 30 minutes after receiving a message when in the "quit" state, but I guess iOS just leaves the app running if no other apps are competing for resources. |
Beta Was this translation helpful? Give feedback.
-
Okay so another issue is when transitioning from Headless to Non-Headless, is that the system color scheme isn't being respected and is always returning "light". Edit: I found a relevant bug report which links to this PR facebook/react-native#46021 which thankfully resolved the color scheme issue. |
Beta Was this translation helpful? Give feedback.
-
I'm content with where things are at now to close this. Hopefully this back and forth I had with myself is helpful to someone 😆. |
Beta Was this translation helpful? Give feedback.
-
Right now, my iOS app is handling background notifications, but after the message is processed, the app remains "open" (in headless mode) for an extended period of time.
For example, when I finally open the app 30 minutes after receiving a message, I can see an in-memory log indicating the app was launched in Headless mode 30 minutes earlier and that the background message was handled. Shouldn't the OS kill the app after around 30 seconds?
The issue that arises from this is instead of the splash screen appearing, a blank white screen is displayed for a few seconds until the app is ready to render. Before I added the
isHeadless
check, my app would get completely stuck on the white screen.I've implemented a workaround by manually showing the splash screen image using
<Image />
, but there's still a brief flash of a white screen before the image is shown. Plus it introduces a minor maintenance headache having two places to update the splash screen (background color fallback mainly).Currently, I have the following Background Mode capabilities enabled: Background Fetch and Remote Notification.
Any idea what could be causing the app to keep running in headless mode?
Thanks for your help!
I'm using these dependencies (among others) on an Expo "bare" React Native project:
My
index.tsx
file:And a snippet of my
App.tsx
snippet to show how the splash screen is handled:Beta Was this translation helpful? Give feedback.
All reactions