decord/source/modules/toast/native/Toast.tsx

104 lines
3.8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 16271
// Function ID: 16272
2026-07-20 16:05:17 +00:00
// Name: ToastIcon
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 19, 17, 21, 4668, 712, 4100, 1297, 4739, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 16271 (ToastIcon)
import ThemesDefault from "Themes" /* 712 */;
import Button from "Button" /* 1297 */;
import map from "map" /* 4100 */;
import Text from "Text" /* 4739 */;
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4668 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function ToastIcon(recolorLegacyIcon) {
({ icon, IconComponent, iconColor } = recolorLegacyIcon);
2026-08-24 06:08:38 +00:00
let obj = map;
2026-07-29 08:29:29 +00:00
if (iconColor == null) {
iconColor = "mobile-text-heading-primary";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const token = obj.useToken(iconColor);
2026-07-20 16:05:17 +00:00
if (recolorLegacyIcon.recolorLegacyIcon) {
2026-07-29 08:29:29 +00:00
obj = { color: null };
obj[0] = token;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj = { disableColor: true };
2026-07-20 16:05:17 +00:00
}
if (null != IconComponent) {
2026-08-24 06:08:38 +00:00
obj1 = { size: "sm", color: null };
2026-07-29 08:29:29 +00:00
obj1[1] = token;
let tmp8 = callback2(IconComponent, obj1);
2026-08-04 21:03:28 +00:00
} else if (typeof icon === "function") {
2026-07-29 08:29:29 +00:00
const obj2 = { children: null };
obj2[0] = icon();
tmp8 = callback2(closure_6, obj2);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp8 = null;
2026-07-20 16:05:17 +00:00
if (null != icon) {
2026-07-29 08:29:29 +00:00
const obj3 = { resizeMode: "contain", source: null };
obj3[1] = icon;
const merged = Object.assign(obj);
2026-08-24 06:08:38 +00:00
tmp8 = callback2(Button.Icon, obj3);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return tmp8;
2026-07-20 16:05:17 +00:00
}
function ToastContent(content) {
content = content.content;
2026-08-24 06:08:38 +00:00
const tmp = callback3();
2026-08-04 21:03:28 +00:00
if (typeof content === "function") {
2026-07-29 08:29:29 +00:00
let obj = { style: null, children: null };
obj[0] = tmp.contentContainer;
obj[1] = content();
let tmp4 = callback2(View, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj = { onTextLayout: null, style: null, lineClamp: 3, variant: "text-sm/semibold", color: "mobile-text-heading-primary", children: null };
obj[0] = content.onTextLayout;
obj[1] = tmp.contentContainer;
obj[5] = content;
2026-08-24 06:08:38 +00:00
tmp4 = callback2(Text.Text, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp4;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
({ jsx: c5, Fragment: closure_6, jsxs: error } = jsxProd);
createCacheKey = { container: null, multilineContainer: null, contentContainer: null };
2026-08-24 06:08:38 +00:00
createCacheKey = { flexDirection: "row", alignItems: "center", borderRadius: ThemesDefault.radii.xxl, padding: ThemesDefault.space.PX_8, paddingRight: ThemesDefault.space.PX_12, backgroundColor: ThemesDefault.colors.MOBILE_TOAST_BACKGROUND_DEFAULT, borderColor: ThemesDefault.colors.BORDER_SUBTLE, borderWidth: 1 };
let merged = Object.assign(ThemesDefault.shadows.SHADOW_HIGH);
2026-07-29 08:29:29 +00:00
createCacheKey[0] = createCacheKey;
2026-08-24 06:08:38 +00:00
createCacheKey[1] = { paddingLeft: ThemesDefault.space.PX_12 };
2026-07-29 08:29:29 +00:00
createCacheKey[2] = { marginLeft: 8, flexShrink: 1 };
2026-08-24 06:08:38 +00:00
let closure_8 = createCacheKey.createStyles(createCacheKey);
let obj1 = { paddingLeft: ThemesDefault.space.PX_12 };
const result = require("set").fileFinishedImporting("modules/toast/native/Toast.tsx");
2026-07-20 16:05:17 +00:00
export default function Toast(arg0) {
2026-07-29 08:29:29 +00:00
c0 = undefined;
2026-08-24 06:08:38 +00:00
closure_1 = undefined;
2026-07-20 16:05:17 +00:00
({ icon, iconColor, IconComponent, content, containerStyle, recolorLegacyIcon } = arg0);
2026-08-24 06:08:38 +00:00
const tmp = callback3();
2026-07-29 08:29:29 +00:00
[tmp3, c0] = callback(React.useState(false), 2);
closure_1 = React.useRef(false);
2026-07-20 16:05:17 +00:00
const items = [tmp.container, , ];
let multilineContainer = null;
2026-07-23 10:11:24 +00:00
callback = React.useCallback((nativeEvent) => {
2026-07-20 16:05:17 +00:00
if (!ref.current) {
2026-07-29 08:29:29 +00:00
tmp.current = true;
_undefined(nativeEvent.nativeEvent.lines.length > 1);
2026-07-20 16:05:17 +00:00
}
}, []);
if (tmp3) {
multilineContainer = tmp.multilineContainer;
}
2026-07-29 08:29:29 +00:00
const obj = { style: items, accessibilityElementsHidden: true, children: null };
2026-07-20 16:05:17 +00:00
items[1] = multilineContainer;
items[2] = containerStyle;
const items1 = [callback2(ToastIcon, { icon, iconColor, IconComponent, recolorLegacyIcon }), callback2(ToastContent, { content, onTextLayout: callback })];
2026-07-29 08:29:29 +00:00
obj[2] = items1;
2026-07-20 16:05:17 +00:00
return closure_7(View, obj);
};