Add WIP 'report post' modal
This commit is contained in:
parent
36dc1c7525
commit
66a0f8e848
7 changed files with 211 additions and 2 deletions
34
src/view/com/util/forms/RadioGroup.tsx
Normal file
34
src/view/com/util/forms/RadioGroup.tsx
Normal file
|
@ -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<string>('')
|
||||
const onSelectInner = (key: string) => {
|
||||
setSelection(key)
|
||||
onSelect(key)
|
||||
}
|
||||
return (
|
||||
<View>
|
||||
{items.map(item => (
|
||||
<RadioButton
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
isSelected={item.key === selection}
|
||||
onPress={() => onSelectInner(item.key)}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue