You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[🐛] messaging on iOS on new architecture needs updated docs / implementation to handle isHeadless / quit state #8217
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleName = @"gk_research_app_staging";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
// self.initialProps = @{};
// return [super application:application didFinishLaunchingWithOptions:launchOptions];
self.initialProps = [RNFBMessagingModule addCustomPropsToUserProps:nil withLaunchOptions:launchOptions];
[FIRApp configure];
[application registerForRemoteNotifications];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
I have a problem for iOS device - when the app is in quit state and receives a notification, after a few seconds, I click the notification which makes the app open, but nothing is shown. I know it's because of "if (isHeadless) return null;".
The following logs are in my console:
When the app is opened(foreground/background):
Running "test_app" with {"rootTag":1,"initialProps":{"concurrentRoot":true,"isHeadless":false},"fabric":true}
When the app is quit and receives a notification, the bundle is re-generated:
Running "test_app" with {"rootTag":1,"initialProps":{"concurrentRoot":true,"isHeadless":true},"fabric":true}
When re-open the app or open the app by the notification, the bundle is not regenerated and keep the last state:
Running "test_app" with {"rootTag":1,"initialProps":{"concurrentRoot":true,"isHeadless":true},"fabric":true}
This issue does not happen when the app is already open, no matter if it is in foreground or background state, because the bundle will not be re-generated.
To make the app UI display, I need to exit the app and open the app again which cause the bundle re-generated:
Running "test_app" with {"rootTag":1,"initialProps":{"concurrentRoot":true,"isHeadless":false},"fabric":true}
changed the title [-][🐛] Bug Report Title - CHANGE ME [/-][+][🐛] Bug Report - App displays nothing if receives a notification in quit state[/+]on Jan 8, 2025
changed the title [-][🐛] Bug Report - App displays nothing if receives a notification in quit state[/-][+][🐛] Bug Report [react-native-firebase/messaging] - App displays nothing if receives a notification in quit state[/+]on Jan 11, 2025
changed the title [-][🐛] Bug Report [react-native-firebase/messaging] - App displays nothing if receives a notification in quit state[/-][+][🐛] Bug Report [react-native-firebase/messaging] - App displays nothing if receives a notification in quit state for iOS[/+]on Jan 11, 2025
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Indeed it worked for us with a similar workaround, only from our tests it seems we also need to run a useEffect for the initial value, it seems there are some cases when shouldRenderUI will still be wrongly false without it.
functionHeadlessCheck({ isHeadless }){const[shouldRenderUI,setShouldRenderUI]=useState(!isHeadless);// Workaround for iOS not providing the headless parameter// https://github.com/invertase/react-native-firebase/issues/8248#issuecomment-2686603423constheadlessCheck=useCallback(async()=>{if(Platform.OS==='ios'){constisHeadlessValue=awaitgetIsHeadless(getMessaging());setShouldRenderUI(!isHeadlessValue);}},[]);React.useEffect(()=>{headlessCheck();},[]);useOnAppChange(headlessCheck);returnshouldRenderUI ? <App/> : null;}
But this may seem to be more of a workaround to the problem instead of a proper solution, since basically isHeadless is unused at all, the best fix for this I see is that the isHeadless be correctly set from the native side but don't know what implications there are to do that.
@tux2nicolae sorry for resurrecting this old issue, but I'm scanning things that went stale without response.
I notice in your workaround useOnAppChange and getIsHeadless are methods not defined in the code you posted. What is the definition for those methods? This could form the basis of a complete solution for new architecture
Sure, the useOnAppChange() hook is an internal hook that actually should be called more like useOnActiveAppState but for historical we did not renamed it yet.
changed the title [-][🐛] Bug Report [react-native-firebase/messaging] - App displays nothing if receives a notification in quit state for iOS[/-][+][🐛] messaging on iOS on new architecture needs updated docs / implementation to handle isHeadless / quit state[/+]on Jan 29, 2026
Activity
[-][🐛] Bug Report Title - CHANGE ME [/-][+][🐛] Bug Report - App displays nothing if receives a notification in quit state[/+]aliceni81 commentedon Jan 9, 2025
@mikehardy Can you please help? Much appreciated!
[-][🐛] Bug Report - App displays nothing if receives a notification in quit state[/-][+][🐛] Bug Report [react-native-firebase/messaging] - App displays nothing if receives a notification in quit state[/+][-][🐛] Bug Report [react-native-firebase/messaging] - App displays nothing if receives a notification in quit state[/-][+][🐛] Bug Report [react-native-firebase/messaging] - App displays nothing if receives a notification in quit state for iOS[/+]github-actions commentedon Feb 24, 2025
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions.
bean2307 commentedon May 15, 2025
+1 same issue
tux2nicolae commentedon Sep 14, 2025
I do have the same issue on new architecture, can you consider reopening this issue?
aliceni81 commentedon Sep 16, 2025
Please refer to #8248 (comment)
tux2nicolae commentedon Sep 16, 2025
@aliceni81 thank you.
Indeed it worked for us with a similar workaround, only from our tests it seems we also need to run a useEffect for the initial value, it seems there are some cases when shouldRenderUI will still be wrongly
falsewithout it.But this may seem to be more of a workaround to the problem instead of a proper solution, since basically
isHeadlessis unused at all, the best fix for this I see is that theisHeadlessbe correctly set from the native side but don't know what implications there are to do that.mikehardy commentedon Jan 29, 2026
@tux2nicolae sorry for resurrecting this old issue, but I'm scanning things that went stale without response.
I notice in your workaround
useOnAppChangeandgetIsHeadlessare methods not defined in the code you posted. What is the definition for those methods? This could form the basis of a complete solution for new architecturetux2nicolae commentedon Jan 29, 2026
Hi @mikehardy,
Sure, the
useOnAppChange()hook is an internal hook that actually should be called more likeuseOnActiveAppStatebut for historical we did not renamed it yet.The getIsHeadless it's actually from the library itself
[-][🐛] Bug Report [react-native-firebase/messaging] - App displays nothing if receives a notification in quit state for iOS[/-][+][🐛] messaging on iOS on new architecture needs updated docs / implementation to handle isHeadless / quit state[/+]