From 66a0f8e848342bb5e5ceda36f5095f3ad2b0de29 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Sun, 18 Dec 2022 17:28:28 -0600 Subject: Add WIP 'report post' modal --- src/view/com/util/forms/RadioGroup.tsx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/view/com/util/forms/RadioGroup.tsx (limited to 'src/view/com/util/forms/RadioGroup.tsx') diff --git a/src/view/com/util/forms/RadioGroup.tsx b/src/view/com/util/forms/RadioGroup.tsx new file mode 100644 index 000000000..6684cde5c --- /dev/null +++ b/src/view/com/util/forms/RadioGroup.tsx @@ -0,0 +1,34 @@ +import React, {useState} from 'react' +import {View} from 'react-native' +import {RadioButton} from './RadioButton' + +export interface RadioGroupItem { + label: string + key: string +} + +export function RadioGroup({ + items, + onSelect, +}: { + items: RadioGroupItem[] + onSelect: (key: string) => void +}) { + const [selection, setSelection] = useState('') + const onSelectInner = (key: string) => { + setSelection(key) + onSelect(key) + } + return ( + + {items.map(item => ( + onSelectInner(item.key)} + /> + ))} + + ) +} -- cgit 1.4.1