Switch
Switch represents user's decision of a process and indicates whether a state is on/off. Switch is a controlled component that requires an onValueChange
to update the value
prop. This renders a boolean
value. React native elements provide you with additional theme
and color
support in the Switch Button.
Usage
import { Switch } from 'react-native-elements';
<Switch value={true} />
<Switch value={false} color="orange" />
Props
This component inherits all native Switch props that come with a standard React Native Switch element, along with the following:
Reference
color
The color
of the Switch defines a color to the switch thumb. (optional)
Type | Default |
---|---|
string | Theme(Primary) |
theme
The theme
of the Switch provide a theme to the switch. (optional)
Type | Default |
---|---|
string | Theme(Primary) |
style
The style
is used to define user defined styles on the switch and allows styles provided by Native Switch.
Type | Default |
---|---|
object (style) | none |