-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added switch component with examples natiivewind
- Loading branch information
Rajat Chaudhary
authored and
Rajat Chaudhary
committed
Mar 8, 2024
1 parent
d3ce823
commit c246af5
Showing
4 changed files
with
169 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 12 additions & 3 deletions
15
example/storybook-nativewind/src/components/Switch/Switch.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import React from 'react'; | ||
import { VStack, Text, HStack } from '@gluestack-ui/themed'; | ||
import { Switch } from '@/components/ui/switch'; | ||
import colors from 'tailwindcss/colors'; | ||
|
||
const SwitchBasic = ({ ...props }: any) => { | ||
return <Switch defaultValue={true} value={props.isEnabled} {...props} />; | ||
return ( | ||
<Switch | ||
// value={props.isEnabled} | ||
trackColor={{ false: colors.gray[300], true: colors.gray[500] }} | ||
thumbColor={colors.gray[50]} | ||
activeThumbColor={colors.gray[50]} | ||
ios_backgroundColor={colors.gray[300]} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
SwitchBasic.description = | ||
'This is a basic Switch component example. Switches are used to toggle between two states.'; | ||
|
||
export default SwitchBasic; | ||
|
||
export { Switch, VStack, Text, HStack }; | ||
export { Switch }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.