【发布时间】:2021-06-06 04:47:57
【问题描述】:
如何制作文本“BIRD”标签以在按下复选框时选中它? 根据我的示例,它不起作用,我也不清楚。
import CheckBox from '@react-native-community/checkbox';
function App(props) {
const isSelected = useSelector((rootState) => rootState.BitzuaDigumReducer.checkBox);
return (
<TouchableOpacity
activeOpacity={1}
style={{
flexDirection: 'row',
alignSelf: 'flex-start',
top: 20,
left: 10,
}}
>
<CheckBox
value={isSelected}
onValueChange={(value) => dispatch(setCheckBox(value))}
style={styles.checkbox}
tintColors={{ true: 'white', false: 'white' }}
/>
<Text style={styles.label}>BIRD</Text>
</TouchableOpacity>
);
}
【问题讨论】:
标签: javascript reactjs react-native checkbox react-hooks