1
|
import { Switch, View, Text } from "native-base"
|
2
|
|
3
|
interface SwitchWithLabelProps {
|
4
|
label: string,
|
5
|
value: boolean,
|
6
|
onValueChange: (value: boolean) => void,
|
7
|
}
|
8
|
|
9
|
const SwitchWithLabel = (props: SwitchWithLabelProps) => {
|
10
|
|
11
|
return (
|
12
|
<View
|
13
|
flexDirection={ "row" }
|
14
|
alignItems={ "center" }
|
15
|
justifyContent={ "space-between" }
|
16
|
key={props.label}
|
17
|
>
|
18
|
<Text>{ props.label }</Text>
|
19
|
<Switch isChecked={ props.value } onValueChange={ props.onValueChange } size={"sm"} key={props.label}/>
|
20
|
</View>
|
21
|
)
|
22
|
}
|
23
|
|
24
|
export default SwitchWithLabel
|