Hi Notifee team, I'm very excited to use this library for both local and remote notifications however my question is focused on local notifications for iOS only.
I'm trying to setup notifications quick actions, for example postponing the notification for an hour or liking a piece of content.
Through testing I noticed that the notifee.onBackgroundEvent is not called when the app is force killed unless my app is very basic. In a 'real-world' large app, the onBackgroundEvent is not called unless the app is manually re-opened by the user or the quick action is pressed a few times on different notifications.
My thinking is that the App component is registered and the whole js bundle is loaded when the notifee.onBackgroundEvent is triggered, hence why the example works on small apps but not large ones.
In your experience, what would be the correct setup for notifee.onBackgroundEvent so that the whole app js bundle is not loaded causing the OS to not deliver the notification as intended? Thank you 😄
Please let me know if you need additional details or clarifications. In the example imagine AppStack as a large, nested navigator with a lot of UI loaded components and useSomeExpensiveSetup as a bunch of hooks that setup other app functions like audio library, analytics, monitoring software etc.
Below is my setup.
testing on real device iPhone 8
libraries:
"react": "17.0.2",
"react-native": "0.67.5",
"@notifee/react-native": "^7.1.0",
my index.js:
/**
* @format
*/
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import notifee, {EventType, TriggerType} from '@notifee/react-native';
// Notifee
notifee.onBackgroundEvent(async ({type, detail}) => {
const {notification, pressAction} = detail;
// Check if the user pressed the "Postpone action" action
if (
type === EventType.ACTION_PRESS &&
pressAction.id === 'TEST_REMINDER_POSTPONE_IMMEDIATE' // postpone notification by 1min
) {
const now = new Date();
const trigger = {
type: TriggerType.TIMESTAMP,
timestamp: now.getTime() + 60 * 1000, // 60s delay
};
const postonedNotification = {
title: 'A postponed notification',
body: 'Postponed by 1min',
ios: {
categoryId: 'TEST_CATEGORY',
},
};
console.log('postponed notification');
await notifee.createTriggerNotification(postonedNotification, trigger);
// Remove the notification
await notifee.cancelNotification(notification.id);
}
});
AppRegistry.registerComponent(appName, () => App);
my App.js:
const App: () => React$Node = () => {
useNotifeeSubscribeToForegroundEvents();
useSomeExpensiveSetup(); // this may take longer to setup like purchasing libraries, audio libraries, analytics etc
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<AppStack /> // AppStack loads a large app
</PersistGate>
</Provider>
);
};
export default App;
iOS background modes


Hi Notifee team, I'm very excited to use this library for both local and remote notifications however my question is focused on local notifications for iOS only.
I'm trying to setup notifications quick actions, for example postponing the notification for an hour or liking a piece of content.
Through testing I noticed that the
notifee.onBackgroundEventis not called when the app is force killed unless my app is very basic. In a 'real-world' large app, theonBackgroundEventis not called unless the app is manually re-opened by the user or the quick action is pressed a few times on different notifications.My thinking is that the
Appcomponent is registered and the whole js bundle is loaded when thenotifee.onBackgroundEventis triggered, hence why the example works on small apps but not large ones.In your experience, what would be the correct setup for
notifee.onBackgroundEventso that the whole app js bundle is not loaded causing the OS to not deliver the notification as intended? Thank you 😄Please let me know if you need additional details or clarifications. In the example imagine
AppStackas a large, nested navigator with a lot of UI loaded components anduseSomeExpensiveSetupas a bunch of hooks that setup other app functions like audio library, analytics, monitoring software etc.Below is my setup.
testing on real device iPhone 8
libraries:
my
index.js:my
App.js:iOS background modes