sapo-components-ui-rn 1.0.5 → 1.0.6

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/dist/index.esm.js CHANGED
@@ -6182,17 +6182,26 @@ var Toast = memoWithRef(function (_props, ref) {
6182
6182
  var viewVisibleAnimatedRef = useRef(null);
6183
6183
  var _b = useSafeAreaInsets(), bottom = _b.bottom, top = _b.top;
6184
6184
  var _c = useState({
6185
- position: POSITION.TOP,
6185
+ position: POSITION.BOTTOM,
6186
6186
  type: "success",
6187
6187
  title: "Thông báo",
6188
+ spacer: "normal",
6188
6189
  }), options = _c[0], setOptions = _c[1];
6189
6190
  var theme = useInternalTheme();
6190
6191
  var colors = theme.colors;
6191
6192
  var TIME_OUT = useRef(null);
6192
6193
  var show = function (_a) {
6193
- var message = _a.message, _b = _a.duration, duration = _b === void 0 ? 1000 : _b, _c = _a.position, position = _c === void 0 ? POSITION.TOP : _c, _d = _a.type, type = _d === void 0 ? "success" : _d, onPress = _a.onPress, _e = _a.title, title = _e === void 0 ? "Thông báo" : _e;
6194
+ var message = _a.message, _b = _a.duration, duration = _b === void 0 ? 1000 : _b, _c = _a.position, position = _c === void 0 ? POSITION.BOTTOM : _c, _d = _a.type, type = _d === void 0 ? "success" : _d, onPress = _a.onPress, _e = _a.title, title = _e === void 0 ? "Thông báo" : _e, _f = _a.spacer, spacer = _f === void 0 ? "normal" : _f;
6194
6195
  if (!TIME_OUT.current) {
6195
- handleShow({ message: message, position: position, type: type, onPress: onPress, title: title, duration: duration });
6196
+ handleShow({
6197
+ message: message,
6198
+ position: position,
6199
+ type: type,
6200
+ onPress: onPress,
6201
+ title: title,
6202
+ duration: duration,
6203
+ spacer: spacer,
6204
+ });
6196
6205
  return;
6197
6206
  }
6198
6207
  clearTimeout(TIME_OUT.current);
@@ -6212,9 +6221,9 @@ var Toast = memoWithRef(function (_props, ref) {
6212
6221
  }); }, []);
6213
6222
  var handleShow = function (_a) {
6214
6223
  var _b, _c;
6215
- var message = _a.message, _d = _a.position, position = _d === void 0 ? POSITION.TOP : _d, _e = _a.type, type = _e === void 0 ? "success" : _e, onPress = _a.onPress, _f = _a.title, title = _f === void 0 ? "Thông báo" : _f, _g = _a.duration, duration = _g === void 0 ? 1000 : _g;
6224
+ var message = _a.message, _d = _a.position, position = _d === void 0 ? POSITION.TOP : _d, _e = _a.type, type = _e === void 0 ? "success" : _e, onPress = _a.onPress, _f = _a.title, title = _f === void 0 ? "Thông báo" : _f, _g = _a.duration, duration = _g === void 0 ? 1000 : _g, _h = _a.spacer, spacer = _h === void 0 ? "normal" : _h;
6216
6225
  setMessage(message || "");
6217
- setOptions({ position: position, type: type, onPress: onPress, title: title });
6226
+ setOptions({ position: position, type: type, onPress: onPress, title: title, spacer: spacer });
6218
6227
  (_c = (_b = viewVisibleAnimatedRef.current) === null || _b === void 0 ? void 0 : _b.show) === null || _c === void 0 ? void 0 : _c.call(_b, function () {
6219
6228
  TIME_OUT.current = setTimeout(function () {
6220
6229
  hide(function () { }, false);
@@ -6263,10 +6272,28 @@ var Toast = memoWithRef(function (_props, ref) {
6263
6272
  return require("./assets/images/success.png");
6264
6273
  }
6265
6274
  };
6275
+ var handleToastBottomHeight = function () {
6276
+ var spacer = options.spacer;
6277
+ if (typeof spacer === "number") {
6278
+ return spacer;
6279
+ }
6280
+ switch (spacer) {
6281
+ case "normal":
6282
+ return 64;
6283
+ case "medium":
6284
+ return 100;
6285
+ case "large":
6286
+ return 120;
6287
+ default:
6288
+ return 64;
6289
+ }
6290
+ };
6266
6291
  return (React__default.createElement(ViewVisibleAnimated, { ref: viewVisibleAnimatedRef, autoShow: false, scaleEnable: true, style: [
6267
6292
  styles$6.container,
6268
6293
  options.position === POSITION.BOTTOM && {
6269
- bottom: bottom ? bottom : CONSTANTS.SPACE_16,
6294
+ bottom: bottom
6295
+ ? bottom + handleToastBottomHeight()
6296
+ : CONSTANTS.SPACE_16 + handleToastBottomHeight(),
6270
6297
  },
6271
6298
  options.position === POSITION.TOP && {
6272
6299
  top: top ? top : CONSTANTS.SPACE_16,