Switch

Switch is a visual toggle between two mutually exclusive states—on and off.

Android (enabled)
Android (disabled)
iOS (enabled)
iOS (disabled)

Usage

export default class MyComponent extends Component {
  state = {
    isSwitchOn: false,
  };

  render() {
    const { isSwitchOn } = this.state;
    return (
      <Switch
        value={isSwitchOn}
        onValueChange={() =>
          { this.setState({ isSwitchOn: !isSwitchOn }); }
        }
      />
    );
  }
}

Props

disabled
Type: boolean

Disable toggling the switch.

value
Type: boolean

Switch value- true or false.

color
Type: string

Custom color for checkbox.

onValueChange
Type: Function

Invoked with the new value when the value changes.

style
Type: any
theme
Type: Theme