From be7e55e532865de9297ed5a7bbe84e459ef230a3 Mon Sep 17 00:00:00 2001 From: Vojtech Novak Date: Wed, 19 Aug 2026 08:33:26 +0200 Subject: [PATCH 1/6] [notifications] present notifications by default when in foreground (#49072) # Why resolves https://github.com/expo/expo/pull/43118 by default, so far, notifications delivered to the app while it's foregrounded, were ignored. Users would have to set their own handler using `setNotificationHandler`. # How - set default notification handler that presents notifications - also present notifications by default when the handler times out - on android the timeout path passed no behavior at all, which resolves priority differently from what the default handler asks for. docs are in the stacked PR #49077. # Test Plan - notification tester app - `apps/test-suite` Notifications specs, on android and ios: default shows, slow handler still shows once it times out, removed handler doesn't show # Checklist - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) --------- Co-authored-by: Claude Fable 5 --- apps/notification-tester/src/app/index.tsx | 22 ++-- apps/notification-tester/src/app/tester.tsx | 31 ++++++ .../src/registerTaskAsync.ts | 8 +- apps/test-suite/tests/Notifications.ts | 91 +++++++++++++++ .../data/unversioned/expo-notifications.json | 2 +- packages/expo-notifications/CHANGELOG.md | 2 + .../handling/NotificationsHandler.kt | 16 ++- .../SingleNotificationHandlerTask.java | 7 +- .../model/NotificationBehaviorRecord.kt | 15 +++ .../SingleNotificationHandlerTask.swift | 8 +- .../src/NotificationsHandler.ts | 104 ++++++++++++------ 11 files changed, 248 insertions(+), 58 deletions(-) create mode 100644 apps/notification-tester/src/app/tester.tsx diff --git a/apps/notification-tester/src/app/index.tsx b/apps/notification-tester/src/app/index.tsx index ca0318147fdfc5..4eedaa821e1ae2 100644 --- a/apps/notification-tester/src/app/index.tsx +++ b/apps/notification-tester/src/app/index.tsx @@ -1,31 +1,23 @@ -import { getPermissionsAsync } from 'expo-notifications'; import { useRouter } from 'expo-router'; -import { Alert, Button } from 'react-native'; +import { Button, Text } from 'react-native'; -import { Notifier } from '../Notifier'; import { ScrollView } from '../misc/Themed'; +import { setAppNotificationHandler } from '../registerTaskAsync'; export default function IndexPage() { const router = useRouter(); return (