1
- # React Native Custom Timer Notification
1
+ # React Native Custom Timer Notification 🔔
2
2
3
- Custom timer notification for React Native Android 🔔<br >
4
- ** Now version 0.8 Supports full size custom notifications** <br >
5
- <p align =" center " >
6
- <img src =" https://user-images.githubusercontent.com/58332892/208312749-58586dba-da62-4531-85bb-62346a57aa03.gif " >
7
- </p >
3
+ A powerful, flexible notification library for React Native Android that enables custom timer and GIF-based notifications with advanced customization options.
4
+
5
+ Now v0.9.1 supports Gif in Android 14+
8
6
<p align =" center " >
9
- <img width =" 80 %" src =" https://user-images.githubusercontent. com/58332892/166133982-effe321c-a0fd-4315-bb29-cc7ee29d0bd4.gif " >
7
+ <img width =" 50 %" src =" https://github. com/user-attachments/assets/5578e1aa-ac4c-458e-a661-c334e6bf8741 " >
10
8
</p >
11
9
10
+ ## Key Features
11
+
12
+ - ** Customizable Timer Notifications** : Create dynamic, time-based notifications
13
+ - ** Animated GIF Support** : Enhance notifications with animated graphics
14
+ - ** Fully Customizable Notification Layouts** : Design unique notification experiences
12
15
13
- ## Installation
14
16
15
- ``` sh
17
+ ## Installation
18
+
19
+ ``` bash
16
20
npm install react-native-custom-timer-notification
17
21
```
18
22
19
- AndroidManifest
20
- ``` xml
23
+ ## 🛠 Android Setup
24
+
25
+ ### 1. Add Permissions to AndroidManifest.xml
26
+
27
+ Open ` android/app/src/main/AndroidManifest.xml ` and add:
21
28
22
- <receiver android : name =" com.reactnativecustomtimernotification.NotificationEventReceiver" />
23
- <receiver android : name =" com.reactnativecustomtimernotification.OnClickBroadcastReceiver" />
24
- <!--
25
- if foreground service used add this line
26
- -->
27
- <uses-permission android : name =" android.permission.FOREGROUND_SERVICE" />
28
- <service android : name =" com.reactnativecustomtimernotification.ForegroundService" />
29
+ ``` xml
30
+ <uses-permission android : name =" android.permission.POST_NOTIFICATIONS" />
31
+ <uses-permission android : name =" android.permission.FOREGROUND_SERVICE" />
29
32
```
30
- ## Usage
31
- ### Timer notification
32
33
33
- Only Timer notifiction with default Title and body
34
- ``` js
34
+ ### 2. Register Receivers and Services
35
35
36
- import { TimerNotification } from " react-native-custom-timer-notification" ;
36
+ Inside the ` <application> ` tag, add:
37
+
38
+ ``` xml
39
+ <receiver android : name =" com.reactnativecustomtimernotification.NotificationEventReceiver" />
40
+ <receiver android : name =" com.reactnativecustomtimernotification.OnClickBroadcastReceiver" />
41
+ <service android : name =" com.reactnativecustomtimernotification.ForegroundService" />
37
42
```
38
43
39
- | Property | Description |
40
- | --- | --- |
41
- | ` payload ` | sent data will be received when click or canceled |
42
- | ` title ` | Title of the notification|
43
- | ` body ` | Body of the notification |
44
- | ` id ` | unique number|
45
- | ` date ` | Time at which zero comes|
44
+ ## Usage Scenarios
46
45
46
+ ### Basic Timer Notification
47
47
48
- #### Example
48
+ ``` javascript
49
+ import { TimerNotification } from " react-native-custom-timer-notification" ;
49
50
50
- ``` js
51
+ TimerNotification ({
52
+ id: 1 ,
53
+ title: " Meeting Reminder" ,
54
+ body: " Team meeting starts in:" ,
55
+ date: " 30-12-2024 15:00:00" ,
56
+ payload: " meeting-123"
57
+ });
58
+ ```
59
+ ### Animated Notification with GIF
51
60
52
- TimerNotification ({
53
- payload: JSON .stringify (' notification.data' ),
54
- title: ' My notification' ,
55
- body: ' Much longer text that cannot fit one line... ' ,
56
- id: 1 ,
57
- remove: false , // optional
58
- foreground: false ,
59
- date: new Date (Date .now () + 20000 ),
60
- isCountDown: true , // false for positive timer
61
- setCustomContentView: true // optional
62
- });
63
-
61
+
62
+ ``` javascript
63
+ CustomTimerNotification .TimerNotification ({
64
+ id: 2 ,
65
+ title: " Special Offer!" ,
66
+ body: " Limited time offer ends in:" ,
67
+ date: " 25-12-2024 23:59:59" ,
68
+ gifUrl: " https://example.com/animation.gif" ,
69
+ payload: " offer-456"
70
+ });
64
71
```
65
- < h3 >Full custom notification </ h3 >
72
+ #### Options
66
73
67
- Full custom notifiction with custom image, text and cronometer.
68
- ``` js
74
+ | Parameter | Type | Required | Description |
75
+ | -----------| ----------| ----------| ---------------------------------|
76
+ | id | number | Yes | Unique notification identifier |
77
+ | title | string | Yes | Notification title |
78
+ | body | string | Yes | Notification message |
79
+ | date | string | Yes | End date (dd-MM-yyyy HH:mm: ss ) |
80
+ | gifUrl | string | No | URL to GIF animation |
81
+ | payload | string | No | Custom data payload |
69
82
83
+ ## Full Custom Notification
84
+
85
+ Create fully customized notifications with detailed configurations:
86
+ <p align =" center " >
87
+ <img src =" https://user-images.githubusercontent.com/58332892/208312749-58586dba-da62-4531-85bb-62346a57aa03.gif " >
88
+ </p >
89
+
90
+ ``` javascript
70
91
import { CustomNotification , TYPES , FB_TYPE } from " react-native-custom-timer-notification" ;
92
+
93
+ CustomNotification ({
94
+ eventData: JSON .stringify (' notification_data' ),
95
+ title: ' Custom Notification' ,
96
+ body: ' Detailed Notification' ,
97
+ id: 1 ,
98
+ View: [
99
+ {
100
+ name: ' Limited Sales' ,
101
+ size: 20 ,
102
+ type: TYPES .Text ,
103
+ bold: FB_TYPE .BOLD_ITALIC ,
104
+ color: ' #ed1a45' ,
105
+ },
106
+ // Additional view configurations
107
+ ]
108
+ });
71
109
```
72
110
111
+ #### Options
73
112
| Property | Description |
74
113
| --- | --- |
75
- | ` eventData ` | sent data will be received when click or canceled |
114
+ | ` eventData ` | sent data will be received when clicked or canceled |
76
115
| ` title ` | Title of the notification|
77
116
| ` body ` | Body of the notification |
78
117
| ` id ` | unique number|
79
118
| ` View ` | View that needs to be added (Array)|
80
119
81
- < h3 > View Properties </ h3 >
120
+ #### View Options
82
121
83
122
| Property | Description |
84
123
| --- | --- |
85
124
| ` name ` | text that needs to be displayed |
86
125
| ` size ` | Size of text|
87
- | ` type ` | Type of view (Text,Image, Cronometer) |
88
- | ` bold ` | Font (NORMAL,BOLD,ITALIC,BOLD_ITALIC)|
126
+ | ` type ` | Type of view (Text, Image, Cronometer) |
127
+ | ` bold ` | Font (NORMAL, BOLD,ITALIC, BOLD_ITALIC)|
89
128
| ` uri ` | Image in base64|
90
129
| ` PaddingLeft ` | Left Padding|
91
130
| ` PaddingTop ` | PaddingTop|
@@ -94,88 +133,17 @@ import { CustomNotification, TYPES, FB_TYPE } from "react-native-custom-timer-no
94
133
| ` color ` | Text color|
95
134
| ` ZeroTime ` | Time at which zero comes|
96
135
97
- #### Example
98
-
99
- ``` js
100
-
101
- CustomNotification (
102
- {
103
- eventData: JSON .stringify (' notificationOpen?.data' ),
104
- title: ' notificationOpen.data.title' ,
105
- body: ' notificationOpen.data.body' ,
106
- id: 1 ,
107
-
108
- View: [
109
- {
110
- name: ' Limited Sales' ,
111
- size: 20 ,
112
- type: TYPES .Text ,
113
- bold: FB_TYPE .BOLD_ITALIC ,
114
- PaddingLeft: 10 ,
115
- PaddingTop: 50 ,
116
- PaddingRight: 0 ,
117
- PaddingBottom: 0 ,
118
- setViewVisibility: false ,
119
- color: ' #ed1a45' ,
120
- },
121
- {
122
- uri: image,
123
- type: TYPES .Image ,
124
- PaddingLeft: 0 ,
125
- PaddingTop: 0 ,
126
- PaddingRight: 0 ,
127
- PaddingBottom: 0 ,
128
- },
129
- {
130
- name: ' Buy now' ,
131
- size: 30 ,
132
- type: TYPES .Text ,
133
- bold: FB_TYPE .BOLD_ITALIC ,
134
- PaddingLeft: 10 ,
135
- PaddingTop: 100 ,
136
- PaddingRight: 0 ,
137
- PaddingBottom: 0 ,
138
- setViewVisibility: false ,
139
- color: ' #fbd335' ,
140
- },
141
- {
142
- type: TYPES .Cronometer ,
143
- size: 30 ,
144
- ZeroTime: new Date (Date .now () + 20000 ),
145
- PaddingLeft: 800 ,
146
- color: ' #0000FF' ,
147
- PaddingTop: 0 ,
148
- PaddingRight: 0 ,
149
- PaddingBottom: 0 ,
150
- },
151
- ],
152
- },
153
- (e : any ) => {
154
- console .log (e);
155
- }
156
- );
157
-
158
- ```
159
- ### Remove Notifications
160
- ``` js
161
- import { RemoveTimer } from " react-native-custom-timer-notification" ;
162
136
163
- RemoveTimer ( 1 );
137
+ ## 🤝 Contributing
164
138
165
- ```
166
- ### onclick and cancel listner
167
- ``` js
168
- import { onEvent } from " react-native-custom-timer-notification" ;
139
+ See the contributing guide to learn how to contribute to the repository and the development workflow.
169
140
170
- onEvent (event => {
171
- console .log (event )
172
- });
141
+ ## 📄 License
173
142
174
- ```
175
- ## Contributing
143
+ MIT Licensed. See LICENSE file for details.
144
+
145
+ ## 🔍 Keywords
176
146
177
- See the [ contributing guide ] ( CONTRIBUTING.md ) to learn how to contribute to the repository and the development workflow.
147
+ react-native, notifications, timer-notifications, gif-notifications, android-notifications, custom-notifications, countdown-timer, animated-notifications, react-native-notifications, mobile-notifications, push-notifications, notification-system, react-native-android, notification-timer, countdown-notifications, custom-notification-layout
178
148
179
- ## License
180
149
181
- MIT
0 commit comments