crossnotify 0.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.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +181 -0
  3. package/lib/module/Provider.js +27 -0
  4. package/lib/module/Provider.js.map +1 -0
  5. package/lib/module/Toast.native.js +323 -0
  6. package/lib/module/Toast.native.js.map +1 -0
  7. package/lib/module/Toaster.native.js +130 -0
  8. package/lib/module/Toaster.native.js.map +1 -0
  9. package/lib/module/index.js +6 -0
  10. package/lib/module/index.js.map +1 -0
  11. package/lib/module/index.web.js +85 -0
  12. package/lib/module/index.web.js.map +1 -0
  13. package/lib/module/notify.js +67 -0
  14. package/lib/module/notify.js.map +1 -0
  15. package/lib/module/package.json +1 -0
  16. package/lib/module/store.js +95 -0
  17. package/lib/module/store.js.map +1 -0
  18. package/lib/module/types.js +2 -0
  19. package/lib/module/types.js.map +1 -0
  20. package/lib/typescript/package.json +1 -0
  21. package/lib/typescript/src/Provider.d.ts +9 -0
  22. package/lib/typescript/src/Provider.d.ts.map +1 -0
  23. package/lib/typescript/src/Toast.native.d.ts +15 -0
  24. package/lib/typescript/src/Toast.native.d.ts.map +1 -0
  25. package/lib/typescript/src/Toaster.native.d.ts +7 -0
  26. package/lib/typescript/src/Toaster.native.d.ts.map +1 -0
  27. package/lib/typescript/src/index.d.ts +6 -0
  28. package/lib/typescript/src/index.d.ts.map +1 -0
  29. package/lib/typescript/src/index.web.d.ts +22 -0
  30. package/lib/typescript/src/index.web.d.ts.map +1 -0
  31. package/lib/typescript/src/notify.d.ts +13 -0
  32. package/lib/typescript/src/notify.d.ts.map +1 -0
  33. package/lib/typescript/src/store.d.ts +29 -0
  34. package/lib/typescript/src/store.d.ts.map +1 -0
  35. package/lib/typescript/src/types.d.ts +47 -0
  36. package/lib/typescript/src/types.d.ts.map +1 -0
  37. package/package.json +146 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sam Dingore
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.
package/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # crossnotify
2
+
3
+ One cross-platform in-app notification API for React Native / Expo apps.
4
+ Call `notify()` and get a native-feeling toast on iOS, a clean fallback on
5
+ Android, and a [sonner](https://sonner.emilkowal.ski/) toast on web — same
6
+ function call, same options, every platform.
7
+
8
+ ```ts
9
+ notify.success('Profile updated');
10
+ ```
11
+
12
+ - **Zero runtime dependencies.** Everything is a peer dependency, so you only
13
+ ship what you already have installed.
14
+ - **No native modules.** The iOS toast is composed from `expo-blur` +
15
+ `react-native-reanimated` + `expo-symbols` + `expo-haptics` in plain JS —
16
+ no Swift, Kotlin, or C++, no custom dev client requirement beyond what
17
+ those Expo packages already need.
18
+ - **One imperative API.** `notify()`, `.success()`, `.error()`, `.loading()`,
19
+ `.promise()`, `.dismiss()` — call it from anywhere, no hooks, no context
20
+ reads at the call site.
21
+
22
+ ## Install
23
+
24
+ ```sh
25
+ npm install crossnotify
26
+ ```
27
+
28
+ `crossnotify` declares its React/RN/Expo/web dependencies as peers so it
29
+ never pins a version you don't control. Install whichever of these your app
30
+ uses:
31
+
32
+ ```sh
33
+ npx expo install expo-blur expo-haptics expo-symbols react-native-reanimated react-native-safe-area-context
34
+ ```
35
+
36
+ For web, install `sonner` instead:
37
+
38
+ ```sh
39
+ npm install sonner
40
+ ```
41
+
42
+ Every peer is optional. Missing one degrades gracefully — see
43
+ [Platform notes](#platform-notes).
44
+
45
+ ## Quick start
46
+
47
+ Mount `CrossNotifyProvider` once, near the root of your app:
48
+
49
+ ```tsx
50
+ import { CrossNotifyProvider } from 'crossnotify';
51
+
52
+ export default function App() {
53
+ return (
54
+ <CrossNotifyProvider>
55
+ <RestOfYourApp />
56
+ </CrossNotifyProvider>
57
+ );
58
+ }
59
+ ```
60
+
61
+ Then call `notify` from anywhere — event handlers, async functions,
62
+ anywhere you'd normally reach for a toast library:
63
+
64
+ ```ts
65
+ import { notify } from 'crossnotify';
66
+
67
+ notify('Saved');
68
+ notify.success('Profile updated');
69
+ notify.error('Something went wrong');
70
+ ```
71
+
72
+ Wrap an async action with `notify.promise` to show loading → success/error
73
+ in place, without juggling ids yourself:
74
+
75
+ ```ts
76
+ notify.promise(uploadReport(), {
77
+ loading: 'Uploading report...',
78
+ success: (name) => `Uploaded ${name}`,
79
+ error: (error) => `Upload failed: ${error.message}`,
80
+ });
81
+ ```
82
+
83
+ ## API
84
+
85
+ ### `notify(message, options?)`
86
+
87
+ Shows a default-variant toast. Returns the toast's `id`.
88
+
89
+ ### `notify.success(message, options?)` / `.error(...)` / `.loading(...)`
90
+
91
+ Same signature, fixed variant. `loading` toasts are sticky by default (no
92
+ auto-dismiss) unless you pass an explicit `duration`.
93
+
94
+ ### `notify.promise(promise, messages, options?)`
95
+
96
+ Shows a loading toast immediately, then updates it in place to success or
97
+ error once `promise` settles. Returns the original promise so you can still
98
+ `await`/`.then()` it. `messages.success` and `messages.error` may be a
99
+ string or a function of the resolved value / thrown error.
100
+
101
+ ### `notify.dismiss(id?)`
102
+
103
+ Dismisses the toast with the given `id`, or every visible toast if called
104
+ with no argument.
105
+
106
+ ### Update in place
107
+
108
+ Pass the same `id` to `notify()` (or any variant) twice and the second call
109
+ updates the existing toast instead of stacking a new one — this is how
110
+ `notify.promise` moves a toast from loading to success/error under the hood.
111
+
112
+ ```ts
113
+ notify('Step 1 of 3', { id: 'onboarding' });
114
+ // ...later
115
+ notify('Step 2 of 3', { id: 'onboarding' });
116
+ ```
117
+
118
+ ### `NotifyOptions`
119
+
120
+ | Option | Type | Default |
121
+ | ------------- | ------------------------------------------------ | --------------------------- |
122
+ | `id` | `string` | auto-generated |
123
+ | `description` | `string` | — |
124
+ | `variant` | `'default' \| 'success' \| 'error' \| 'loading'` | `'default'` |
125
+ | `preset` | `'native' \| 'glass' \| 'flat' \| 'minimal'` | provider default (`'native'`)|
126
+ | `position` | `'top' \| 'bottom'` | provider default (`'bottom'`)|
127
+ | `duration` | `number` (ms) | `4000`, `Infinity` for loading |
128
+
129
+ `0` and `Infinity` both mean sticky (no auto-dismiss).
130
+
131
+ ### Presets
132
+
133
+ | Preset | Look |
134
+ | --------- | -------------------------------------------------------- |
135
+ | `native` | Blurred pill, iOS system material (default) |
136
+ | `glass` | Blurred pill, thinner/lighter material |
137
+ | `flat` | Solid pill with elevation/shadow, no blur |
138
+ | `minimal` | Same as `flat` — reserved for future lighter-weight styling|
139
+
140
+ Presets only affect the native renderer; web always renders through sonner's
141
+ own styling.
142
+
143
+ ### `CrossNotifyProvider`
144
+
145
+ ```tsx
146
+ <CrossNotifyProvider
147
+ defaults={{ position: 'top', duration: 3000, maxVisible: 2 }}
148
+ theme={{ backgroundColor: '#1c1c1e', accentColor: '#0a84ff' }}
149
+ >
150
+ <App />
151
+ </CrossNotifyProvider>
152
+ ```
153
+
154
+ `defaults` and `theme` are read once, at mount. Anything you don't override
155
+ falls back to crossnotify's own defaults (dark theme, bottom position,
156
+ 4s duration, 3 toasts visible at once).
157
+
158
+ ## Platform notes
159
+
160
+ Import from `crossnotify` and Metro/webpack resolve the right file for the
161
+ platform automatically (`.native.tsx` on iOS/Android, `index.web.ts` on web)
162
+ — nothing to configure.
163
+
164
+ On native, every non-React peer (`expo-blur`, `expo-haptics`,
165
+ `expo-symbols`, `react-native-reanimated`, `react-native-safe-area-context`)
166
+ is optional and detected at runtime. Without it you still get a fully
167
+ functional toast — auto-dismiss, tap-to-dismiss, update-in-place all work —
168
+ you just lose that peer's polish: no blur (falls back to a solid pill), no
169
+ haptic on show, a generic dot instead of an SF Symbol, no spring
170
+ animation, and a fixed safe-area approximation instead of the device's real
171
+ insets.
172
+
173
+ On web, crossnotify is a thin wrapper around sonner: `<CrossNotifyProvider>`
174
+ renders sonner's `<Toaster>` for you, and every `notify` call maps onto
175
+ sonner's own toast functions. If you already like sonner, this is sonner;
176
+ crossnotify's value on web is only that your call sites don't change when
177
+ you cross over from native.
178
+
179
+ ## License
180
+
181
+ MIT
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ import { Fragment, useEffect } from 'react';
4
+ import { store } from "./store.js";
5
+ import { Toaster } from "./Toaster.native.js";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ export function CrossNotifyProvider({
8
+ children,
9
+ defaults,
10
+ theme
11
+ }) {
12
+ useEffect(() => {
13
+ if (defaults) {
14
+ store.setDefaults(defaults);
15
+ }
16
+ if (theme) {
17
+ store.setTheme(theme);
18
+ }
19
+ // Defaults/theme are meant to be written once at mount; this provider isn't
20
+ // designed to react to prop changes after that.
21
+ // eslint-disable-next-line react-hooks/exhaustive-deps
22
+ }, []);
23
+ return /*#__PURE__*/_jsxs(Fragment, {
24
+ children: [children, /*#__PURE__*/_jsx(Toaster, {})]
25
+ });
26
+ }
27
+ //# sourceMappingURL=Provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Fragment","useEffect","store","Toaster","jsx","_jsx","jsxs","_jsxs","CrossNotifyProvider","children","defaults","theme","setDefaults","setTheme"],"sourceRoot":"../../src","sources":["Provider.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,SAASC,KAAK,QAAQ,YAAS;AAC/B,SAASC,OAAO,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS3C,OAAO,SAASC,mBAAmBA,CAAC;EAClCC,QAAQ;EACRC,QAAQ;EACRC;AACwB,CAAC,EAAE;EAC3BV,SAAS,CAAC,MAAM;IACd,IAAIS,QAAQ,EAAE;MACZR,KAAK,CAACU,WAAW,CAACF,QAAQ,CAAC;IAC7B;IACA,IAAIC,KAAK,EAAE;MACTT,KAAK,CAACW,QAAQ,CAACF,KAAK,CAAC;IACvB;IACA;IACA;IACA;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEJ,KAAA,CAACP,QAAQ;IAAAS,QAAA,GACNA,QAAQ,eACTJ,IAAA,CAACF,OAAO,IAAE,CAAC;EAAA,CACH,CAAC;AAEf","ignoreList":[]}
@@ -0,0 +1,323 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useRef } from 'react';
4
+ import { Platform, Pressable, StyleSheet, Text, View } from 'react-native';
5
+ import { store } from "./store.js";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ // Optional peers. Each require() below must stay inline, directly inside its
8
+ // own try/catch, right here in this file — Metro only bundles an unresolved
9
+ // module without hard-failing the build when it can statically see a
10
+ // `require('literal')` call sitting inside a try block in the SAME file
11
+ // (see metro's collectDependencies.js `isOptionalDependency`, which walks up
12
+ // the AST from the call site looking for an enclosing TryStatement). Routing
13
+ // the call through a shared helper function defeats that check — the
14
+ // try/catch would live in the helper's file, invisible to the AST Metro
15
+ // walks when it processes this one — so the "shared helper" here is really
16
+ // just this repeated, consistent shape rather than one indirection function.
17
+ let BlurView = null;
18
+ try {
19
+ BlurView = require('expo-blur').BlurView;
20
+ } catch {
21
+ BlurView = null;
22
+ }
23
+ let Haptics = null;
24
+ try {
25
+ Haptics = require('expo-haptics');
26
+ } catch {
27
+ Haptics = null;
28
+ }
29
+ let SymbolView = null;
30
+ try {
31
+ SymbolView = require('expo-symbols').SymbolView;
32
+ } catch {
33
+ SymbolView = null;
34
+ }
35
+ let Reanimated = null;
36
+ try {
37
+ Reanimated = require('react-native-reanimated');
38
+ } catch {
39
+ Reanimated = null;
40
+ }
41
+
42
+ /** Test-only: lets __tests__ assert the guards resolved to null when a peer is absent. */
43
+ export const __optionalPeers = {
44
+ BlurView,
45
+ Haptics,
46
+ SymbolView,
47
+ Reanimated
48
+ };
49
+ const SYMBOL_BY_VARIANT = {
50
+ default: 'bell.fill',
51
+ success: 'checkmark.circle.fill',
52
+ error: 'xmark.circle.fill',
53
+ loading: 'arrow.clockwise'
54
+ };
55
+ const PRESET_CONFIG = {
56
+ native: {
57
+ blur: true,
58
+ tint: 'systemMaterialDark'
59
+ },
60
+ glass: {
61
+ blur: true,
62
+ tint: 'systemUltraThinMaterialDark'
63
+ },
64
+ flat: {
65
+ blur: false,
66
+ tint: 'dark'
67
+ },
68
+ minimal: {
69
+ blur: false,
70
+ tint: 'dark'
71
+ }
72
+ };
73
+ export function Toast(props) {
74
+ if (Reanimated) {
75
+ return /*#__PURE__*/_jsx(ReanimatedToast, {
76
+ ...props,
77
+ reanimated: Reanimated
78
+ });
79
+ }
80
+ return /*#__PURE__*/_jsx(InstantToast, {
81
+ ...props
82
+ });
83
+ }
84
+ function useHapticsOnMount(variant) {
85
+ useEffect(() => {
86
+ if (Platform.OS !== 'ios' || !Haptics) {
87
+ return;
88
+ }
89
+ const feedback = variant === 'success' ? Haptics.NotificationFeedbackType.Success : variant === 'error' ? Haptics.NotificationFeedbackType.Error : null;
90
+ if (feedback) {
91
+ Haptics.notificationAsync(feedback);
92
+ } else {
93
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
94
+ }
95
+ // Fire once per mount; re-firing haptics on every prop change is unwanted.
96
+ // eslint-disable-next-line react-hooks/exhaustive-deps
97
+ }, []);
98
+ }
99
+ function useAutoDismissTimer(toast, dismiss) {
100
+ useEffect(() => {
101
+ if (!Number.isFinite(toast.duration) || toast.duration <= 0) {
102
+ return;
103
+ }
104
+ const timer = setTimeout(dismiss, toast.duration);
105
+ return () => clearTimeout(timer);
106
+ // Restart the auto-dismiss timer whenever an update-in-place changes duration/variant.
107
+ // eslint-disable-next-line react-hooks/exhaustive-deps
108
+ }, [toast.id, toast.duration, toast.variant]);
109
+ }
110
+ function ReanimatedToast({
111
+ toast,
112
+ onRequestDismiss,
113
+ reanimated
114
+ }) {
115
+ const {
116
+ useSharedValue,
117
+ useAnimatedStyle,
118
+ withSpring,
119
+ withTiming,
120
+ runOnJS,
121
+ Easing,
122
+ default: Animated
123
+ } = reanimated;
124
+ const progress = useSharedValue(0);
125
+ const dismissing = useRef(false);
126
+ const dismiss = () => {
127
+ if (dismissing.current) {
128
+ return;
129
+ }
130
+ dismissing.current = true;
131
+ progress.value = withTiming(0, {
132
+ duration: 180,
133
+ easing: Easing.in(Easing.cubic)
134
+ }, finished => {
135
+ if (finished) {
136
+ runOnJS(onRequestDismiss)(toast.id);
137
+ }
138
+ });
139
+ };
140
+ useHapticsOnMount(toast.variant);
141
+ useAutoDismissTimer(toast, dismiss);
142
+ useEffect(() => {
143
+ progress.value = withSpring(1, {
144
+ damping: 18,
145
+ stiffness: 220
146
+ });
147
+ // eslint-disable-next-line react-hooks/exhaustive-deps
148
+ }, []);
149
+ const animatedStyle = useAnimatedStyle(() => {
150
+ const direction = toast.position === 'top' ? -1 : 1;
151
+ return {
152
+ opacity: progress.value,
153
+ transform: [{
154
+ translateY: (1 - progress.value) * 24 * direction
155
+ }, {
156
+ scale: 0.92 + progress.value * 0.08
157
+ }]
158
+ };
159
+ });
160
+ return /*#__PURE__*/_jsx(Animated.View, {
161
+ style: [styles.wrapper, animatedStyle],
162
+ accessibilityRole: "alert",
163
+ accessibilityLiveRegion: "polite",
164
+ children: /*#__PURE__*/_jsx(ToastBody, {
165
+ toast: toast,
166
+ dismiss: dismiss
167
+ })
168
+ });
169
+ }
170
+
171
+ // TODO: Animated fallback — port the spring-in/timing-out choreography to
172
+ // React Native's built-in Animated API instead of skipping motion entirely.
173
+ // Deferred for this pass: reanimated's API (shared values, worklets,
174
+ // useAnimatedStyle) has no drop-in equivalent in RN's Animated, so a faithful
175
+ // port is a real second implementation, not a shim. Without reanimated the
176
+ // toast is still fully functional — auto-dismiss, tap-to-dismiss,
177
+ // update-in-place all work — it just appears/disappears instantly.
178
+ function InstantToast({
179
+ toast,
180
+ onRequestDismiss
181
+ }) {
182
+ const dismiss = () => onRequestDismiss(toast.id);
183
+ useHapticsOnMount(toast.variant);
184
+ useAutoDismissTimer(toast, dismiss);
185
+ return /*#__PURE__*/_jsx(View, {
186
+ style: styles.wrapper,
187
+ accessibilityRole: "alert",
188
+ accessibilityLiveRegion: "polite",
189
+ children: /*#__PURE__*/_jsx(ToastBody, {
190
+ toast: toast,
191
+ dismiss: dismiss
192
+ })
193
+ });
194
+ }
195
+ function ToastBody({
196
+ toast,
197
+ dismiss
198
+ }) {
199
+ const theme = store.getTheme();
200
+ const preset = PRESET_CONFIG[toast.preset];
201
+ const tintColor = toast.variant === 'success' ? theme.successColor : toast.variant === 'error' ? theme.errorColor : theme.accentColor;
202
+ const content = /*#__PURE__*/_jsxs(View, {
203
+ style: styles.content,
204
+ children: [/*#__PURE__*/_jsx(ToastIcon, {
205
+ variant: toast.variant,
206
+ color: tintColor
207
+ }), /*#__PURE__*/_jsxs(View, {
208
+ style: styles.textContainer,
209
+ children: [/*#__PURE__*/_jsx(Text, {
210
+ style: [styles.message, {
211
+ color: theme.textColor
212
+ }],
213
+ numberOfLines: 2,
214
+ children: toast.message
215
+ }), toast.description ? /*#__PURE__*/_jsx(Text, {
216
+ style: [styles.description, {
217
+ color: theme.textColor
218
+ }],
219
+ numberOfLines: 2,
220
+ children: toast.description
221
+ }) : null]
222
+ })]
223
+ });
224
+
225
+ // expo-blur may be absent even for presets that want it; fall back to the
226
+ // same solid elevated pill the flat/minimal presets use, just no blur.
227
+ if (preset.blur && BlurView) {
228
+ const Blur = BlurView;
229
+ return /*#__PURE__*/_jsx(Pressable, {
230
+ onPress: dismiss,
231
+ style: styles.pressable,
232
+ children: /*#__PURE__*/_jsx(Blur, {
233
+ intensity: theme.blurIntensity,
234
+ tint: preset.tint,
235
+ style: [styles.pill, {
236
+ borderRadius: theme.radius
237
+ }],
238
+ children: content
239
+ })
240
+ });
241
+ }
242
+ return /*#__PURE__*/_jsx(Pressable, {
243
+ onPress: dismiss,
244
+ style: styles.pressable,
245
+ children: /*#__PURE__*/_jsx(View, {
246
+ style: [styles.pill, styles.flatPill, {
247
+ borderRadius: theme.radius,
248
+ backgroundColor: theme.backgroundColor
249
+ }],
250
+ children: content
251
+ })
252
+ });
253
+ }
254
+ function ToastIcon({
255
+ variant,
256
+ color
257
+ }) {
258
+ if (Platform.OS === 'ios' && SymbolView) {
259
+ const Symbol = SymbolView;
260
+ return /*#__PURE__*/_jsx(Symbol, {
261
+ name: SYMBOL_BY_VARIANT[variant],
262
+ tintColor: color,
263
+ style: styles.icon
264
+ });
265
+ }
266
+ return /*#__PURE__*/_jsx(View, {
267
+ style: [styles.iconFallback, {
268
+ backgroundColor: color
269
+ }]
270
+ });
271
+ }
272
+ const styles = StyleSheet.create({
273
+ wrapper: {
274
+ width: '100%',
275
+ alignItems: 'center'
276
+ },
277
+ pressable: {
278
+ maxWidth: '92%'
279
+ },
280
+ pill: {
281
+ overflow: 'hidden'
282
+ },
283
+ flatPill: {
284
+ shadowColor: '#000',
285
+ shadowOffset: {
286
+ width: 0,
287
+ height: 4
288
+ },
289
+ shadowOpacity: 0.2,
290
+ shadowRadius: 12,
291
+ elevation: 4
292
+ },
293
+ content: {
294
+ flexDirection: 'row',
295
+ alignItems: 'center',
296
+ gap: 10,
297
+ paddingVertical: 12,
298
+ paddingHorizontal: 16,
299
+ minWidth: 200
300
+ },
301
+ icon: {
302
+ width: 22,
303
+ height: 22
304
+ },
305
+ iconFallback: {
306
+ width: 10,
307
+ height: 10,
308
+ borderRadius: 5
309
+ },
310
+ textContainer: {
311
+ flexShrink: 1
312
+ },
313
+ message: {
314
+ fontSize: 15,
315
+ fontWeight: '600'
316
+ },
317
+ description: {
318
+ fontSize: 13,
319
+ opacity: 0.8,
320
+ marginTop: 2
321
+ }
322
+ });
323
+ //# sourceMappingURL=Toast.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","Platform","Pressable","StyleSheet","Text","View","store","jsx","_jsx","jsxs","_jsxs","BlurView","require","Haptics","SymbolView","Reanimated","__optionalPeers","SYMBOL_BY_VARIANT","default","success","error","loading","PRESET_CONFIG","native","blur","tint","glass","flat","minimal","Toast","props","ReanimatedToast","reanimated","InstantToast","useHapticsOnMount","variant","OS","feedback","NotificationFeedbackType","Success","Error","notificationAsync","impactAsync","ImpactFeedbackStyle","Light","useAutoDismissTimer","toast","dismiss","Number","isFinite","duration","timer","setTimeout","clearTimeout","id","onRequestDismiss","useSharedValue","useAnimatedStyle","withSpring","withTiming","runOnJS","Easing","Animated","progress","dismissing","current","value","easing","in","cubic","finished","damping","stiffness","animatedStyle","direction","position","opacity","transform","translateY","scale","style","styles","wrapper","accessibilityRole","accessibilityLiveRegion","children","ToastBody","theme","getTheme","preset","tintColor","successColor","errorColor","accentColor","content","ToastIcon","color","textContainer","message","textColor","numberOfLines","description","Blur","onPress","pressable","intensity","blurIntensity","pill","borderRadius","radius","flatPill","backgroundColor","Symbol","name","icon","iconFallback","create","width","alignItems","maxWidth","overflow","shadowColor","shadowOffset","height","shadowOpacity","shadowRadius","elevation","flexDirection","gap","paddingVertical","paddingHorizontal","minWidth","flexShrink","fontSize","fontWeight","marginTop"],"sourceRoot":"../../src","sources":["Toast.native.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAE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