@mehul214/react-native-flash-toast 0.0.0-stage → 1.0.1
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 +22 -0
- package/README.md +251 -2
- package/dist/index.d.mts +240 -0
- package/dist/index.d.ts +242 -0
- package/dist/index.js +749 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +730 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +87 -4
- package/src/FlashMessage.tsx +436 -0
- package/src/FlashMessageManager.ts +71 -0
- package/src/FlashMessageProvider.tsx +48 -0
- package/src/hooks/useFlashMessage.ts +2 -0
- package/src/icons.tsx +154 -0
- package/src/index.ts +31 -0
- package/src/styles.ts +145 -0
- package/src/types.ts +101 -0
- package/src/utils/safeArea.ts +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mehul
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,252 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mehul214/react-native-flash-toast ⚡️
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@mehul214/react-native-flash-toast)
|
|
4
|
+
[](https://www.npmjs.com/package/@mehul214/react-native-flash-toast)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://reactnative.dev)
|
|
8
|
+
[](CONTRIBUTING.md)
|
|
9
|
+
[](https://github.com/sponsors/Mehul214)
|
|
10
|
+
[](https://buymeacoffee.com/mehulreshac)
|
|
11
|
+
[](#-support-via-upi)
|
|
12
|
+
|
|
13
|
+
> Next-generation flash message, alert bar, and toast notification library for **React Native** and **Expo**. Built for the **New Architecture (Fabric)**, modern safe areas, dynamic islands, and interactive swipe-to-dismiss gestures.
|
|
14
|
+
|
|
15
|
+
A modern, drop-in replacement for the outdated `react-native-flash-message` package.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📱 Preview
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<table align="center">
|
|
23
|
+
<tr>
|
|
24
|
+
<th align="center"><b>iOS (Dynamic Island & Swipe)</b></th>
|
|
25
|
+
<th align="center"><b>Android (Edge-to-Edge)</b></th>
|
|
26
|
+
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<td align="center">
|
|
29
|
+
<img src="assets/demo-ios.gif" width="300" alt="iOS Preview" />
|
|
30
|
+
</td>
|
|
31
|
+
<td align="center">
|
|
32
|
+
<img src="assets/demo-android.gif" width="300" alt="Android Preview" />
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
</table>
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🌟 Why react-native-flash-toast?
|
|
41
|
+
|
|
42
|
+
| Feature | `react-native-flash-message` (Legacy) | `react-native-flash-toast` (This Package) |
|
|
43
|
+
| :--- | :---: | :---: |
|
|
44
|
+
| **New Architecture (Fabric)** | ⚠️ Deprecated / Layout warnings | ✅ **100% Native Driver & Fabric Ready** |
|
|
45
|
+
| **Edge-to-Edge / Dynamic Island** | ❌ Hardcoded iPhone X dimensions | ✅ **Auto-adaptive safe-area insets** |
|
|
46
|
+
| **Gestures** | ❌ No swipe gesture dismissal | ✅ **Smooth swipe-up / swipe-down to dismiss** |
|
|
47
|
+
| **Countdown Timer Progress Bar** | ❌ None | ✅ **Built-in animated progress bar** |
|
|
48
|
+
| **Pause on Press** | ❌ None | ✅ **Pauses autoHide timer while held** |
|
|
49
|
+
| **Action Buttons** | ❌ Manual boilerplate | ✅ **Native Action Buttons (Undo, Retry)** |
|
|
50
|
+
| **React Hooks** | ❌ Global ref only | ✅ **Both `useFlashMessage()` hook & global `showMessage()`** |
|
|
51
|
+
| **Zero Native Dependencies** | ✅ Pure JS/TS | ✅ **Pure JS/TS (Works in Expo Go instantly)** |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 📦 Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install @mehul214/react-native-flash-toast
|
|
59
|
+
# or
|
|
60
|
+
yarn add @mehul214/react-native-flash-toast
|
|
61
|
+
# or
|
|
62
|
+
pnpm add @mehul214/react-native-flash-toast
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
*(No `pod install` or native linking required!)*
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 🚀 Quick Start
|
|
70
|
+
|
|
71
|
+
### 1. Mount the Container
|
|
72
|
+
|
|
73
|
+
Add `<FlashMessage />` at the root of your application (typically in `App.tsx` or your root layout component):
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import React from 'react';
|
|
77
|
+
import { View } from 'react-native';
|
|
78
|
+
import { FlashMessage } from '@mehul214/react-native-flash-toast';
|
|
79
|
+
|
|
80
|
+
export default function App() {
|
|
81
|
+
return (
|
|
82
|
+
<View style={{ flex: 1 }}>
|
|
83
|
+
<YourAppNavigator />
|
|
84
|
+
{/* Place at the very end so it renders above everything */}
|
|
85
|
+
<FlashMessage position="top" />
|
|
86
|
+
</View>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 2. Trigger from Anywhere!
|
|
92
|
+
|
|
93
|
+
Call `showMessage` anywhere in your code — inside components, hooks, navigation listeners, Redux sagas, Zustand stores, or API error interceptors:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { showMessage, hideMessage } from '@mehul214/react-native-flash-toast';
|
|
97
|
+
|
|
98
|
+
// Simple success message
|
|
99
|
+
showMessage({
|
|
100
|
+
message: 'Payment Successful!',
|
|
101
|
+
description: 'Your subscription is now active.',
|
|
102
|
+
type: 'success',
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Danger / Error alert
|
|
106
|
+
showMessage({
|
|
107
|
+
message: 'Failed to upload image',
|
|
108
|
+
description: 'Please check your internet connection.',
|
|
109
|
+
type: 'danger',
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Bottom toast with action button & progress bar
|
|
113
|
+
showMessage({
|
|
114
|
+
message: 'Item moved to Archive',
|
|
115
|
+
type: 'default',
|
|
116
|
+
position: 'bottom',
|
|
117
|
+
showProgressBar: true,
|
|
118
|
+
action: {
|
|
119
|
+
label: 'Undo',
|
|
120
|
+
onPress: () => console.log('Undoing action...'),
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 🪝 React Hook Usage
|
|
128
|
+
|
|
129
|
+
Prefer modern React hooks? Wrap your app with `<FlashMessageProvider>`:
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { FlashMessageProvider, useFlashMessage } from '@mehul214/react-native-flash-toast';
|
|
133
|
+
|
|
134
|
+
function Root() {
|
|
135
|
+
return (
|
|
136
|
+
<FlashMessageProvider position="top">
|
|
137
|
+
<App />
|
|
138
|
+
</FlashMessageProvider>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function ProfileScreen() {
|
|
143
|
+
const { show, hide } = useFlashMessage();
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<Button
|
|
147
|
+
title="Save"
|
|
148
|
+
onPress={() =>
|
|
149
|
+
show({
|
|
150
|
+
message: 'Saved!',
|
|
151
|
+
type: 'success',
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## 🎨 Semantic Types & Built-in Themes
|
|
162
|
+
|
|
163
|
+
| Type | Default Background | Default Icon | Intended Use |
|
|
164
|
+
| :--- | :--- | :--- | :--- |
|
|
165
|
+
| `success` | `#059669` (Emerald) | ✓ Checkmark | Confirmed actions, saved states |
|
|
166
|
+
| `danger` | `#DC2626` (Red) | ✕ Close | Errors, network failures |
|
|
167
|
+
| `warning` | `#D97706` (Amber) | ! Warning | Disconnections, low storage |
|
|
168
|
+
| `info` | `#2563EB` (Blue) | ℹ Info | Informational alerts, updates |
|
|
169
|
+
| `default` | `#1F2937` (Dark Slate) | ● Bullet | Neutral toasts & notifications |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## ⚙️ Options & API Reference
|
|
174
|
+
|
|
175
|
+
| Option | Type | Default | Description |
|
|
176
|
+
| :--- | :--- | :--- | :--- |
|
|
177
|
+
| `message` | `string \| ReactNode` | **Required** | The main title or text content |
|
|
178
|
+
| `description` | `string \| ReactNode` | `undefined` | Secondary subtitle or detailed message |
|
|
179
|
+
| `type` | `'default' \| 'success' \| 'danger' \| 'warning' \| 'info'` | `'default'` | Semantic color preset |
|
|
180
|
+
| `position` | `'top' \| 'bottom' \| 'center'` | `'top'` | Screen anchor position |
|
|
181
|
+
| `duration` | `number` | `3000` | Auto-dismiss duration in ms (0 to disable) |
|
|
182
|
+
| `autoHide` | `boolean` | `true` | Automatically dismiss after duration |
|
|
183
|
+
| `floating` | `boolean` | `true` | Modern rounded floating card vs edge-to-edge |
|
|
184
|
+
| `swipeToDismiss` | `boolean` | `true` | Swipe up (or down) gesture to dismiss |
|
|
185
|
+
| `pauseOnPress` | `boolean` | `true` | Pauses countdown timer while finger holds card |
|
|
186
|
+
| `showProgressBar`| `boolean` | `false` | Displays visual countdown progress indicator |
|
|
187
|
+
| `action` | `{ label, onPress, style?, textStyle? }` | `undefined` | Action button (e.g. Undo, Retry) |
|
|
188
|
+
| `icon` | `FlashMessageType \| 'none' \| ReactNode \| Function` | Semantic type | Custom or preset icon |
|
|
189
|
+
| `backgroundColor`| `string` | Preset background | Override card color |
|
|
190
|
+
| `color` | `string` | Preset text color | Override text & icon color |
|
|
191
|
+
| `onPress` | `() => void` | `undefined` | Callback on banner tap |
|
|
192
|
+
| `onShow` | `() => void` | `undefined` | Callback when message enters view |
|
|
193
|
+
| `onHide` | `() => void` | `undefined` | Callback after message finishes exit |
|
|
194
|
+
| `customComponent`| `(options, hide) => ReactNode` | `undefined` | Completely replace the inner card layout |
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 🔄 Migrating from `react-native-flash-message`
|
|
199
|
+
|
|
200
|
+
Migrating is 100% drop-in compatible! Simply change the import:
|
|
201
|
+
|
|
202
|
+
```diff
|
|
203
|
+
- import FlashMessage, { showMessage, hideMessage } from "react-native-flash-message";
|
|
204
|
+
+ import FlashMessage, { showMessage, hideMessage } from "@mehul214/react-native-flash-toast";
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Your existing `showMessage({ message, description, type, ... })` calls will work immediately, but with:
|
|
208
|
+
- No more New Architecture Fabric warnings
|
|
209
|
+
- Native iOS & Android edge-to-edge support
|
|
210
|
+
- Modern fluid spring animations & swipe gestures
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 💖 Support the Project & Sponsoring
|
|
215
|
+
|
|
216
|
+
Building and maintaining open-source libraries takes dedicated effort. If `react-native-flash-toast` helps you build great React Native applications or saves your team time, please consider supporting development:
|
|
217
|
+
|
|
218
|
+
- ⭐️ **Star the repository on GitHub** (helps more developers discover it)
|
|
219
|
+
- 💖 **[Sponsor on GitHub Sponsors](https://github.com/sponsors/Mehul214)**
|
|
220
|
+
- ☕️ **[Buy Me a Coffee](https://buymeacoffee.com/mehulreshac)**
|
|
221
|
+
|
|
222
|
+
<p align="left">
|
|
223
|
+
<a href="https://buymeacoffee.com/mehulreshac" target="_blank">
|
|
224
|
+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="42" />
|
|
225
|
+
</a>
|
|
226
|
+
</p>
|
|
227
|
+
|
|
228
|
+
### ☕️ Support via UPI
|
|
229
|
+
|
|
230
|
+
If you're in India or use any UPI-enabled payment app (Google Pay, PhonePe, Paytm, BHIM, Cred, Amazon Pay):
|
|
231
|
+
|
|
232
|
+
- **UPI ID:** `mehulreshamwala7@okhdfcbank`
|
|
233
|
+
- **Payee Name:** Mehul Reshamwala
|
|
234
|
+
|
|
235
|
+
<p align="left">
|
|
236
|
+
<a href="upi://pay?pa=mehulreshamwala7@okhdfcbank&pn=Mehul%20Reshamwala&cu=INR&tn=Support%20react-native-flash-toast">
|
|
237
|
+
<img src="https://api.qrserver.com/v1/create-qr-code/?size=180x180&data=upi%3A%2F%2Fpay%3Fpa%3Dmehulreshamwala7%40okhdfcbank%26pn%3DMehul%2520Reshamwala%26cu%3DINR%26tn%3DSupport%2520react-native-flash-toast" alt="Scan to Pay with UPI" width="180" height="180" />
|
|
238
|
+
</a>
|
|
239
|
+
<br />
|
|
240
|
+
<sub>Scan with Google Pay / PhonePe / Paytm or <a href="upi://pay?pa=mehulreshamwala7@okhdfcbank&pn=Mehul%20Reshamwala&cu=INR&tn=Support%20react-native-flash-toast">tap here on mobile to pay directly</a>.</sub>
|
|
241
|
+
</p>
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 🤝 Contributing
|
|
246
|
+
|
|
247
|
+
Contributions, feature requests, and bug reports are welcome! Please check the [Contributing Guide](CONTRIBUTING.md).
|
|
248
|
+
|
|
249
|
+
## 📄 License
|
|
250
|
+
|
|
251
|
+
MIT © 2026 Mehul. Free for personal and commercial use.
|
|
2
252
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type FlashMessageType = 'default' | 'success' | 'danger' | 'warning' | 'info';
|
|
5
|
+
type FlashMessagePosition = 'top' | 'bottom' | 'center';
|
|
6
|
+
type FlashMessageTransition = 'slide' | 'fade' | 'bounce';
|
|
7
|
+
type FlashMessageIcon = FlashMessageType | 'none' | ReactNode | ((props: {
|
|
8
|
+
size: number;
|
|
9
|
+
color: string;
|
|
10
|
+
}) => ReactNode);
|
|
11
|
+
interface FlashMessageAction {
|
|
12
|
+
label: string;
|
|
13
|
+
onPress: () => void;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
textStyle?: StyleProp<TextStyle>;
|
|
16
|
+
}
|
|
17
|
+
interface FlashMessageOptions {
|
|
18
|
+
/** Unique ID for the message. Auto-generated if not provided */
|
|
19
|
+
id?: string;
|
|
20
|
+
/** Primary title or content */
|
|
21
|
+
message: string | ReactNode;
|
|
22
|
+
/** Secondary subtitle or body content */
|
|
23
|
+
description?: string | ReactNode;
|
|
24
|
+
/** Preset semantic style */
|
|
25
|
+
type?: FlashMessageType;
|
|
26
|
+
/** Screen position: 'top', 'bottom', or 'center'. Default: 'top' */
|
|
27
|
+
position?: FlashMessagePosition;
|
|
28
|
+
/** Display duration in milliseconds before auto-hiding. Default: 3000ms. Set to 0 to disable */
|
|
29
|
+
duration?: number;
|
|
30
|
+
/** Whether the message auto-dismisses after duration. Default: true */
|
|
31
|
+
autoHide?: boolean;
|
|
32
|
+
/** Floating pill with rounded corners vs edge-to-edge bar. Default: true */
|
|
33
|
+
floating?: boolean;
|
|
34
|
+
/** Preset or custom icon */
|
|
35
|
+
icon?: FlashMessageIcon;
|
|
36
|
+
/** Interactive action button (e.g. Undo, Retry) */
|
|
37
|
+
action?: FlashMessageAction;
|
|
38
|
+
/** Callback fired when the flash message card is tapped */
|
|
39
|
+
onPress?: () => void;
|
|
40
|
+
/** Callback fired when the flash message is long-pressed */
|
|
41
|
+
onLongPress?: () => void;
|
|
42
|
+
/** Callback fired after the message appears */
|
|
43
|
+
onShow?: () => void;
|
|
44
|
+
/** Callback fired after the message has fully hidden */
|
|
45
|
+
onHide?: () => void;
|
|
46
|
+
/** Custom container style */
|
|
47
|
+
style?: StyleProp<ViewStyle>;
|
|
48
|
+
/** Custom title text style */
|
|
49
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
50
|
+
/** Custom description text style */
|
|
51
|
+
textStyle?: StyleProp<TextStyle>;
|
|
52
|
+
/** Override background color */
|
|
53
|
+
backgroundColor?: string;
|
|
54
|
+
/** Override text and icon color */
|
|
55
|
+
color?: string;
|
|
56
|
+
/** Dismiss when tapped. Default: true */
|
|
57
|
+
hideOnPress?: boolean;
|
|
58
|
+
/** Enable swipe up/down gesture to dismiss. Default: true */
|
|
59
|
+
swipeToDismiss?: boolean;
|
|
60
|
+
/** Temporarily pause the autoHide timer while finger touches the banner. Default: true */
|
|
61
|
+
pauseOnPress?: boolean;
|
|
62
|
+
/** Show an animated countdown progress bar at the bottom of the card. Default: false */
|
|
63
|
+
showProgressBar?: boolean;
|
|
64
|
+
/** Transition animation style: 'slide' | 'fade' | 'bounce'. Default: 'slide' */
|
|
65
|
+
transition?: FlashMessageTransition;
|
|
66
|
+
/** Override manual top inset / status bar height if needed */
|
|
67
|
+
statusBarHeight?: number;
|
|
68
|
+
/** Custom render function to completely override inner layout */
|
|
69
|
+
customComponent?: (options: FlashMessageOptions, hide: () => void) => ReactNode;
|
|
70
|
+
}
|
|
71
|
+
interface FlashMessageRef {
|
|
72
|
+
showMessage: (options: FlashMessageOptions) => void;
|
|
73
|
+
hideMessage: () => void;
|
|
74
|
+
}
|
|
75
|
+
interface FlashMessageContainerProps {
|
|
76
|
+
/** Default position for all messages if not specified in options */
|
|
77
|
+
position?: FlashMessagePosition;
|
|
78
|
+
/** Default duration in ms. Default: 3000 */
|
|
79
|
+
duration?: number;
|
|
80
|
+
/** Default floating style. Default: true */
|
|
81
|
+
floating?: boolean;
|
|
82
|
+
/** Default transition. Default: 'slide' */
|
|
83
|
+
transition?: FlashMessageTransition;
|
|
84
|
+
/** Optional top status bar offset */
|
|
85
|
+
statusBarOffset?: number;
|
|
86
|
+
/** Optional bottom navigation bar offset */
|
|
87
|
+
bottomOffset?: number;
|
|
88
|
+
/** Extra container style */
|
|
89
|
+
style?: StyleProp<ViewStyle>;
|
|
90
|
+
/** Can message replace current one immediately or queue. Default: 'replace' */
|
|
91
|
+
mode?: 'replace' | 'queue';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare const FlashMessage: React.ForwardRefExoticComponent<FlashMessageContainerProps & React.RefAttributes<FlashMessageRef>>;
|
|
95
|
+
|
|
96
|
+
declare class FlashMessageManager {
|
|
97
|
+
private defaultInstance;
|
|
98
|
+
private instances;
|
|
99
|
+
private pendingQueue;
|
|
100
|
+
register(ref: FlashMessageRef, id?: string): void;
|
|
101
|
+
unregister(id?: string): void;
|
|
102
|
+
showMessage(options: FlashMessageOptions, targetId?: string): void;
|
|
103
|
+
hideMessage(targetId?: string): void;
|
|
104
|
+
}
|
|
105
|
+
declare const flashManager: FlashMessageManager;
|
|
106
|
+
/**
|
|
107
|
+
* Imperative helper to trigger a flash message from anywhere in the app
|
|
108
|
+
* (services, Zustand, Redux, API handlers, navigation screens).
|
|
109
|
+
*/
|
|
110
|
+
declare function showMessage(options: FlashMessageOptions): void;
|
|
111
|
+
/**
|
|
112
|
+
* Imperative helper to dismiss the currently displayed flash message.
|
|
113
|
+
*/
|
|
114
|
+
declare function hideMessage(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Modern alias for showMessage
|
|
117
|
+
*/
|
|
118
|
+
declare const flash: typeof showMessage;
|
|
119
|
+
declare const dismissFlash: typeof hideMessage;
|
|
120
|
+
|
|
121
|
+
interface FlashMessageContextValue {
|
|
122
|
+
show: (options: FlashMessageOptions) => void;
|
|
123
|
+
hide: () => void;
|
|
124
|
+
}
|
|
125
|
+
interface FlashMessageProviderProps extends FlashMessageContainerProps {
|
|
126
|
+
children: React.ReactNode;
|
|
127
|
+
}
|
|
128
|
+
declare const FlashMessageProvider: React.FC<FlashMessageProviderProps>;
|
|
129
|
+
declare function useFlashMessage(): FlashMessageContextValue;
|
|
130
|
+
|
|
131
|
+
interface BuiltInIconProps {
|
|
132
|
+
type: FlashMessageType;
|
|
133
|
+
size?: number;
|
|
134
|
+
color?: string;
|
|
135
|
+
}
|
|
136
|
+
declare const BuiltInIcon: React.FC<BuiltInIconProps>;
|
|
137
|
+
|
|
138
|
+
declare const COLORS: Record<FlashMessageType, {
|
|
139
|
+
background: string;
|
|
140
|
+
text: string;
|
|
141
|
+
icon: string;
|
|
142
|
+
}>;
|
|
143
|
+
declare const styles: {
|
|
144
|
+
rootOverlay: {
|
|
145
|
+
position: "absolute";
|
|
146
|
+
left: number;
|
|
147
|
+
right: number;
|
|
148
|
+
zIndex: number;
|
|
149
|
+
elevation: number;
|
|
150
|
+
};
|
|
151
|
+
rootTop: {
|
|
152
|
+
top: number;
|
|
153
|
+
};
|
|
154
|
+
rootBottom: {
|
|
155
|
+
bottom: number;
|
|
156
|
+
};
|
|
157
|
+
rootCenter: {
|
|
158
|
+
top: number;
|
|
159
|
+
bottom: number;
|
|
160
|
+
justifyContent: "center";
|
|
161
|
+
alignItems: "center";
|
|
162
|
+
};
|
|
163
|
+
toastContainer: any;
|
|
164
|
+
floatingContainer: {
|
|
165
|
+
marginHorizontal: number;
|
|
166
|
+
borderRadius: number;
|
|
167
|
+
borderWidth: number;
|
|
168
|
+
borderColor: string;
|
|
169
|
+
};
|
|
170
|
+
edgeToEdgeContainer: {
|
|
171
|
+
marginHorizontal: number;
|
|
172
|
+
borderRadius: number;
|
|
173
|
+
};
|
|
174
|
+
contentWrapper: {
|
|
175
|
+
flex: number;
|
|
176
|
+
flexDirection: "row";
|
|
177
|
+
alignItems: "center";
|
|
178
|
+
paddingVertical: number;
|
|
179
|
+
paddingHorizontal: number;
|
|
180
|
+
};
|
|
181
|
+
iconContainer: {
|
|
182
|
+
marginRight: number;
|
|
183
|
+
justifyContent: "center";
|
|
184
|
+
alignItems: "center";
|
|
185
|
+
};
|
|
186
|
+
iconBadge: {
|
|
187
|
+
width: number;
|
|
188
|
+
height: number;
|
|
189
|
+
borderRadius: number;
|
|
190
|
+
backgroundColor: string;
|
|
191
|
+
justifyContent: "center";
|
|
192
|
+
alignItems: "center";
|
|
193
|
+
};
|
|
194
|
+
textContainer: {
|
|
195
|
+
flex: number;
|
|
196
|
+
justifyContent: "center";
|
|
197
|
+
};
|
|
198
|
+
titleText: {
|
|
199
|
+
fontSize: number;
|
|
200
|
+
fontWeight: "600";
|
|
201
|
+
letterSpacing: number;
|
|
202
|
+
lineHeight: number;
|
|
203
|
+
color: string;
|
|
204
|
+
};
|
|
205
|
+
descriptionText: {
|
|
206
|
+
fontSize: number;
|
|
207
|
+
fontWeight: "400";
|
|
208
|
+
color: string;
|
|
209
|
+
marginTop: number;
|
|
210
|
+
lineHeight: number;
|
|
211
|
+
};
|
|
212
|
+
actionButton: {
|
|
213
|
+
marginLeft: number;
|
|
214
|
+
paddingHorizontal: number;
|
|
215
|
+
paddingVertical: number;
|
|
216
|
+
borderRadius: number;
|
|
217
|
+
backgroundColor: string;
|
|
218
|
+
borderWidth: number;
|
|
219
|
+
borderColor: string;
|
|
220
|
+
};
|
|
221
|
+
actionButtonText: {
|
|
222
|
+
fontSize: number;
|
|
223
|
+
fontWeight: "600";
|
|
224
|
+
color: string;
|
|
225
|
+
};
|
|
226
|
+
progressBarContainer: {
|
|
227
|
+
position: "absolute";
|
|
228
|
+
bottom: number;
|
|
229
|
+
left: number;
|
|
230
|
+
right: number;
|
|
231
|
+
height: number;
|
|
232
|
+
backgroundColor: string;
|
|
233
|
+
};
|
|
234
|
+
progressBarFill: {
|
|
235
|
+
height: "100%";
|
|
236
|
+
backgroundColor: string;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export { BuiltInIcon, COLORS, FlashMessage, type FlashMessageAction, type FlashMessageContainerProps, type FlashMessageIcon, type FlashMessageOptions, type FlashMessagePosition, FlashMessageProvider, type FlashMessageRef, type FlashMessageTransition, type FlashMessageType, FlashMessage as default, dismissFlash, flash, flashManager, hideMessage, showMessage, styles, useFlashMessage };
|