Skip to content

Latest commit

 

History

History
32 lines (27 loc) · 2.16 KB

switch.md

File metadata and controls

32 lines (27 loc) · 2.16 KB

Switch

This component was built on top of React Native's Switch component and so it inherits all the props the native component has. This is a controlled component which requires the onValueChange prop so you can update the value state.

Usage

Imports:

import { Switch} from 'galio-framework';

Simple example:

<Switch
  value={this.state["switch-1"]}
  onValueChange={() => this.toggleSwitch("switch-1")}
/>

Props

Prop Type Default Description
color oneOfType(['primary', 'theme', 'error', 'warning', 'success', 'info']), string GalioTheme.COLORS.PRIMARY
disabled bool false
initialValue bool false
trackColor object { false: GalioTheme.COLORS.GREY, true: GalioTheme.COLORS.PRIMARY }
ios_backgroundColor string GalioTheme.COLORS.GREY
onChange function () => {}
...Switch.propTypes