Lines Matching refs:checked

12checked or it isn't. This makes it a perfect candidate for the `useState()` hook. Our first iterat…
24 const [checked, setChecked] = useState(false);
27 style={[styles.checkboxBase, checked && styles.checkboxChecked]}
28 onPress={() => setChecked(!checked)}>
29 {checked && <Ionicons name="checkmark" size={24} color="white" />}
88checked` value is accessible only from within the component — more often than not you'll want to c…
98 function MyCheckbox({ /* @info Define checked and onChange as props instead of state */onChange, ch…
101 style={[styles.checkboxBase, checked && styles.checkboxChecked]}
103 {checked && <Ionicons name="checkmark" size={24} color="white" />}
109 /* @info Move the checked and setChecked values outside of the checkbox component */
110 const [checked, setChecked] = useState(false);
116 /* @info Pass the checked and onChange props to the checkbox */
117 <MyCheckbox onChange={() => setChecked(!checked)} checked={checked} />
167 It's common enough to need to render different styles when the checkmark is `checked` and when it i…
177 checked,
187 /* @info Set icon props based on the checked value */
188 const iconProps = checked ? activeIconProps : inactiveIconProps;
194 … Pass the active / inactive style props to the button based on the current checked value */ checked
199 onPress={() => onChange(!checked)}>
200 {checked && (
215 const [checked, setChecked] = useState(false);
221 checked={checked}
272 This checkbox ticks all of the boxes of what it should be. It toggles between `checked` states, can…