react-native-popify 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 qurat.ul.ain
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/Popify.podspec ADDED
@@ -0,0 +1,21 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "Popify"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/Qurat-ul-ainn/react-native-popify.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+
20
+ install_modules_dependencies(s)
21
+ end
package/README.md ADDED
@@ -0,0 +1,329 @@
1
+ <div align="center">
2
+
3
+ # 🎨 react-native-popify
4
+
5
+ **Beautiful, animated alerts & toasts for React Native**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/react-native-popify.svg?style=flat-square&color=00C853)](https://www.npmjs.com/package/react-native-popify)
8
+ [![license](https://img.shields.io/npm/l/react-native-popify.svg?style=flat-square&color=3366FF)](https://github.com/Qurat-ul-ainn/react-native-popify/blob/main/LICENSE)
9
+ [![platform](https://img.shields.io/badge/platform-iOS%20%7C%20Android-lightgrey?style=flat-square)](https://reactnative.dev)
10
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/Qurat-ul-ainn/react-native-popify/pulls)
11
+
12
+ A lightweight, zero-dependency UI library that provides **stunning alert dialogs** and **smooth toast notifications** for React Native apps — with spring animations, particle effects, dark mode, swipe-to-dismiss, and full customization.
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## ✨ Features
19
+
20
+ - **4 Alert types** — `success`, `error`, `warning`, `info` with unique colors & icons
21
+ - **3 Animation styles** — `spring`, `slideUp`, `fadeIn`
22
+ - **Particle burst effects** — Celebrate achievements with animated particles
23
+ - **Toast notifications** — Slide-in toasts with progress bar & swipe-to-dismiss
24
+ - **Dark mode** — Built-in light & dark theme support
25
+ - **Auto-close timer** — With animated progress indicator
26
+ - **Flexible button layouts** — Horizontal, vertical, or auto
27
+ - **Custom icons** — Pass your own icon components
28
+ - **Custom header & footer** — Render anything above or below content
29
+ - **Style overrides** — Full control over every visual element
30
+ - **Pure JS** — No native linking required
31
+ - **iOS & Android** — Works on both platforms out of the box
32
+
33
+ ---
34
+
35
+ ## 📦 Installation
36
+
37
+ ```bash
38
+ # npm
39
+ npm install react-native-popify
40
+
41
+ # yarn
42
+ yarn add react-native-popify
43
+ ```
44
+
45
+ > **Note:** This library has **zero native dependencies**. No pod install or linking needed!
46
+
47
+ ---
48
+
49
+ ## 🚀 Quick Start
50
+
51
+ ```jsx
52
+ import React, { useState } from 'react';
53
+ import { View, Button } from 'react-native';
54
+ import { PopifyAlert, PopifyToast } from 'react-native-popify';
55
+
56
+ export default function App() {
57
+ const [showAlert, setShowAlert] = useState(false);
58
+ const [showToast, setShowToast] = useState(false);
59
+
60
+ return (
61
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
62
+ <Button title="Show Alert" onPress={() => setShowAlert(true)} />
63
+ <Button title="Show Toast" onPress={() => setShowToast(true)} />
64
+
65
+ <PopifyAlert
66
+ visible={showAlert}
67
+ type="success"
68
+ title="Success!"
69
+ message="Your action was completed successfully."
70
+ onClose={() => setShowAlert(false)}
71
+ buttons={[
72
+ { label: 'OK', onPress: () => setShowAlert(false) },
73
+ ]}
74
+ />
75
+
76
+ <PopifyToast
77
+ visible={showToast}
78
+ type="success"
79
+ message="Changes saved successfully!"
80
+ onClose={() => setShowToast(false)}
81
+ />
82
+ </View>
83
+ );
84
+ }
85
+ ```
86
+
87
+ ---
88
+
89
+ ## 📖 Components
90
+
91
+ ### `PopifyAlert`
92
+
93
+ A fully animated modal alert dialog with rich visuals.
94
+
95
+ ```jsx
96
+ <PopifyAlert
97
+ visible={true}
98
+ type="success"
99
+ title="Payment Successful! 🎉"
100
+ message="Your transaction has been processed."
101
+ showParticles
102
+ onClose={() => setVisible(false)}
103
+ buttons={[
104
+ { label: 'View Receipt', onPress: () => {} },
105
+ { label: 'Done', onPress: () => {}, outline: true },
106
+ ]}
107
+ />
108
+ ```
109
+
110
+ #### Props
111
+
112
+ | Prop | Type | Default | Description |
113
+ |------|------|---------|-------------|
114
+ | `visible` | `boolean` | `false` | Show or hide the alert |
115
+ | `type` | `'success' \| 'error' \| 'warning' \| 'info'` | `'info'` | Alert type — sets color & icon |
116
+ | `title` | `string` | — | Alert title text |
117
+ | `message` | `string` | — | Alert message body |
118
+ | `onClose` | `() => void` | — | Called when alert is dismissed |
119
+ | `buttons` | `Button[]` | `[]` | Array of action buttons (see below) |
120
+ | `animationType` | `'spring' \| 'slideUp' \| 'fadeIn'` | `'spring'` | Entrance animation style |
121
+ | `duration` | `number` | `350` | Animation duration in ms |
122
+ | `autoClose` | `boolean` | `false` | Auto-dismiss after timeout |
123
+ | `autoCloseDuration` | `number` | `3000` | Auto-close delay in ms |
124
+ | `showCloseButton` | `boolean` | `true` | Show the ✕ close button |
125
+ | `showIcon` | `boolean` | `true` | Show the type icon |
126
+ | `showParticles` | `boolean` | `false` | Enable particle burst animation |
127
+ | `customIcon` | `ReactNode` | — | Custom icon component |
128
+ | `buttonLayout` | `'horizontal' \| 'vertical' \| 'auto'` | `'auto'` | Button arrangement |
129
+ | `theme` | `'light' \| 'dark'` | `'light'` | Color theme |
130
+ | `titleStyle` | `TextStyle` | — | Custom title styles |
131
+ | `messageStyle` | `TextStyle` | — | Custom message styles |
132
+ | `containerStyle` | `ViewStyle` | — | Custom card container styles |
133
+ | `overlayStyle` | `ViewStyle` | — | Custom overlay styles |
134
+ | `renderHeader` | `() => ReactNode` | — | Custom header renderer |
135
+ | `renderFooter` | `() => ReactNode` | — | Custom footer renderer |
136
+
137
+ #### Button Object
138
+
139
+ | Property | Type | Required | Description |
140
+ |----------|------|----------|-------------|
141
+ | `label` | `string` | ✅ | Button text |
142
+ | `onPress` | `() => void` | ✅ | Press handler |
143
+ | `color` | `string` | — | Custom button color |
144
+ | `outline` | `boolean` | — | Outline style instead of filled |
145
+ | `style` | `ViewStyle` | — | Custom button style |
146
+ | `textStyle` | `TextStyle` | — | Custom button text style |
147
+
148
+ ---
149
+
150
+ ### `PopifyToast`
151
+
152
+ A lightweight, swipeable toast notification.
153
+
154
+ ```jsx
155
+ <PopifyToast
156
+ visible={true}
157
+ type="error"
158
+ title="Upload Failed"
159
+ message="The file could not be uploaded. Try again."
160
+ position="top"
161
+ duration={3500}
162
+ onClose={() => setVisible(false)}
163
+ />
164
+ ```
165
+
166
+ #### Props
167
+
168
+ | Prop | Type | Default | Description |
169
+ |------|------|---------|-------------|
170
+ | `visible` | `boolean` | `false` | Show or hide the toast |
171
+ | `type` | `'success' \| 'error' \| 'warning' \| 'info'` | `'info'` | Toast type — sets color & icon |
172
+ | `message` | `string` | `''` | Toast message text |
173
+ | `title` | `string` | — | Optional title above message |
174
+ | `position` | `'top' \| 'bottom'` | `'top'` | Screen position |
175
+ | `duration` | `number` | `3000` | Auto-dismiss delay in ms (0 to disable) |
176
+ | `onClose` | `() => void` | — | Called when toast is dismissed |
177
+ | `showProgress` | `boolean` | `true` | Show countdown progress bar |
178
+ | `showIcon` | `boolean` | `true` | Show the type icon |
179
+ | `theme` | `'light' \| 'dark'` | `'light'` | Color theme |
180
+ | `style` | `ViewStyle` | — | Custom container style |
181
+ | `customIcon` | `ReactNode` | — | Custom icon component |
182
+
183
+ > **Tip:** Swipe up (top toast) or down (bottom toast) to dismiss!
184
+
185
+ ---
186
+
187
+ ## 🎯 Examples
188
+
189
+ ### Success Alert with Particles
190
+
191
+ ```jsx
192
+ <PopifyAlert
193
+ visible={visible}
194
+ type="success"
195
+ title="Achievement Unlocked! 🏆"
196
+ message="You've completed 100 tasks!"
197
+ showParticles
198
+ onClose={() => setVisible(false)}
199
+ buttons={[{ label: 'Celebrate!', onPress: () => setVisible(false) }]}
200
+ />
201
+ ```
202
+
203
+ ### Dark Theme Alert
204
+
205
+ ```jsx
206
+ <PopifyAlert
207
+ visible={visible}
208
+ type="info"
209
+ theme="dark"
210
+ title="Dark Mode Active 🌙"
211
+ message="Enjoy the sleek dark interface."
212
+ onClose={() => setVisible(false)}
213
+ buttons={[
214
+ { label: 'Looks Great!', onPress: () => setVisible(false) },
215
+ { label: 'Switch to Light', onPress: () => setVisible(false), outline: true },
216
+ ]}
217
+ />
218
+ ```
219
+
220
+ ### Auto-Close Alert with Timer
221
+
222
+ ```jsx
223
+ <PopifyAlert
224
+ visible={visible}
225
+ type="info"
226
+ title="Session Expiring"
227
+ message="Your session will expire soon."
228
+ autoClose
229
+ autoCloseDuration={4000}
230
+ showCloseButton={false}
231
+ onClose={() => setVisible(false)}
232
+ buttons={[{ label: 'Extend Session', onPress: () => setVisible(false) }]}
233
+ />
234
+ ```
235
+
236
+ ### Multi-Button Vertical Layout
237
+
238
+ ```jsx
239
+ <PopifyAlert
240
+ visible={visible}
241
+ type="warning"
242
+ title="Save Changes?"
243
+ message="You have unsaved changes. What would you like to do?"
244
+ buttonLayout="vertical"
245
+ onClose={() => setVisible(false)}
246
+ buttons={[
247
+ { label: 'Save & Exit', onPress: () => {}, color: '#00C853' },
248
+ { label: 'Discard Changes', onPress: () => {}, color: '#FF3D71' },
249
+ { label: 'Continue Editing', onPress: () => {}, outline: true, color: '#FFAA00' },
250
+ ]}
251
+ />
252
+ ```
253
+
254
+ ### Slide-Up Animation
255
+
256
+ ```jsx
257
+ <PopifyAlert
258
+ visible={visible}
259
+ type="success"
260
+ animationType="slideUp"
261
+ title="Slide Animation ✨"
262
+ message="Smoothly slides up with a spring bounce."
263
+ onClose={() => setVisible(false)}
264
+ buttons={[{ label: 'Awesome!', onPress: () => setVisible(false) }]}
265
+ />
266
+ ```
267
+
268
+ ### Bottom Toast
269
+
270
+ ```jsx
271
+ <PopifyToast
272
+ visible={visible}
273
+ type="info"
274
+ position="bottom"
275
+ message="You're all caught up! No new notifications."
276
+ onClose={() => setVisible(false)}
277
+ duration={3000}
278
+ />
279
+ ```
280
+
281
+ ---
282
+
283
+ ## 🎨 Alert Types
284
+
285
+ | Type | Color | Icon | Use Case |
286
+ |------|-------|------|----------|
287
+ | `success` | 🟢 `#00C853` | ✓ | Confirmations, completions |
288
+ | `error` | 🔴 `#FF3D71` | ✕ | Failures, errors |
289
+ | `warning` | 🟡 `#FFAA00` | ! | Destructive actions, cautions |
290
+ | `info` | 🔵 `#3366FF` | i | Updates, information |
291
+
292
+ ---
293
+
294
+ ## 🏗️ Running the Example App
295
+
296
+ ```bash
297
+ # Clone the repository
298
+ git clone https://github.com/Qurat-ul-ainn/react-native-popify.git
299
+ cd react-native-popify
300
+
301
+ # Install dependencies
302
+ yarn install
303
+
304
+ # Run on iOS
305
+ cd example && yarn ios
306
+
307
+ # Run on Android
308
+ cd example && yarn android
309
+ ```
310
+
311
+ ---
312
+
313
+ ## 🤝 Contributing
314
+
315
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) before submitting a pull request.
316
+
317
+ ---
318
+
319
+ ## 📄 License
320
+
321
+ MIT © [Qurat-ul-ain](https://github.com/Qurat-ul-ainn)
322
+
323
+ ---
324
+
325
+ <div align="center">
326
+
327
+ **If you found this helpful, please ⭐ the repo — it means a lot!**
328
+
329
+ </div>
@@ -0,0 +1,77 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Popify_' + name]
4
+ }
5
+
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ }
10
+
11
+ dependencies {
12
+ classpath "com.android.tools.build:gradle:8.7.2"
13
+ // noinspection DifferentKotlinGradleVersion
14
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
15
+ }
16
+ }
17
+
18
+
19
+ apply plugin: "com.android.library"
20
+ apply plugin: "kotlin-android"
21
+
22
+ apply plugin: "com.facebook.react"
23
+
24
+ def getExtOrIntegerDefault(name) {
25
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Popify_" + name]).toInteger()
26
+ }
27
+
28
+ android {
29
+ namespace "com.popify"
30
+
31
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
32
+
33
+ defaultConfig {
34
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
35
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
36
+ }
37
+
38
+ buildFeatures {
39
+ buildConfig true
40
+ }
41
+
42
+ buildTypes {
43
+ release {
44
+ minifyEnabled false
45
+ }
46
+ }
47
+
48
+ lintOptions {
49
+ disable "GradleCompatible"
50
+ }
51
+
52
+ compileOptions {
53
+ sourceCompatibility JavaVersion.VERSION_1_8
54
+ targetCompatibility JavaVersion.VERSION_1_8
55
+ }
56
+
57
+ sourceSets {
58
+ main {
59
+ java.srcDirs += [
60
+ "generated/java",
61
+ "generated/jni"
62
+ ]
63
+ }
64
+ }
65
+ }
66
+
67
+ repositories {
68
+ mavenCentral()
69
+ google()
70
+ }
71
+
72
+ def kotlin_version = getExtOrDefault("kotlinVersion")
73
+
74
+ dependencies {
75
+ implementation "com.facebook.react:react-android"
76
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
77
+ }
@@ -0,0 +1,5 @@
1
+ Popify_kotlinVersion=2.0.21
2
+ Popify_minSdkVersion=24
3
+ Popify_targetSdkVersion=34
4
+ Popify_compileSdkVersion=35
5
+ Popify_ndkVersion=27.1.12297006
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,23 @@
1
+ package com.popify
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext
4
+ import com.facebook.react.module.annotations.ReactModule
5
+
6
+ @ReactModule(name = PopifyModule.NAME)
7
+ class PopifyModule(reactContext: ReactApplicationContext) :
8
+ NativePopifySpec(reactContext) {
9
+
10
+ override fun getName(): String {
11
+ return NAME
12
+ }
13
+
14
+ // Example method
15
+ // See https://reactnative.dev/docs/native-modules-android
16
+ override fun multiply(a: Double, b: Double): Double {
17
+ return a * b
18
+ }
19
+
20
+ companion object {
21
+ const val NAME = "Popify"
22
+ }
23
+ }
@@ -0,0 +1,33 @@
1
+ package com.popify
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+ import java.util.HashMap
9
+
10
+ class PopifyPackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == PopifyModule.NAME) {
13
+ PopifyModule(reactContext)
14
+ } else {
15
+ null
16
+ }
17
+ }
18
+
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
22
+ moduleInfos[PopifyModule.NAME] = ReactModuleInfo(
23
+ PopifyModule.NAME,
24
+ PopifyModule.NAME,
25
+ false, // canOverrideExistingModule
26
+ false, // needsEagerInit
27
+ false, // isCxxModule
28
+ true // isTurboModule
29
+ )
30
+ moduleInfos
31
+ }
32
+ }
33
+ }
package/ios/Popify.h ADDED
@@ -0,0 +1,5 @@
1
+ #import <PopifySpec/PopifySpec.h>
2
+
3
+ @interface Popify : NSObject <NativePopifySpec>
4
+
5
+ @end
package/ios/Popify.mm ADDED
@@ -0,0 +1,18 @@
1
+ #import "Popify.h"
2
+
3
+ @implementation Popify
4
+ RCT_EXPORT_MODULE()
5
+
6
+ - (NSNumber *)multiply:(double)a b:(double)b {
7
+ NSNumber *result = @(a * b);
8
+
9
+ return result;
10
+ }
11
+
12
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
13
+ (const facebook::react::ObjCTurboModule::InitParams &)params
14
+ {
15
+ return std::make_shared<facebook::react::NativePopifySpecJSI>(params);
16
+ }
17
+
18
+ @end
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('Popify');
5
+ //# sourceMappingURL=NativePopify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativePopify.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAMpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,QAAQ,CAAC","ignoreList":[]}