@solidnative-dev/notifications
Validated local notifications and owner-scoped foreground notification events for Solid Native. The first backend targets Notify Kit 10.5 (NotifeeApiModule) via injected generated bindings without evaluating its React-facing JavaScript facade.
Installation#
sh
pnpm add @solidnative-dev/notifications @notifee/react-nativeGenerate the native binding for your app and pass the resolved NotifeeApiModule and low-level native event source into the adapter (see the checked-in NotifeeApiModule seam).
Usage#
ts
import { createNotifyKit10NotificationService } from "@solidnative-dev/notifications/notify-kit-10";
import { createNotificationEvent } from "@solidnative-dev/notifications/solid";
const notifications = createNotifyKit10NotificationService(
generatedNotifeeModule,
nativeEventSource,
{
platform: "android",
androidSmallIcon: "solid_native_notification",
},
);
const latestEvent = createNotificationEvent(notifications, {
onError: console.error,
});
await notifications.requestPermission();
await notifications.display({
id: "sync-complete",
title: "Sync complete",
channel: { id: "application", name: "Application" },
});Entrypoints#
| Import | Key exports |
|---|---|
@solidnative-dev/notifications | createNotificationService, NotificationService, LocalNotification, NotificationChannel, NotificationPermission, NotificationEvent |
@solidnative-dev/notifications/notify-kit-10 | createNotifyKit10NotificationService, NotifyKit10NativeModule, NotifyKit10NativeEventSource, NOTIFY_KIT_10_FOREGROUND_EVENT |
@solidnative-dev/notifications/solid | createNotificationEvent, NotificationEventSource, NotificationEventAccessorOptions |
Causal event mapping#
| Kind | Causal event name | Priority |
|---|---|---|
delivered | platform.notification.delivered | default |
pressed | platform.notification.pressed | discrete |
action-pressed | platform.notification.action-pressed | discrete |
dismissed | platform.notification.dismissed | default |
unknown | platform.notification.unknown | default |
Behavior & platform notes#
- Owner-scoped reactivity:
createNotificationEventaccepts either a service or a reactive accessor, automatically swapping subscriptions on change and detaching on owner disposal. Diagnostic errors are isolated viaonError. - Android body press: The Notify Kit 10 adapter installs
{ id: "default", launchActivity: "default" }on Android so tapping a notification reliably reopens the app and emitspressed. - iOS permission timing: Wait until the app returns to the
activestate after the iOS permission prompt before callingdisplay(), otherwise UIKit's briefinactivestate causes Notify Kit to route the event as a background delivery. - Privacy & scope: Notification IDs, titles, and bodies stay out of causal telemetry. Remote push credentials, rich action buttons, and background execution remain app-shell responsibilities.