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

94 lines
3.9 KiB
TypeScript
Raw Normal View History

// Module ID: 17030
// Function ID: 17031
// Name: Toast
// Dependencies: [32, 19, 17, 21, 4845, 576, 4560, 1177, 4841, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 17030 (Toast)
import nativeDefault from "native" /* 576 */;
import native from "native" /* 1177 */;
import useToken from "useToken" /* 4560 */;
import Text_Text from "Text/Text" /* 4841 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function ToastIcon(recolorLegacyIcon) {
({ icon, IconComponent, iconColor } = recolorLegacyIcon);
2026-07-29 08:29:29 +00:00
if (iconColor == null) {
iconColor = "mobile-text-heading-primary";
2026-07-20 16:05:17 +00:00
}
const token = useToken.useToken(iconColor);
2026-07-20 16:05:17 +00:00
if (recolorLegacyIcon.recolorLegacyIcon) {
const obj2 = { color: token };
let obj3 = obj2;
2026-07-20 16:05:17 +00:00
} else {
obj3 = { disableColor: true };
2026-07-20 16:05:17 +00:00
}
if (null != IconComponent) {
const obj4 = { size: "sm", color: token };
let tmp8 = hasOwnProperty(IconComponent, obj4);
2026-08-04 21:03:28 +00:00
} else if (typeof icon === "function") {
const obj5 = { children: icon() };
tmp8 = hasOwnProperty(timestampProducer, obj5);
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) {
const obj6 = { resizeMode: "contain", source: icon };
const merged = Object.assign(obj3);
tmp8 = hasOwnProperty(native.Icon, obj6);
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;
const tmp = closure_8();
2026-08-04 21:03:28 +00:00
if (typeof content === "function") {
const obj = { style: tmp.contentContainer, children: content() };
let tmp4 = hasOwnProperty(View, obj);
2026-07-20 16:05:17 +00:00
} else {
const obj2 = { onTextLayout: content.onTextLayout, style: tmp.contentContainer, lineClamp: 3, variant: "text-sm/semibold", color: "mobile-text-heading-primary", children: content };
tmp4 = hasOwnProperty(Text_Text.Text, obj2);
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
}
const View = fn(17).View;
const jsxProd = fn(21);
({ jsx: hasOwnProperty, Fragment: metroRequire, jsxs: closure_7 } = jsxProd);
const createStyles = fn(4845);
let obj2 = { container: null, multilineContainer: null, contentContainer: null };
let merged = Object.assign(nativeDefault.shadows.SHADOW_HIGH);
obj2.container = { flexDirection: "row", alignItems: "center", borderRadius: nativeDefault.radii.xxl, padding: nativeDefault.space.PX_8, paddingRight: nativeDefault.space.PX_12, backgroundColor: nativeDefault.colors.MOBILE_TOAST_BACKGROUND_DEFAULT, borderColor: nativeDefault.colors.BORDER_SUBTLE, borderWidth: 1 };
let obj3 = { flexDirection: "row", alignItems: "center", borderRadius: nativeDefault.radii.xxl, padding: nativeDefault.space.PX_8, paddingRight: nativeDefault.space.PX_12, backgroundColor: nativeDefault.colors.MOBILE_TOAST_BACKGROUND_DEFAULT, borderColor: nativeDefault.colors.BORDER_SUBTLE, borderWidth: 1 };
obj2.multilineContainer = { paddingLeft: nativeDefault.space.PX_12 };
obj2.contentContainer = { marginLeft: 8, flexShrink: 1 };
let closure_8 = createStyles.createStyles(obj2);
const size = fn(2);
const result = size.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-07-20 16:05:17 +00:00
({ icon, iconColor, IconComponent, content, containerStyle, recolorLegacyIcon } = arg0);
const tmp = closure_8();
[tmp3, c0] = noop.useState(false);
noop.useRef(false);
2026-07-20 16:05:17 +00:00
const items = [tmp.container, , ];
let multilineContainer = null;
const callback = noop.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 = [hasOwnProperty(ToastIcon, { icon, iconColor, IconComponent, recolorLegacyIcon }), hasOwnProperty(ToastContent, { content, onTextLayout: callback })];
obj.children = items1;
return React5(View, obj);
2026-07-20 16:05:17 +00:00
};