Files
discord-decomp/modules/polls/native/PollDurationActionSheet.tsx
T
2026-11-01 12:12:55 +02:00

31 lines
1.5 KiB
TypeScript

// Metro module 11375 (f11376).
import { useCallback } from "react";
import usePollDurationOptions from "../usePollDurationOptions";
import { AccessibilityAnnouncer } from "../../../_bundle/Module3902";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { TableRadioGroup } from "../../../design/components/TableRow/native/TableRadioGroup.native";
import { intl, t } from "../../../intl/index.native";
import { TableRadioRow } from "../../../design/components/TableRow/native/TableRadioRow.native";
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
const PollDurationRadioGroup = function PollDurationRadioGroup(props) {
const { selectedDuration, onChange } = props;
const pollDurationOptions = usePollDurationOptions();
let c18788_1 = pollDurationOptions;
const callback = useCallback((a0) => {
onChange(a0);
AccessibilityAnnouncer.announce(c18788_1[a0]);
ActionSheetActionCreators.hideActionSheet();
}, [pollDurationOptions, onChange]);
return <TableRadioGroup title={intl.string(t["0ZStp9"])} hasIcons={false} onChange={callback} defaultValue={selectedDuration}>
{Object.entries(pollDurationOptions).map((item) => {
const [key, label] = item;
return <TableRadioRow key={key} value={parseInt(key)} label={label} />;
})}
</TableRadioGroup>;
};
export default function PollDurationActionSheet(props) {
return <ActionSheet>
<PollDurationRadioGroup selectedDuration={props.selectedDuration} onChange={props.onChange} />
</ActionSheet>;
};