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.
Imports:
import { Switch} from 'galio-framework';
Simple example:
<Switch
value={this.state["switch-1"]}
onValueChange={() => this.toggleSwitch("switch-1")}
/>
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 |