Toggle
A control that toggles between on and off states.
Example​
- swiftui-react-native
- SwiftUI
- React Native
const isOn = useBinding(false);
<Toggle isOn={isOn} />
@State var isOn = ""
Toggle(isOn: $isOn)
const [isOn, setIsOn] = useState(false);
<Switch value={isOn} onChange={(v) => setIsOn(!v)}>
Props​
Toggle inherits all View Modifiers as props.
prop | description | type | required | default |
---|---|---|---|---|
isOn | The toggle value | BooleanBinding | yes | undefined |
onChange | Function to execute when the toggle value changes | (v: boolean) => void | no | undefined |