1import React from 'react'; 2import { Switch, View, StyleSheet, Text } from 'react-native'; 3 4interface SwitchContainerProps { 5 title: string; 6 onValueChange: () => void; 7 value: boolean; 8 enabled?: boolean; 9} 10 11export default function SwitchContainer({ 12 title, 13 onValueChange, 14 value, 15 enabled = true, 16}: SwitchContainerProps) { 17 return enabled ? ( 18 <View style={styles.switchContainer}> 19 <Text>{title}</Text> 20 <Switch 21 value={value} 22 onValueChange={() => onValueChange()} 23 trackColor={{ true: 'green', false: 'red' }} 24 /> 25 </View> 26 ) : null; 27} 28 29const styles = StyleSheet.create({ 30 switchContainer: { 31 margin: 5, 32 flexDirection: 'row', 33 justifyContent: 'space-between', 34 }, 35}); 36