[š] How to inject isHeadless prop into AppDelegate.swift file
The messaging documentation explains how to inject isHeadless prop into the AppDelegate.m file. But as you know, new RN releases are using AppDelegate.swift files.
I recently upgraded my RN version to 0.79.5, but now I have no clue how to inject isHeadless into my swift file.
Could someone please update the documentation with a swift example?
Iām using React Native 0.79.5 with Firebase 22.4.0, and I ran into the same issue with the transition from AppDelegate.m to AppDelegate.swift.
To inject the isHeadless prop, I followed this approach in my AppDelegate.swift:
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
// š§ Firebase initialization
FirebaseApp.configure()
// āāā React Native bootstrapping āāā
let delegate = ReactNativeDelegate()
let factory = RCTReactNativeFactory(delegate: delegate)
delegate.dependencyProvider = RCTAppDependencyProvider()
reactNativeDelegate = delegate
reactNativeFactory = factory
window = UIWindow(frame: UIScreen.main.bounds)
factory.startReactNative(
withModuleName: "<YOUR_PACKAGE_NAME>",
in: window,
initialProperties: RNFBMessagingModule.addCustomProps(
toUserProps: nil,
withLaunchOptions: launchOptions
),
launchOptions: launchOptions
)
return true
}
@tomisykora May I know if isHeadless prop working properly with react native 0.79 new architecture?
As tested, isHeadless prop does not working properly with new architecture for iOS quit state.
It looks like I have the same issue after upgrading RN to 0.79. isHeadless is true when I receive a push notification and then open the app from the app icon. The isHeadless check returns null, and the app opens with a white screen. After closing and reopening the app, everything works as expected.
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.
Thank you for your contributions.
It looks like I have the same issue after upgrading RN to 0.79.
isHeadlessistruewhen I receive a push notification and then open the app from the app icon. TheisHeadlesscheck returnsnull, and the app opens with a white screen. After closing and reopening the app, everything works as expected.
Actually it's due to the new architecture. If you opt-in old architecture, isHeadless works.
To solve the problem programmatically, please refer to https://github.com/invertase/react-native-firebase/issues/8248#issuecomment-2681039536.
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.
Thank you for your contributions.
The isHeadless prop stuff (here and in related issue #8248) is not resolved well in documentation or practice yet, I believe
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.
Thank you for your contributions.