|
// screens/Settings.js |
|
const Section = ({ option, active, pos, index }) => { |
|
const dispatch = useDispatch(); |
|
let settings = useSelector(state => state.settings); |
|
|
|
function update(pos, index) { |
|
settings[index].active = pos; |
|
dispatch(updateSettings(settings)); |
|
} |
|
|
|
return ( |
|
<View style={styles.section}> |
|
<Text style={styles.sectionTitle}>{option}</Text> |
|
|
|
{active === pos ? ( |
|
<TouchableOpacity style={styles.radioFill}> |
|
<View style={styles.radioFillCenter}></View> |
|
</TouchableOpacity> |
|
) : ( |
|
<TouchableOpacity style={styles.radio} onPress={() => update(pos, index) } /> |
|
)} |
|
</View> |
|
); |
|
} |