react-native-notitoast 0.0.0-stage → 2.0.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 +21 -0
- package/README.md +201 -2
- package/lib/commonjs/ToastItem.js +504 -0
- package/lib/commonjs/ToastItem.js.map +1 -0
- package/lib/commonjs/ToastProvider.js +84 -0
- package/lib/commonjs/ToastProvider.js.map +1 -0
- package/lib/commonjs/index.js +26 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme.js +41 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/toast.js +39 -0
- package/lib/commonjs/toast.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/ToastItem.js +500 -0
- package/lib/module/ToastItem.js.map +1 -0
- package/lib/module/ToastProvider.js +80 -0
- package/lib/module/ToastProvider.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/theme.js +37 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/toast.js +33 -0
- package/lib/module/toast.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/ToastItem.d.ts +12 -0
- package/lib/typescript/src/ToastItem.d.ts.map +1 -0
- package/lib/typescript/src/ToastProvider.d.ts +7 -0
- package/lib/typescript/src/ToastProvider.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/theme.d.ts +21 -0
- package/lib/typescript/src/theme.d.ts.map +1 -0
- package/lib/typescript/src/toast.d.ts +23 -0
- package/lib/typescript/src/toast.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +93 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +77 -6
- package/src/ToastItem.tsx +597 -0
- package/src/ToastProvider.tsx +93 -0
- package/src/index.ts +14 -0
- package/src/theme.ts +39 -0
- package/src/toast.ts +51 -0
- package/src/types.ts +109 -0
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToastItem = ToastItem;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _theme = require("./theme");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/** Per-toast values win over provider values, but `undefined` never overrides. */
|
|
12
|
+
function mergeAppearance(base, over) {
|
|
13
|
+
const out = {
|
|
14
|
+
...base
|
|
15
|
+
};
|
|
16
|
+
for (const [key, value] of Object.entries(over)) {
|
|
17
|
+
if (value !== undefined) out[key] = value;
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
function ToastItem({
|
|
22
|
+
toast,
|
|
23
|
+
config,
|
|
24
|
+
scheme,
|
|
25
|
+
topOffset,
|
|
26
|
+
bottomOffset,
|
|
27
|
+
onExited
|
|
28
|
+
}) {
|
|
29
|
+
const o = mergeAppearance(config, toast);
|
|
30
|
+
const type = toast.type ?? 'info';
|
|
31
|
+
const isTop = (o.position ?? 'top') === 'top';
|
|
32
|
+
const duration = toast.duration ?? config.durations?.[type] ?? config.duration ?? _theme.defaultDurations[type];
|
|
33
|
+
const showProgress = o.showProgress ?? false;
|
|
34
|
+
const variant = o.variant ?? 'default';
|
|
35
|
+
const filled = variant === 'filled';
|
|
36
|
+
const accent = toast.accentColor ?? config.colors?.[type] ?? _theme.typeColors[type];
|
|
37
|
+
const palette = _theme.palettes[scheme];
|
|
38
|
+
const glyph = _theme.typeGlyphs[type];
|
|
39
|
+
|
|
40
|
+
// Colors
|
|
41
|
+
const onFilled = type === 'warning' ? '#111827' : '#FFFFFF';
|
|
42
|
+
const cardBg = o.backgroundColor ?? (filled ? accent : palette.card);
|
|
43
|
+
const borderColor = o.borderColor ?? (filled ? 'transparent' : palette.border);
|
|
44
|
+
const titleColor = o.titleColor ?? (filled ? onFilled : palette.title);
|
|
45
|
+
const messageColor = o.messageColor ?? (filled ? onFilled : palette.message);
|
|
46
|
+
const badgeBg = filled ? onFilled : accent;
|
|
47
|
+
const badgeGlyph = filled ? accent : '#FFFFFF';
|
|
48
|
+
|
|
49
|
+
// Layout pieces
|
|
50
|
+
const imagePosition = o.imagePosition ?? 'right';
|
|
51
|
+
const showIcon = o.showIcon ?? true;
|
|
52
|
+
const leftImage = (imagePosition === 'left' ? toast.image : undefined) ?? toast.icon ?? o.appIcon;
|
|
53
|
+
const rightImage = imagePosition === 'right' ? toast.image : undefined;
|
|
54
|
+
const showTypeIcon = !leftImage && showIcon;
|
|
55
|
+
const showCornerBadge = !!leftImage && showIcon && (o.showTypeBadge ?? true);
|
|
56
|
+
const hasLeft = !!leftImage || showTypeIcon;
|
|
57
|
+
const showAccentBar = o.showAccentBar ?? (!hasLeft && !filled);
|
|
58
|
+
|
|
59
|
+
// Sizes
|
|
60
|
+
const radius = o.borderRadius ?? 18;
|
|
61
|
+
const iconSize = o.iconSize ?? 40;
|
|
62
|
+
const imageSize = o.imageSize ?? 44;
|
|
63
|
+
const innerBadge = Math.round(iconSize * 0.55);
|
|
64
|
+
const cornerBadge = Math.max(14, Math.round(iconSize * 0.42));
|
|
65
|
+
const titleLines = o.titleLines ?? 1;
|
|
66
|
+
const messageLines = o.messageLines ?? 3;
|
|
67
|
+
const hiddenY = isTop ? -(topOffset + 200) : bottomOffset + 200;
|
|
68
|
+
const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(hiddenY)).current;
|
|
69
|
+
const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
70
|
+
const progress = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
|
|
71
|
+
const exiting = (0, _react.useRef)(false);
|
|
72
|
+
const onExitedRef = (0, _react.useRef)(onExited);
|
|
73
|
+
onExitedRef.current = onExited;
|
|
74
|
+
const onHideRef = (0, _react.useRef)(toast.onHide);
|
|
75
|
+
onHideRef.current = toast.onHide;
|
|
76
|
+
const translateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
77
|
+
const dragging = (0, _react.useRef)(false);
|
|
78
|
+
|
|
79
|
+
// Swipe directions. `swipeable: false` turns all of them off.
|
|
80
|
+
const swipeable = o.swipeable ?? true;
|
|
81
|
+
const swipe = {
|
|
82
|
+
left: swipeable && (o.swipeLeft ?? true),
|
|
83
|
+
right: swipeable && (o.swipeRight ?? true),
|
|
84
|
+
up: swipeable && (o.swipeUp ?? isTop),
|
|
85
|
+
down: swipeable && (o.swipeDown ?? !isTop)
|
|
86
|
+
};
|
|
87
|
+
const swipeRef = (0, _react.useRef)(swipe);
|
|
88
|
+
swipeRef.current = swipe;
|
|
89
|
+
const pauseTimer = () => progress.stopAnimation();
|
|
90
|
+
const startTimer = () => {
|
|
91
|
+
if (duration <= 0 || exiting.current || dragging.current) return;
|
|
92
|
+
progress.stopAnimation(value => {
|
|
93
|
+
_reactNative.Animated.timing(progress, {
|
|
94
|
+
toValue: 0,
|
|
95
|
+
duration: value * duration,
|
|
96
|
+
easing: _reactNative.Easing.linear,
|
|
97
|
+
useNativeDriver: false
|
|
98
|
+
}).start(({
|
|
99
|
+
finished
|
|
100
|
+
}) => {
|
|
101
|
+
if (finished) dismiss();
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/** `direction` = swipe direction the toast leaves in; default slides back to its edge. */
|
|
107
|
+
const dismiss = direction => {
|
|
108
|
+
if (exiting.current) return;
|
|
109
|
+
exiting.current = true;
|
|
110
|
+
progress.stopAnimation();
|
|
111
|
+
const {
|
|
112
|
+
width,
|
|
113
|
+
height
|
|
114
|
+
} = _reactNative.Dimensions.get('window');
|
|
115
|
+
const horizontal = direction === 'left' || direction === 'right';
|
|
116
|
+
const target = direction === 'left' ? -width : direction === 'right' ? width : direction === 'up' ? -height : direction === 'down' ? height : hiddenY;
|
|
117
|
+
_reactNative.Animated.parallel([_reactNative.Animated.timing(horizontal ? translateX : translateY, {
|
|
118
|
+
toValue: target,
|
|
119
|
+
duration: direction ? 200 : 240,
|
|
120
|
+
easing: direction ? _reactNative.Easing.out(_reactNative.Easing.quad) : _reactNative.Easing.in(_reactNative.Easing.cubic),
|
|
121
|
+
useNativeDriver: true
|
|
122
|
+
}), _reactNative.Animated.timing(opacity, {
|
|
123
|
+
toValue: 0,
|
|
124
|
+
duration: 200,
|
|
125
|
+
useNativeDriver: true
|
|
126
|
+
})]).start(() => {
|
|
127
|
+
onHideRef.current?.();
|
|
128
|
+
onExitedRef.current();
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Latest-closure ref so the (once-created) PanResponder never goes stale.
|
|
133
|
+
const actions = (0, _react.useRef)({
|
|
134
|
+
dismiss,
|
|
135
|
+
startTimer,
|
|
136
|
+
pauseTimer
|
|
137
|
+
});
|
|
138
|
+
actions.current = {
|
|
139
|
+
dismiss,
|
|
140
|
+
startTimer,
|
|
141
|
+
pauseTimer
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Axis locked when the drag starts, so a swipe moves on one axis only.
|
|
145
|
+
const axis = (0, _react.useRef)('y');
|
|
146
|
+
const snapBack = () => {
|
|
147
|
+
dragging.current = false;
|
|
148
|
+
_reactNative.Animated.parallel([_reactNative.Animated.spring(translateX, {
|
|
149
|
+
toValue: 0,
|
|
150
|
+
useNativeDriver: true
|
|
151
|
+
}), _reactNative.Animated.spring(translateY, {
|
|
152
|
+
toValue: 0,
|
|
153
|
+
useNativeDriver: true
|
|
154
|
+
})]).start();
|
|
155
|
+
actions.current.startTimer();
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/** Allowed direction follows the finger; a blocked one only gives a little. */
|
|
159
|
+
const follow = (d, negOk, posOk) => d < 0 ? negOk ? d : d * 0.15 : posOk ? d : d * 0.15;
|
|
160
|
+
const pan = (0, _react.useRef)(_reactNative.PanResponder.create({
|
|
161
|
+
onMoveShouldSetPanResponder: (_, g) => {
|
|
162
|
+
const s = swipeRef.current;
|
|
163
|
+
const absX = Math.abs(g.dx);
|
|
164
|
+
const absY = Math.abs(g.dy);
|
|
165
|
+
if (absX > absY) return absX > 8 && (s.left || s.right);
|
|
166
|
+
return absY > 6 && (s.up || s.down);
|
|
167
|
+
},
|
|
168
|
+
onPanResponderGrant: (_, g) => {
|
|
169
|
+
axis.current = Math.abs(g.dx) > Math.abs(g.dy) ? 'x' : 'y';
|
|
170
|
+
dragging.current = true;
|
|
171
|
+
actions.current.pauseTimer();
|
|
172
|
+
},
|
|
173
|
+
onPanResponderMove: (_, g) => {
|
|
174
|
+
const s = swipeRef.current;
|
|
175
|
+
if (axis.current === 'x') {
|
|
176
|
+
translateX.setValue(follow(g.dx, s.left, s.right));
|
|
177
|
+
} else {
|
|
178
|
+
translateY.setValue(follow(g.dy, s.up, s.down));
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
onPanResponderRelease: (_, g) => {
|
|
182
|
+
const s = swipeRef.current;
|
|
183
|
+
let direction;
|
|
184
|
+
if (axis.current === 'x') {
|
|
185
|
+
if (s.left && (g.dx < -80 || g.vx < -0.5)) direction = 'left';else if (s.right && (g.dx > 80 || g.vx > 0.5)) direction = 'right';
|
|
186
|
+
} else {
|
|
187
|
+
if (s.up && (g.dy < -24 || g.vy < -0.6)) direction = 'up';else if (s.down && (g.dy > 24 || g.vy > 0.6)) direction = 'down';
|
|
188
|
+
}
|
|
189
|
+
if (direction) {
|
|
190
|
+
dragging.current = false;
|
|
191
|
+
actions.current.dismiss(direction);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
snapBack();
|
|
195
|
+
},
|
|
196
|
+
onPanResponderTerminate: () => snapBack(),
|
|
197
|
+
onPanResponderTerminationRequest: () => false
|
|
198
|
+
})).current;
|
|
199
|
+
|
|
200
|
+
// Enter animation + announce for screen readers.
|
|
201
|
+
(0, _react.useEffect)(() => {
|
|
202
|
+
_reactNative.Animated.parallel([_reactNative.Animated.spring(translateY, {
|
|
203
|
+
toValue: 0,
|
|
204
|
+
damping: 18,
|
|
205
|
+
stiffness: 180,
|
|
206
|
+
mass: 0.9,
|
|
207
|
+
useNativeDriver: true
|
|
208
|
+
}), _reactNative.Animated.timing(opacity, {
|
|
209
|
+
toValue: 1,
|
|
210
|
+
duration: 220,
|
|
211
|
+
useNativeDriver: true
|
|
212
|
+
})]).start();
|
|
213
|
+
startTimer();
|
|
214
|
+
const spoken = [toast.title, toast.message].filter(Boolean).join('. ');
|
|
215
|
+
if (spoken) _reactNative.AccessibilityInfo.announceForAccessibility(spoken);
|
|
216
|
+
return () => progress.stopAnimation();
|
|
217
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
218
|
+
}, []);
|
|
219
|
+
|
|
220
|
+
// Same id shown again → content updated, restart the timer.
|
|
221
|
+
const firstRev = (0, _react.useRef)(toast.rev);
|
|
222
|
+
(0, _react.useEffect)(() => {
|
|
223
|
+
if (toast.rev === firstRev.current) return;
|
|
224
|
+
progress.stopAnimation();
|
|
225
|
+
progress.setValue(1);
|
|
226
|
+
startTimer();
|
|
227
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
228
|
+
}, [toast.rev, duration]);
|
|
229
|
+
(0, _react.useEffect)(() => {
|
|
230
|
+
if (toast.dismissing) dismiss();
|
|
231
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
232
|
+
}, [toast.dismissing]);
|
|
233
|
+
const handlePress = () => {
|
|
234
|
+
toast.onPress?.();
|
|
235
|
+
dismiss();
|
|
236
|
+
};
|
|
237
|
+
const barWidth = progress.interpolate({
|
|
238
|
+
inputRange: [0, 1],
|
|
239
|
+
outputRange: ['0%', '100%']
|
|
240
|
+
});
|
|
241
|
+
const sizeStyle = {
|
|
242
|
+
...(o.width !== undefined && {
|
|
243
|
+
width: o.width
|
|
244
|
+
}),
|
|
245
|
+
...(o.maxWidth !== undefined && {
|
|
246
|
+
maxWidth: o.maxWidth
|
|
247
|
+
}),
|
|
248
|
+
...(o.minHeight !== undefined && {
|
|
249
|
+
minHeight: o.minHeight
|
|
250
|
+
}),
|
|
251
|
+
...(o.height !== undefined && {
|
|
252
|
+
height: o.height
|
|
253
|
+
})
|
|
254
|
+
};
|
|
255
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
256
|
+
pointerEvents: "box-none",
|
|
257
|
+
style: [styles.container, isTop ? {
|
|
258
|
+
top: topOffset
|
|
259
|
+
} : {
|
|
260
|
+
bottom: bottomOffset
|
|
261
|
+
}, {
|
|
262
|
+
opacity,
|
|
263
|
+
transform: [{
|
|
264
|
+
translateX
|
|
265
|
+
}, {
|
|
266
|
+
translateY
|
|
267
|
+
}]
|
|
268
|
+
}],
|
|
269
|
+
...pan.panHandlers,
|
|
270
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
271
|
+
style: [styles.shadow, {
|
|
272
|
+
backgroundColor: cardBg,
|
|
273
|
+
borderColor,
|
|
274
|
+
borderRadius: radius
|
|
275
|
+
}, sizeStyle, o.style],
|
|
276
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
277
|
+
onPress: handlePress,
|
|
278
|
+
onPressIn: pauseTimer,
|
|
279
|
+
onPressOut: startTimer,
|
|
280
|
+
accessibilityRole: "alert",
|
|
281
|
+
accessibilityLiveRegion: "polite",
|
|
282
|
+
style: [styles.card, {
|
|
283
|
+
borderRadius: radius
|
|
284
|
+
}],
|
|
285
|
+
children: [variant === 'tinted' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
286
|
+
pointerEvents: "none",
|
|
287
|
+
style: [styles.fill, {
|
|
288
|
+
backgroundColor: accent,
|
|
289
|
+
opacity: scheme === 'dark' ? 0.16 : 0.08
|
|
290
|
+
}]
|
|
291
|
+
}) : null, showAccentBar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
292
|
+
style: [styles.accentBar, {
|
|
293
|
+
backgroundColor: accent
|
|
294
|
+
}]
|
|
295
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
296
|
+
style: [styles.row, showAccentBar && styles.rowWithBar, !hasLeft && styles.rowTextOnly],
|
|
297
|
+
children: [leftImage ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
298
|
+
style: {
|
|
299
|
+
width: iconSize,
|
|
300
|
+
height: iconSize
|
|
301
|
+
},
|
|
302
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
303
|
+
source: leftImage,
|
|
304
|
+
style: {
|
|
305
|
+
width: iconSize,
|
|
306
|
+
height: iconSize,
|
|
307
|
+
borderRadius: Math.round(iconSize * 0.28)
|
|
308
|
+
}
|
|
309
|
+
}), showCornerBadge ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
310
|
+
style: [styles.cornerBadge, {
|
|
311
|
+
width: cornerBadge,
|
|
312
|
+
height: cornerBadge,
|
|
313
|
+
borderRadius: cornerBadge / 2,
|
|
314
|
+
backgroundColor: badgeBg,
|
|
315
|
+
borderColor: cardBg
|
|
316
|
+
}],
|
|
317
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
318
|
+
style: [styles.glyph, {
|
|
319
|
+
color: badgeGlyph,
|
|
320
|
+
fontSize: Math.round(cornerBadge * 0.5),
|
|
321
|
+
lineHeight: Math.round(cornerBadge * 0.62)
|
|
322
|
+
}],
|
|
323
|
+
children: glyph
|
|
324
|
+
})
|
|
325
|
+
}) : null]
|
|
326
|
+
}) : showTypeIcon ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
327
|
+
style: [styles.iconWrap, {
|
|
328
|
+
width: iconSize,
|
|
329
|
+
height: iconSize,
|
|
330
|
+
borderRadius: Math.round(iconSize * 0.3)
|
|
331
|
+
}],
|
|
332
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
333
|
+
style: [styles.fill, {
|
|
334
|
+
backgroundColor: filled ? '#FFFFFF' : accent,
|
|
335
|
+
opacity: filled ? 0.22 : 0.12
|
|
336
|
+
}]
|
|
337
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
338
|
+
style: [styles.innerBadge, {
|
|
339
|
+
width: innerBadge,
|
|
340
|
+
height: innerBadge,
|
|
341
|
+
borderRadius: innerBadge / 2,
|
|
342
|
+
backgroundColor: badgeBg
|
|
343
|
+
}],
|
|
344
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
345
|
+
style: [styles.glyph, {
|
|
346
|
+
color: badgeGlyph,
|
|
347
|
+
fontSize: Math.round(innerBadge * 0.58),
|
|
348
|
+
lineHeight: Math.round(innerBadge * 0.72)
|
|
349
|
+
}],
|
|
350
|
+
children: glyph
|
|
351
|
+
})
|
|
352
|
+
})]
|
|
353
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
354
|
+
style: styles.texts,
|
|
355
|
+
children: [toast.title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
356
|
+
numberOfLines: titleLines,
|
|
357
|
+
style: [styles.title, {
|
|
358
|
+
color: titleColor
|
|
359
|
+
}, o.titleStyle],
|
|
360
|
+
children: toast.title
|
|
361
|
+
}) : null, toast.message ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
362
|
+
numberOfLines: messageLines,
|
|
363
|
+
style: [styles.message, {
|
|
364
|
+
color: messageColor
|
|
365
|
+
}, filled && styles.softText, o.messageStyle],
|
|
366
|
+
children: toast.message
|
|
367
|
+
}) : null]
|
|
368
|
+
}), rightImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
369
|
+
source: rightImage,
|
|
370
|
+
style: {
|
|
371
|
+
width: imageSize,
|
|
372
|
+
height: imageSize,
|
|
373
|
+
borderRadius: Math.round(imageSize * 0.23)
|
|
374
|
+
}
|
|
375
|
+
}) : null]
|
|
376
|
+
}), showProgress && duration > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
377
|
+
style: [styles.track, {
|
|
378
|
+
backgroundColor: filled ? 'rgba(255,255,255,0.25)' : palette.track
|
|
379
|
+
}],
|
|
380
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
381
|
+
style: [styles.bar, {
|
|
382
|
+
backgroundColor: filled ? onFilled : accent,
|
|
383
|
+
width: barWidth
|
|
384
|
+
}]
|
|
385
|
+
})
|
|
386
|
+
}) : null]
|
|
387
|
+
})
|
|
388
|
+
})
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
const styles = _reactNative.StyleSheet.create({
|
|
392
|
+
container: {
|
|
393
|
+
position: 'absolute',
|
|
394
|
+
left: 0,
|
|
395
|
+
right: 0,
|
|
396
|
+
paddingHorizontal: 12,
|
|
397
|
+
alignItems: 'center',
|
|
398
|
+
zIndex: 9999,
|
|
399
|
+
elevation: 9999
|
|
400
|
+
},
|
|
401
|
+
shadow: {
|
|
402
|
+
width: '100%',
|
|
403
|
+
maxWidth: 560,
|
|
404
|
+
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
405
|
+
..._reactNative.Platform.select({
|
|
406
|
+
ios: {
|
|
407
|
+
shadowColor: '#000',
|
|
408
|
+
shadowOpacity: 0.12,
|
|
409
|
+
shadowRadius: 18,
|
|
410
|
+
shadowOffset: {
|
|
411
|
+
width: 0,
|
|
412
|
+
height: 8
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
android: {
|
|
416
|
+
elevation: 8
|
|
417
|
+
},
|
|
418
|
+
default: {}
|
|
419
|
+
})
|
|
420
|
+
},
|
|
421
|
+
card: {
|
|
422
|
+
flexGrow: 1,
|
|
423
|
+
justifyContent: 'center',
|
|
424
|
+
overflow: 'hidden'
|
|
425
|
+
},
|
|
426
|
+
fill: {
|
|
427
|
+
position: 'absolute',
|
|
428
|
+
top: 0,
|
|
429
|
+
left: 0,
|
|
430
|
+
right: 0,
|
|
431
|
+
bottom: 0
|
|
432
|
+
},
|
|
433
|
+
accentBar: {
|
|
434
|
+
position: 'absolute',
|
|
435
|
+
top: 0,
|
|
436
|
+
bottom: 0,
|
|
437
|
+
left: 0,
|
|
438
|
+
width: 4
|
|
439
|
+
},
|
|
440
|
+
row: {
|
|
441
|
+
flexDirection: 'row',
|
|
442
|
+
alignItems: 'center',
|
|
443
|
+
paddingVertical: 12,
|
|
444
|
+
paddingHorizontal: 12,
|
|
445
|
+
gap: 12
|
|
446
|
+
},
|
|
447
|
+
rowWithBar: {
|
|
448
|
+
paddingLeft: 18
|
|
449
|
+
},
|
|
450
|
+
rowTextOnly: {
|
|
451
|
+
paddingVertical: 14,
|
|
452
|
+
paddingRight: 16
|
|
453
|
+
},
|
|
454
|
+
iconWrap: {
|
|
455
|
+
alignItems: 'center',
|
|
456
|
+
justifyContent: 'center',
|
|
457
|
+
overflow: 'hidden'
|
|
458
|
+
},
|
|
459
|
+
innerBadge: {
|
|
460
|
+
alignItems: 'center',
|
|
461
|
+
justifyContent: 'center'
|
|
462
|
+
},
|
|
463
|
+
cornerBadge: {
|
|
464
|
+
position: 'absolute',
|
|
465
|
+
right: -4,
|
|
466
|
+
bottom: -4,
|
|
467
|
+
borderWidth: 2,
|
|
468
|
+
alignItems: 'center',
|
|
469
|
+
justifyContent: 'center'
|
|
470
|
+
},
|
|
471
|
+
glyph: {
|
|
472
|
+
fontWeight: '800',
|
|
473
|
+
textAlign: 'center',
|
|
474
|
+
includeFontPadding: false,
|
|
475
|
+
textAlignVertical: 'center'
|
|
476
|
+
},
|
|
477
|
+
texts: {
|
|
478
|
+
flex: 1,
|
|
479
|
+
minWidth: 0
|
|
480
|
+
},
|
|
481
|
+
title: {
|
|
482
|
+
fontSize: 15,
|
|
483
|
+
fontWeight: '700'
|
|
484
|
+
},
|
|
485
|
+
message: {
|
|
486
|
+
fontSize: 13.5,
|
|
487
|
+
lineHeight: 18,
|
|
488
|
+
marginTop: 2
|
|
489
|
+
},
|
|
490
|
+
softText: {
|
|
491
|
+
opacity: 0.88
|
|
492
|
+
},
|
|
493
|
+
track: {
|
|
494
|
+
position: 'absolute',
|
|
495
|
+
left: 0,
|
|
496
|
+
right: 0,
|
|
497
|
+
bottom: 0,
|
|
498
|
+
height: 3
|
|
499
|
+
},
|
|
500
|
+
bar: {
|
|
501
|
+
height: 3
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
//# sourceMappingURL=ToastItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_theme","_jsxRuntime","mergeAppearance","base","over","out","key","value","Object","entries","undefined","ToastItem","toast","config","scheme","topOffset","bottomOffset","onExited","o","type","isTop","position","duration","durations","defaultDurations","showProgress","variant","filled","accent","accentColor","colors","typeColors","palette","palettes","glyph","typeGlyphs","onFilled","cardBg","backgroundColor","card","borderColor","border","titleColor","title","messageColor","message","badgeBg","badgeGlyph","imagePosition","showIcon","leftImage","image","icon","appIcon","rightImage","showTypeIcon","showCornerBadge","showTypeBadge","hasLeft","showAccentBar","radius","borderRadius","iconSize","imageSize","innerBadge","Math","round","cornerBadge","max","titleLines","messageLines","hiddenY","translateY","useRef","Animated","Value","current","opacity","progress","exiting","onExitedRef","onHideRef","onHide","translateX","dragging","swipeable","swipe","left","swipeLeft","right","swipeRight","up","swipeUp","down","swipeDown","swipeRef","pauseTimer","stopAnimation","startTimer","timing","toValue","easing","Easing","linear","useNativeDriver","start","finished","dismiss","direction","width","height","Dimensions","get","horizontal","target","parallel","quad","in","cubic","actions","axis","snapBack","spring","follow","d","negOk","posOk","pan","PanResponder","create","onMoveShouldSetPanResponder","_","g","s","absX","abs","dx","absY","dy","onPanResponderGrant","onPanResponderMove","setValue","onPanResponderRelease","vx","vy","onPanResponderTerminate","onPanResponderTerminationRequest","useEffect","damping","stiffness","mass","spoken","filter","Boolean","join","AccessibilityInfo","announceForAccessibility","firstRev","rev","dismissing","handlePress","onPress","barWidth","interpolate","inputRange","outputRange","sizeStyle","maxWidth","minHeight","jsx","View","pointerEvents","style","styles","container","top","bottom","transform","panHandlers","children","shadow","jsxs","Pressable","onPressIn","onPressOut","accessibilityRole","accessibilityLiveRegion","fill","accentBar","row","rowWithBar","rowTextOnly","Image","source","Text","color","fontSize","lineHeight","iconWrap","texts","numberOfLines","titleStyle","softText","messageStyle","track","bar","StyleSheet","paddingHorizontal","alignItems","zIndex","elevation","borderWidth","hairlineWidth","Platform","select","ios","shadowColor","shadowOpacity","shadowRadius","shadowOffset","android","default","flexGrow","justifyContent","overflow","flexDirection","paddingVertical","gap","paddingLeft","paddingRight","fontWeight","textAlign","includeFontPadding","textAlignVertical","flex","minWidth","marginTop"],"sourceRoot":"..\\..\\src","sources":["ToastItem.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAcA,IAAAE,MAAA,GAAAF,OAAA;AAA6E,IAAAG,WAAA,GAAAH,OAAA;AAc7E;AACA,SAASI,eAAeA,CACtBC,IAAqB,EACrBC,IAAqB,EACJ;EACjB,MAAMC,GAA4B,GAAG;IAAE,GAAGF;EAAK,CAAC;EAChD,KAAK,MAAM,CAACG,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,IAAI,CAAC,EAAE;IAC/C,IAAIG,KAAK,KAAKG,SAAS,EAAEL,GAAG,CAACC,GAAG,CAAC,GAAGC,KAAK;EAC3C;EACA,OAAOF,GAAG;AACZ;AAEO,SAASM,SAASA,CAAC;E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,CAAC;IACVmC,WAAW,EAAE,CAAC;IACdH,UAAU,EAAE,QAAQ;IACpBe,cAAc,EAAE;EAClB,CAAC;EACD7L,KAAK,EAAE;IACLoM,UAAU,EAAE,KAAK;IACjBC,SAAS,EAAE,QAAQ;IACnBC,kBAAkB,EAAE,KAAK;IACzBC,iBAAiB,EAAE;EACrB,CAAC;EACDlC,KAAK,EAAE;IACLmC,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDhM,KAAK,EAAE;IACLyJ,QAAQ,EAAE,EAAE;IACZkC,UAAU,EAAE;EACd,CAAC;EACDzL,OAAO,EAAE;IACPuJ,QAAQ,EAAE,IAAI;IACdC,UAAU,EAAE,EAAE;IACduC,SAAS,EAAE;EACb,CAAC;EACDlC,QAAQ,EAAE;IACR7H,OAAO,EAAE;EACX,CAAC;EACD+H,KAAK,EAAE;IACLvL,QAAQ,EAAE,UAAU;IACpBkE,IAAI,EAAE,CAAC;IACPE,KAAK,EAAE,CAAC;IACRuF,MAAM,EAAE,CAAC;IACTlE,MAAM,EAAE;EACV,CAAC;EACD+F,GAAG,EAAE;IACH/F,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToastProvider = ToastProvider;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _ToastItem = require("./ToastItem");
|
|
10
|
+
var _toast = require("./toast");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function ToastProvider({
|
|
13
|
+
children,
|
|
14
|
+
...config
|
|
15
|
+
}) {
|
|
16
|
+
const [queue, setQueue] = (0, _react.useState)([]);
|
|
17
|
+
const counter = (0, _react.useRef)(0);
|
|
18
|
+
const systemScheme = (0, _reactNative.useColorScheme)();
|
|
19
|
+
(0, _react.useEffect)(() => {
|
|
20
|
+
(0, _toast.setToastHandler)({
|
|
21
|
+
show: options => {
|
|
22
|
+
const id = options.id ?? `toast-${++counter.current}`;
|
|
23
|
+
setQueue(q => {
|
|
24
|
+
const existing = q.find(t => t.id === id);
|
|
25
|
+
if (existing) {
|
|
26
|
+
return q.map(t => t.id === id ? {
|
|
27
|
+
...t,
|
|
28
|
+
...options,
|
|
29
|
+
id,
|
|
30
|
+
rev: t.rev + 1,
|
|
31
|
+
dismissing: false
|
|
32
|
+
} : t);
|
|
33
|
+
}
|
|
34
|
+
return [...q, {
|
|
35
|
+
...options,
|
|
36
|
+
id,
|
|
37
|
+
rev: 0
|
|
38
|
+
}];
|
|
39
|
+
});
|
|
40
|
+
return id;
|
|
41
|
+
},
|
|
42
|
+
hide: id => {
|
|
43
|
+
setQueue(q => {
|
|
44
|
+
const target = id ?? q[0]?.id;
|
|
45
|
+
return q.flatMap((t, i) => t.id !== target ? [t] : i === 0 ? [{
|
|
46
|
+
...t,
|
|
47
|
+
dismissing: true
|
|
48
|
+
}] : []);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
hideAll: () => {
|
|
52
|
+
setQueue(q => q[0] ? [{
|
|
53
|
+
...q[0],
|
|
54
|
+
dismissing: true
|
|
55
|
+
}] : []);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return () => (0, _toast.setToastHandler)(null);
|
|
59
|
+
}, []);
|
|
60
|
+
const current = queue[0];
|
|
61
|
+
const handleExited = (0, _react.useCallback)(id => {
|
|
62
|
+
setQueue(q => q.filter(t => t.id !== id));
|
|
63
|
+
}, []);
|
|
64
|
+
const scheme = config.theme === 'light' || config.theme === 'dark' ? config.theme : systemScheme === 'dark' ? 'dark' : 'light';
|
|
65
|
+
const topOffset = config.topOffset ?? (_reactNative.Platform.OS === 'android' ? (_reactNative.StatusBar.currentHeight ?? 24) + 8 : 54);
|
|
66
|
+
const bottomOffset = config.bottomOffset ?? 40;
|
|
67
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
68
|
+
style: styles.root,
|
|
69
|
+
children: [children, current ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToastItem.ToastItem, {
|
|
70
|
+
toast: current,
|
|
71
|
+
config: config,
|
|
72
|
+
scheme: scheme,
|
|
73
|
+
topOffset: topOffset,
|
|
74
|
+
bottomOffset: bottomOffset,
|
|
75
|
+
onExited: () => handleExited(current.id)
|
|
76
|
+
}, current.id) : null]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const styles = _reactNative.StyleSheet.create({
|
|
80
|
+
root: {
|
|
81
|
+
flex: 1
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=ToastProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_ToastItem","_toast","_jsxRuntime","ToastProvider","children","config","queue","setQueue","useState","counter","useRef","systemScheme","useColorScheme","useEffect","setToastHandler","show","options","id","current","q","existing","find","t","map","rev","dismissing","hide","target","flatMap","i","hideAll","handleExited","useCallback","filter","scheme","theme","topOffset","Platform","OS","StatusBar","currentHeight","bottomOffset","jsxs","View","style","styles","root","jsx","ToastItem","toast","onExited","StyleSheet","create","flex"],"sourceRoot":"..\\..\\src","sources":["ToastProvider.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAA0C,IAAAI,WAAA,GAAAJ,OAAA;AAOnC,SAASK,aAAaA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAA2B,CAAC,EAAE;EACzE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAc,EAAE,CAAC;EACnD,MAAMC,OAAO,GAAG,IAAAC,a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,MAAO;MACfE,SAAS,EAAEA,SAAU;MACrBK,YAAY,EAAEA,YAAa;MAC3BS,QAAQ,EAAEA,CAAA,KAAMnB,YAAY,CAACb,OAAO,CAACD,EAAE;IAAE,GANpCC,OAAO,CAACD,EAOd,CAAC,GACA,IAAI;EAAA,CACJ,CAAC;AAEX;AAEA,MAAM4B,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC/BN,IAAI,EAAE;IAAEO,IAAI,EAAE;EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ToastProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ToastProvider.ToastProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "toast", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _toast.toast;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "useToast", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _toast.useToast;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _ToastProvider = require("./ToastProvider");
|
|
25
|
+
var _toast = require("./toast");
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ToastProvider","require","_toast"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|