@teardown/react-native 2.0.24 → 2.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/docs/adapters/device/basic.mdx +59 -0
  2. package/docs/adapters/device/device-info.mdx +76 -0
  3. package/docs/adapters/device/expo.mdx +61 -0
  4. package/docs/adapters/device/index.mdx +102 -0
  5. package/docs/adapters/device/meta.json +4 -0
  6. package/docs/adapters/index.mdx +96 -0
  7. package/docs/adapters/meta.json +4 -0
  8. package/docs/adapters/notifications/expo.mdx +127 -0
  9. package/docs/adapters/notifications/firebase.mdx +142 -0
  10. package/docs/adapters/notifications/index.mdx +100 -0
  11. package/docs/adapters/notifications/meta.json +4 -0
  12. package/docs/adapters/notifications/wix.mdx +140 -0
  13. package/docs/adapters/storage/async-storage.mdx +95 -0
  14. package/docs/adapters/storage/index.mdx +93 -0
  15. package/docs/adapters/storage/meta.json +4 -0
  16. package/docs/adapters/storage/mmkv.mdx +86 -0
  17. package/docs/advanced.mdx +280 -0
  18. package/docs/api-reference.mdx +241 -0
  19. package/docs/core-concepts.mdx +158 -0
  20. package/docs/force-updates.mdx +185 -0
  21. package/docs/getting-started.mdx +156 -0
  22. package/docs/hooks-reference.mdx +232 -0
  23. package/docs/identity.mdx +171 -0
  24. package/docs/index.mdx +61 -0
  25. package/docs/logging.mdx +144 -0
  26. package/docs/meta.json +14 -0
  27. package/package.json +49 -31
  28. package/src/clients/api/index.ts +1 -1
  29. package/src/clients/device/adapters/basic.adapter.ts +57 -66
  30. package/src/clients/device/adapters/device-info.adapter.ts +21 -28
  31. package/src/clients/device/adapters/device.adpater-interface.ts +1 -8
  32. package/src/clients/device/adapters/expo.adapter.ts +33 -40
  33. package/src/clients/device/device.client.test.ts +20 -35
  34. package/src/clients/device/device.client.ts +0 -3
  35. package/src/clients/identity/identity.client.test.ts +8 -8
  36. package/src/clients/identity/identity.client.ts +1 -1
  37. package/src/clients/identity/index.ts +1 -1
  38. package/src/clients/logging/index.ts +1 -1
  39. package/src/clients/notifications/adapters/expo-notifications.adapter.ts +105 -0
  40. package/src/clients/notifications/adapters/firebase-messaging.adapter.ts +87 -0
  41. package/src/clients/notifications/adapters/notifications.adapter-interface.ts +112 -0
  42. package/src/clients/notifications/adapters/wix-notifications.adapter.ts +183 -0
  43. package/src/clients/notifications/index.ts +2 -0
  44. package/src/clients/notifications/notifications.client.ts +214 -3
  45. package/src/clients/storage/adapters/async-storage.adapter.ts +2 -6
  46. package/src/clients/storage/adapters/storage-adapters.test.ts +2 -7
  47. package/src/clients/storage/adapters/storage.adpater-interface.ts +1 -5
  48. package/src/clients/utils/index.ts +1 -1
  49. package/src/clients/utils/utils.client.ts +1 -1
  50. package/src/exports/adapters/async-storage.ts +1 -1
  51. package/src/exports/adapters/expo.ts +1 -1
  52. package/src/exports/expo.ts +2 -0
  53. package/src/exports/firebase.ts +1 -0
  54. package/src/exports/index.ts +6 -9
  55. package/src/exports/wix.ts +1 -0
  56. package/src/hooks/use-force-update.ts +31 -34
  57. package/src/index.ts +1 -0
  58. package/src/teardown.core.ts +0 -2
  59. package/src/.DS_Store +0 -0
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: BasicAdapter
3
+ description: Fallback device adapter with minimal or static device information.
4
+ ---
5
+
6
+ The `BasicAdapter` provides minimal device information without external dependencies. Useful for testing or fallback scenarios.
7
+
8
+ ## Usage
9
+
10
+ ```typescript
11
+ import { TeardownCore } from '@teardown/react-native';
12
+ import { BasicAdapter } from '@teardown/react-native/adapters/basic';
13
+ import { MMKVStorageAdapter } from '@teardown/react-native/adapters/mmkv';
14
+
15
+ export const teardown = new TeardownCore({
16
+ org_id: 'your-org-id',
17
+ project_id: 'your-project-id',
18
+ api_key: 'your-api-key',
19
+ storageAdapter: new MMKVStorageAdapter(),
20
+ deviceAdapter: new BasicAdapter(),
21
+ });
22
+ ```
23
+
24
+ ## Import Path
25
+
26
+ ```typescript
27
+ import { BasicAdapter } from '@teardown/react-native/adapters/basic';
28
+ ```
29
+
30
+ ## Collected Data
31
+
32
+ The BasicAdapter returns static or minimal information:
33
+
34
+ ### Application Info
35
+ - `version` - Static value or from app.json
36
+ - `buildNumber` - Static value
37
+ - `bundleId` - Static value or from app.json
38
+
39
+ ### Hardware Info
40
+ - `deviceName` - "Unknown Device"
41
+ - `brand` - "Unknown"
42
+ - `deviceType` - "unknown"
43
+
44
+ ### OS Info
45
+ - `osName` - From React Native Platform API
46
+ - `osVersion` - From React Native Platform API
47
+
48
+ ## When to Use
49
+
50
+ - Unit testing without native modules
51
+ - Development/prototyping
52
+ - Fallback when other adapters fail
53
+ - Environments where native modules aren't available
54
+
55
+ ## Limitations
56
+
57
+ - Limited device information accuracy
58
+ - No hardware-specific details
59
+ - Not recommended for production analytics
@@ -0,0 +1,76 @@
1
+ ---
2
+ title: DeviceInfoAdapter
3
+ description: Device adapter for bare React Native projects using react-native-device-info.
4
+ ---
5
+
6
+ The `DeviceInfoAdapter` uses `react-native-device-info` to collect device information in bare React Native projects.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install react-native-device-info
12
+ # or
13
+ bun add react-native-device-info
14
+ ```
15
+
16
+ For iOS, run pod install:
17
+ ```bash
18
+ cd ios && pod install
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```typescript
24
+ import { TeardownCore } from '@teardown/react-native';
25
+ import { DeviceInfoAdapter } from '@teardown/react-native/adapters/device-info';
26
+ import { MMKVStorageAdapter } from '@teardown/react-native/adapters/mmkv';
27
+
28
+ export const teardown = new TeardownCore({
29
+ org_id: 'your-org-id',
30
+ project_id: 'your-project-id',
31
+ api_key: 'your-api-key',
32
+ storageAdapter: new MMKVStorageAdapter(),
33
+ deviceAdapter: new DeviceInfoAdapter(),
34
+ });
35
+ ```
36
+
37
+ ## Import Path
38
+
39
+ ```typescript
40
+ import { DeviceInfoAdapter } from '@teardown/react-native/adapters/device-info';
41
+ ```
42
+
43
+ ## Collected Data
44
+
45
+ ### Application Info
46
+ - `version` - From `getVersion()`
47
+ - `buildNumber` - From `getBuildNumber()`
48
+ - `bundleId` - From `getBundleId()`
49
+
50
+ ### Hardware Info
51
+ - `deviceName` - From `getDeviceName()`
52
+ - `brand` - From `getBrand()`
53
+ - `deviceType` - From `getDeviceType()` (phone, tablet, desktop, tv, unknown)
54
+
55
+ ### OS Info
56
+ - `osName` - From `getSystemName()`
57
+ - `osVersion` - From `getSystemVersion()`
58
+
59
+ ## When to Use
60
+
61
+ - Bare React Native CLI projects
62
+ - Projects not using Expo modules
63
+ - Projects requiring additional device info beyond what Expo provides
64
+
65
+ ## Requirements
66
+
67
+ - `react-native-device-info` >= 10.0.0
68
+ - React Native >= 0.60 (autolinking)
69
+
70
+ ## Platform Notes
71
+
72
+ ### iOS
73
+ Requires `pod install` after installation.
74
+
75
+ ### Android
76
+ Works out of the box with autolinking.
@@ -0,0 +1,61 @@
1
+ ---
2
+ title: ExpoDeviceAdapter
3
+ description: Device adapter for Expo projects using expo-device and expo-application.
4
+ ---
5
+
6
+ The `ExpoDeviceAdapter` uses Expo's native modules to collect device information.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npx expo install expo-device expo-application
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```typescript
17
+ import { TeardownCore } from '@teardown/react-native';
18
+ import { ExpoDeviceAdapter } from '@teardown/react-native/adapters/expo';
19
+ import { MMKVStorageAdapter } from '@teardown/react-native/adapters/mmkv';
20
+
21
+ export const teardown = new TeardownCore({
22
+ org_id: 'your-org-id',
23
+ project_id: 'your-project-id',
24
+ api_key: 'your-api-key',
25
+ storageAdapter: new MMKVStorageAdapter(),
26
+ deviceAdapter: new ExpoDeviceAdapter(),
27
+ });
28
+ ```
29
+
30
+ ## Import Path
31
+
32
+ ```typescript
33
+ import { ExpoDeviceAdapter } from '@teardown/react-native/adapters/expo';
34
+ ```
35
+
36
+ ## Collected Data
37
+
38
+ ### Application Info
39
+ - `version` - From `expo-application` `nativeApplicationVersion`
40
+ - `buildNumber` - From `expo-application` `nativeBuildVersion`
41
+ - `bundleId` - From `expo-application` `applicationId`
42
+
43
+ ### Hardware Info
44
+ - `deviceName` - From `expo-device` `deviceName`
45
+ - `brand` - From `expo-device` `brand`
46
+ - `deviceType` - From `expo-device` `deviceType` (phone, tablet, desktop, tv, unknown)
47
+
48
+ ### OS Info
49
+ - `osName` - From `expo-device` `osName`
50
+ - `osVersion` - From `expo-device` `osVersion`
51
+
52
+ ## When to Use
53
+
54
+ - Expo managed workflow projects
55
+ - Expo bare workflow projects using Expo modules
56
+ - Projects using Expo SDK 44+
57
+
58
+ ## Requirements
59
+
60
+ - `expo-device` >= 4.0.0
61
+ - `expo-application` >= 4.0.0
@@ -0,0 +1,102 @@
1
+ ---
2
+ title: Device Adapters
3
+ description: Collect device, OS, and app information with platform adapters.
4
+ icon: Monitor
5
+ ---
6
+
7
+ Device adapters collect device and application information for identification and analytics. You must provide a device adapter when initializing `TeardownCore`.
8
+
9
+ ## Available Adapters
10
+
11
+ | Adapter | Package | Best For |
12
+ |---------|---------|----------|
13
+ | [`ExpoDeviceAdapter`](/docs/react-native/adapters/device/expo) | `expo-device`, `expo-application` | Expo projects |
14
+ | [`DeviceInfoAdapter`](/docs/react-native/adapters/device/device-info) | `react-native-device-info` | Bare RN projects |
15
+ | [`BasicAdapter`](/docs/react-native/adapters/device/basic) | None | Fallback/testing |
16
+
17
+ ## Collected Information
18
+
19
+ All device adapters provide:
20
+
21
+ ### Application Info
22
+
23
+ ```typescript
24
+ interface ApplicationInfo {
25
+ version: string; // App version (e.g., "1.2.3")
26
+ buildNumber: string; // Build number (e.g., "45")
27
+ bundleId: string; // Bundle identifier (e.g., "com.example.app")
28
+ }
29
+ ```
30
+
31
+ ### Hardware Info
32
+
33
+ ```typescript
34
+ interface HardwareInfo {
35
+ deviceName: string; // Device name (e.g., "iPhone 14 Pro")
36
+ brand: string; // Manufacturer (e.g., "Apple")
37
+ deviceType: string; // Device type (e.g., "phone", "tablet")
38
+ }
39
+ ```
40
+
41
+ ### OS Info
42
+
43
+ ```typescript
44
+ interface OSInfo {
45
+ osName: string; // OS name (e.g., "iOS", "Android")
46
+ osVersion: string; // OS version (e.g., "17.0")
47
+ }
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ ```typescript
53
+ import { TeardownCore } from '@teardown/react-native';
54
+ import { ExpoDeviceAdapter } from '@teardown/react-native/adapters/expo';
55
+
56
+ const teardown = new TeardownCore({
57
+ deviceAdapter: new ExpoDeviceAdapter(),
58
+ // ... other options
59
+ });
60
+ ```
61
+
62
+ ## Device ID
63
+
64
+ The SDK generates a stable device ID that persists across app sessions:
65
+
66
+ ```typescript
67
+ const deviceId = await core.device.getDeviceId();
68
+ // Returns a UUID that persists in storage
69
+ ```
70
+
71
+ ## Custom Adapter
72
+
73
+ Implement the `DeviceInfoAdapter` interface:
74
+
75
+ ```typescript
76
+ import type { DeviceInfoAdapter, ApplicationInfo, HardwareInfo, OSInfo } from '@teardown/react-native';
77
+
78
+ class CustomDeviceAdapter implements DeviceInfoAdapter {
79
+ get applicationInfo(): ApplicationInfo {
80
+ return {
81
+ version: '1.0.0',
82
+ buildNumber: '1',
83
+ bundleId: 'com.example.app',
84
+ };
85
+ }
86
+
87
+ get hardwareInfo(): HardwareInfo {
88
+ return {
89
+ deviceName: 'Custom Device',
90
+ brand: 'Custom',
91
+ deviceType: 'phone',
92
+ };
93
+ }
94
+
95
+ get osInfo(): OSInfo {
96
+ return {
97
+ osName: 'iOS',
98
+ osVersion: '17.0',
99
+ };
100
+ }
101
+ }
102
+ ```
@@ -0,0 +1,4 @@
1
+ {
2
+ "title": "Device",
3
+ "pages": ["expo", "device-info", "basic"]
4
+ }
@@ -0,0 +1,96 @@
1
+ ---
2
+ title: Adapters
3
+ description: Platform adapters for storage, device info, and notifications.
4
+ icon: Plug
5
+ ---
6
+
7
+ The Teardown SDK uses adapters to abstract platform-specific functionality. This allows the SDK to work across different React Native environments (Expo, bare RN) and with different underlying libraries.
8
+
9
+ ## Adapter Types
10
+
11
+ ### Device Adapters
12
+
13
+ Collect device and application information for identification and analytics.
14
+
15
+ | Adapter | Package | Use Case |
16
+ |---------|---------|----------|
17
+ | [`ExpoDeviceAdapter`](/docs/react-native/adapters/device/expo) | `expo-device`, `expo-application` | Expo projects |
18
+ | [`DeviceInfoAdapter`](/docs/react-native/adapters/device/device-info) | `react-native-device-info` | Bare RN projects |
19
+ | [`BasicAdapter`](/docs/react-native/adapters/device/basic) | None | Fallback/testing |
20
+
21
+ [View Device Adapters →](/docs/react-native/adapters/device)
22
+
23
+ ### Storage Adapters
24
+
25
+ Handle persistent data storage for sessions, device IDs, and version status.
26
+
27
+ | Adapter | Package | Use Case |
28
+ |---------|---------|----------|
29
+ | [`MMKVStorageAdapter`](/docs/react-native/adapters/storage/mmkv) | `react-native-mmkv` | Fast sync storage (recommended) |
30
+ | [`AsyncStorageAdapter`](/docs/react-native/adapters/storage/async-storage) | `@react-native-async-storage/async-storage` | Broader compatibility |
31
+
32
+ [View Storage Adapters →](/docs/react-native/adapters/storage)
33
+
34
+ ### Notification Adapters
35
+
36
+ Handle push notification registration and token management.
37
+
38
+ | Adapter | Package | Use Case |
39
+ |---------|---------|----------|
40
+ | [`ExpoNotificationsAdapter`](/docs/react-native/adapters/notifications/expo) | `expo-notifications` | Expo projects |
41
+ | [`FirebaseMessagingAdapter`](/docs/react-native/adapters/notifications/firebase) | `@react-native-firebase/messaging` | Firebase Cloud Messaging |
42
+ | [`WixNotificationsAdapter`](/docs/react-native/adapters/notifications/wix) | `react-native-notifications` | Wix notifications library |
43
+
44
+ [View Notification Adapters →](/docs/react-native/adapters/notifications)
45
+
46
+ ## Required Adapters
47
+
48
+ When initializing `TeardownCore`, you must provide:
49
+
50
+ ```typescript
51
+ const teardown = new TeardownCore({
52
+ org_id: 'your-org-id',
53
+ project_id: 'your-project-id',
54
+ api_key: 'your-api-key',
55
+ storageAdapter: new MMKVStorageAdapter(), // Required
56
+ deviceAdapter: new ExpoDeviceAdapter(), // Required
57
+ });
58
+ ```
59
+
60
+ ## Common Configurations
61
+
62
+ ### Expo Project
63
+
64
+ ```typescript
65
+ import { TeardownCore } from '@teardown/react-native';
66
+ import { ExpoDeviceAdapter } from '@teardown/react-native/adapters/expo';
67
+ import { MMKVStorageAdapter } from '@teardown/react-native/adapters/mmkv';
68
+
69
+ export const teardown = new TeardownCore({
70
+ org_id: 'your-org-id',
71
+ project_id: 'your-project-id',
72
+ api_key: 'your-api-key',
73
+ storageAdapter: new MMKVStorageAdapter(),
74
+ deviceAdapter: new ExpoDeviceAdapter(),
75
+ });
76
+ ```
77
+
78
+ ### Bare React Native Project
79
+
80
+ ```typescript
81
+ import { TeardownCore } from '@teardown/react-native';
82
+ import { DeviceInfoAdapter } from '@teardown/react-native/adapters/device-info';
83
+ import { AsyncStorageAdapter } from '@teardown/react-native/adapters/async-storage';
84
+
85
+ export const teardown = new TeardownCore({
86
+ org_id: 'your-org-id',
87
+ project_id: 'your-project-id',
88
+ api_key: 'your-api-key',
89
+ storageAdapter: new AsyncStorageAdapter(),
90
+ deviceAdapter: new DeviceInfoAdapter(),
91
+ });
92
+ ```
93
+
94
+ ## Custom Adapters
95
+
96
+ All adapter types can be extended for custom implementations. See individual adapter sections for interface definitions.
@@ -0,0 +1,4 @@
1
+ {
2
+ "title": "Adapters",
3
+ "pages": ["device", "storage", "notifications"]
4
+ }
@@ -0,0 +1,127 @@
1
+ ---
2
+ title: ExpoNotificationsAdapter
3
+ description: Notification adapter for Expo projects using expo-notifications.
4
+ ---
5
+
6
+ The `ExpoNotificationsAdapter` integrates with Expo's notifications library for push notification handling.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npx expo install expo-notifications expo-device expo-constants
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```typescript
17
+ import { ExpoNotificationsAdapter } from '@teardown/react-native/expo-notifications';
18
+
19
+ const notifications = new ExpoNotificationsAdapter();
20
+
21
+ // Request permissions
22
+ const granted = await notifications.requestPermissions();
23
+
24
+ if (granted) {
25
+ // Get push token
26
+ const token = await notifications.getToken();
27
+ console.log('Push token:', token);
28
+ }
29
+ ```
30
+
31
+ ## Import Path
32
+
33
+ ```typescript
34
+ import { ExpoNotificationsAdapter } from '@teardown/react-native/expo-notifications';
35
+ ```
36
+
37
+ ## API
38
+
39
+ ### getToken()
40
+
41
+ Get the Expo push token:
42
+
43
+ ```typescript
44
+ const token = await notifications.getToken();
45
+ // Returns: "ExponentPushToken[xxxxxx]" or null
46
+ ```
47
+
48
+ ### requestPermissions()
49
+
50
+ Request notification permissions:
51
+
52
+ ```typescript
53
+ const granted = await notifications.requestPermissions();
54
+ // Returns: true if granted, false otherwise
55
+ ```
56
+
57
+ ### isEnabled()
58
+
59
+ Check if notifications are enabled:
60
+
61
+ ```typescript
62
+ const enabled = await notifications.isEnabled();
63
+ ```
64
+
65
+ ### onNotification()
66
+
67
+ Subscribe to incoming notifications while app is foregrounded:
68
+
69
+ ```typescript
70
+ const unsubscribe = notifications.onNotification((notification) => {
71
+ console.log('Received:', notification.title);
72
+ });
73
+
74
+ // Cleanup
75
+ unsubscribe();
76
+ ```
77
+
78
+ ### onNotificationResponse()
79
+
80
+ Subscribe to notification responses (user taps):
81
+
82
+ ```typescript
83
+ const unsubscribe = notifications.onNotificationResponse((response) => {
84
+ console.log('User tapped notification:', response.notification.title);
85
+ });
86
+
87
+ // Cleanup
88
+ unsubscribe();
89
+ ```
90
+
91
+ ## Configuration
92
+
93
+ ### app.json / app.config.js
94
+
95
+ ```json
96
+ {
97
+ "expo": {
98
+ "plugins": [
99
+ [
100
+ "expo-notifications",
101
+ {
102
+ "icon": "./assets/notification-icon.png",
103
+ "color": "#ffffff"
104
+ }
105
+ ]
106
+ ]
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### Android
112
+
113
+ For FCM integration, add your `google-services.json` to the project root.
114
+
115
+ ### iOS
116
+
117
+ Push notifications require:
118
+ - Apple Developer account
119
+ - Push notification capability
120
+ - APNs certificate or key
121
+
122
+ ## Requirements
123
+
124
+ - `expo-notifications` >= 0.17.0
125
+ - `expo-device` >= 4.0.0
126
+ - `expo-constants` >= 13.0.0
127
+ - EAS Build or dev client (not Expo Go)
@@ -0,0 +1,142 @@
1
+ ---
2
+ title: FirebaseMessagingAdapter
3
+ description: Notification adapter for Firebase Cloud Messaging.
4
+ ---
5
+
6
+ The `FirebaseMessagingAdapter` integrates with Firebase Cloud Messaging for push notifications.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @react-native-firebase/app @react-native-firebase/messaging
12
+ # or
13
+ bun add @react-native-firebase/app @react-native-firebase/messaging
14
+ ```
15
+
16
+ For iOS:
17
+ ```bash
18
+ cd ios && pod install
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```typescript
24
+ import { FirebaseMessagingAdapter } from '@teardown/react-native/firebase-messaging';
25
+
26
+ const notifications = new FirebaseMessagingAdapter();
27
+
28
+ // Request permissions (iOS)
29
+ const granted = await notifications.requestPermissions();
30
+
31
+ if (granted) {
32
+ // Get FCM token
33
+ const token = await notifications.getToken();
34
+ console.log('FCM token:', token);
35
+ }
36
+ ```
37
+
38
+ ## Import Path
39
+
40
+ ```typescript
41
+ import { FirebaseMessagingAdapter } from '@teardown/react-native/firebase-messaging';
42
+ ```
43
+
44
+ ## API
45
+
46
+ ### getToken()
47
+
48
+ Get the FCM registration token:
49
+
50
+ ```typescript
51
+ const token = await notifications.getToken();
52
+ // Returns: FCM token string or null
53
+ ```
54
+
55
+ ### requestPermissions()
56
+
57
+ Request notification permissions (required on iOS):
58
+
59
+ ```typescript
60
+ const granted = await notifications.requestPermissions();
61
+ // Returns: true if granted, false otherwise
62
+ ```
63
+
64
+ ### isEnabled()
65
+
66
+ Check if notifications are enabled:
67
+
68
+ ```typescript
69
+ const enabled = await notifications.isEnabled();
70
+ ```
71
+
72
+ ### onNotification()
73
+
74
+ Subscribe to incoming notifications:
75
+
76
+ ```typescript
77
+ const unsubscribe = notifications.onNotification((notification) => {
78
+ console.log('Received:', notification.title);
79
+ });
80
+
81
+ // Cleanup
82
+ unsubscribe();
83
+ ```
84
+
85
+ ### onNotificationResponse()
86
+
87
+ Subscribe to notification opens:
88
+
89
+ ```typescript
90
+ const unsubscribe = notifications.onNotificationResponse((response) => {
91
+ console.log('User tapped:', response.notification.title);
92
+ });
93
+
94
+ // Cleanup
95
+ unsubscribe();
96
+ ```
97
+
98
+ ## Configuration
99
+
100
+ ### Android
101
+
102
+ 1. Add `google-services.json` to `android/app/`
103
+ 2. Add to `android/build.gradle`:
104
+
105
+ ```groovy
106
+ buildscript {
107
+ dependencies {
108
+ classpath 'com.google.gms:google-services:4.3.15'
109
+ }
110
+ }
111
+ ```
112
+
113
+ 3. Add to `android/app/build.gradle`:
114
+
115
+ ```groovy
116
+ apply plugin: 'com.google.gms.google-services'
117
+ ```
118
+
119
+ ### iOS
120
+
121
+ 1. Add `GoogleService-Info.plist` to iOS project
122
+ 2. Enable Push Notifications capability in Xcode
123
+ 3. Upload APNs key to Firebase Console
124
+
125
+ ## Background Messages
126
+
127
+ Handle messages when app is in background:
128
+
129
+ ```typescript
130
+ import messaging from '@react-native-firebase/messaging';
131
+
132
+ // Register background handler (must be outside component)
133
+ messaging().setBackgroundMessageHandler(async (remoteMessage) => {
134
+ console.log('Background message:', remoteMessage);
135
+ });
136
+ ```
137
+
138
+ ## Requirements
139
+
140
+ - `@react-native-firebase/app` >= 18.0.0
141
+ - `@react-native-firebase/messaging` >= 18.0.0
142
+ - React Native >= 0.71