Files
discord-decomp/components_native/common/ItemSelectorActionSheet.tsx
T
2026-11-01 12:12:55 +02:00

33 lines
1.8 KiB
TypeScript

// Metro module 8246 (f8247).
import { useToken } from "../../design/tokens/native/useToken";
import Module712 from "../../_bundle/Module712";
import useSafeAreaInsets_native from "../../modules/safe_area/useSafeAreaInsets.native";
import { BottomSheet } from "../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { ActionSheetCloseButton } from "../../design/components/Sheet/native/ActionSheetCloseButton.native";
import { BottomSheetScrollView } from "../../_bundle/Module5245";
import { TableRadioGroup } from "../../design/components/TableRow/native/TableRadioGroup.native";
import { TableRadioRow } from "../../design/components/TableRow/native/TableRadioRow.native";
export default function ItemSelectorActionSheet(props) {
const { title, body, items, selectedItem, onItemSelect, onClose, hasIcons } = props;
const token = useToken(Module712.modules.mobile.TABLE_ROW_PADDING);
const bottom = useSafeAreaInsets_native().bottom;
const r10 = items.findIndex((item) => item.value === selectedItem);
return <BottomSheet scrollable header={<BottomSheetTitleHeader title={title} trailing={onClose != null ? <ActionSheetCloseButton onPress={onClose} /> : null} />}>
<BottomSheetScrollView contentContainerStyle={{
paddingHorizontal: token,
paddingBottom: bottom + Module712.space.PX_16
}}>
{body}
<TableRadioGroup value={r10 >= 0 ? r10 : -1} accessibilityLabel={title} hasIcons={hasIcons} onChange={function onChange(event) {
const r4 = items[event];
if (r4 != null) {
onItemSelect(r4.value);
}
}}>
{items.map((item, index) => <TableRadioRow key={index} label={item.label} value={index} />)}
</TableRadioGroup>
</BottomSheetScrollView>
</BottomSheet>;
};