@@ -3,7 +3,7 @@ import type {ComponentMeta, ComponentStory} from '@storybook/react'
33import React , { useState } from 'react'
44
55import { View } from 'react-native'
6- import { Switch } from 'rn-base-component'
6+ import { Switch , useTheme } from 'rn-base-component'
77
88export default {
99 title : 'components/Switch' ,
@@ -12,6 +12,7 @@ export default {
1212
1313export const Basic : ComponentStory < typeof Switch > = rest => {
1414 const [ isActive , setIsActive ] = useState ( false )
15+ const theme = useTheme ( )
1516
1617 const onValueChange = ( ) => {
1718 setIsActive ( prev => ! prev )
@@ -25,14 +26,15 @@ export const Basic: ComponentStory<typeof Switch> = rest => {
2526 value = { isActive }
2627 onValueChange = { onValueChange }
2728 thumbColor = "green"
28- trackColor = { { active : ' blue' , inActive : 'gray' } }
29+ trackColor = { { active : theme . colors . blue , inActive : theme . colors . red } }
2930 />
3031 </ View >
3132 )
3233}
3334
3435export const Inside : ComponentStory < typeof Switch > = rest => {
3536 const [ isActive , setIsActive ] = useState ( false )
37+ const theme = useTheme ( )
3638
3739 const onValueChange = ( ) => {
3840 setIsActive ( prev => ! prev )
@@ -45,7 +47,7 @@ export const Inside: ComponentStory<typeof Switch> = rest => {
4547 variant = "inside"
4648 value = { isActive }
4749 onValueChange = { onValueChange }
48- trackColor = { { active : 'green' , inActive : 'gray' } }
50+ trackColor = { { active : theme . colors . gray , inActive : theme . colors . red } }
4951 />
5052 </ View >
5153 )
0 commit comments