Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.expoship.dev/llms.txt

Use this file to discover all available pages before exploring further.

The Switch component is used to toggle between two states. It is a wrapper around the native Switch component.
You can use the Switch component in your code like this:
Switch.js
const [isEnabled, setIsEnabled] = useState(false);
const toggleSwitch = () => setIsEnabled(previousState => !previousState);
 
export default function switch() {
	return (
		<Switch
			trackColor={{ false: "#d1d5db", true: "#AAB2FF" }}
			thumbColor={isEnabled ? "#AA8CFF" : "#f9fafb"}
			onValueChange={toggleSwitch}
			value={isEnabled}
		/>
	)
}