Skip to main content
Version: Next

Switch

The Switch component is renders a boolean input.

Import

import { Switch } from '@tra-tech/react-native-kitra';

Import

import { Switch } from '@tra-tech/react-native-kitra';
import { useState } from 'react';
import { View } from 'react-native';

const App = () => {
const [isEnabled, setIsEnabled] = useState(false);
return (
<View style={{ alignItems: 'center' }}>
<Switch
onValueChange={() => setIsEnabled(!isEnabled)}
value={isEnabled}
/>
</View>
);
};

export default App;

Props

Prop nameTypeRequiredDescription
...SwitchPropsSwitchPropsNoAny additional props to be passed to the underlying Switch component.
themeUITheme NoThe theme to use for the component.