33 * https://docs.expo.io/guides/color-schemes/
44 */
55
6- import { Text as DefaultText , View as DefaultView } from ' react-native' ;
6+ import { Text as DefaultText , View as DefaultView } from " react-native" ;
77
8- import Colors from ' @/constants/Colors' ;
9- import { useColorScheme } from './ useColorScheme' ;
8+ import Colors from " @/constants/Colors" ;
9+ import { useColorScheme } from "../hooks/ useColorScheme" ;
1010
1111type ThemeProps = {
1212 lightColor ?: string ;
1313 darkColor ?: string ;
1414} ;
1515
16- export type TextProps = ThemeProps & DefaultText [ ' props' ] ;
17- export type ViewProps = ThemeProps & DefaultView [ ' props' ] ;
16+ export type TextProps = ThemeProps & DefaultText [ " props" ] ;
17+ export type ViewProps = ThemeProps & DefaultView [ " props" ] ;
1818
1919export function useThemeColor (
2020 props : { light ?: string ; dark ?: string } ,
2121 colorName : keyof typeof Colors . light & keyof typeof Colors . dark
2222) {
23- const theme = useColorScheme ( ) ?? ' light' ;
23+ const theme = useColorScheme ( ) ?? " light" ;
2424 const colorFromProps = props [ theme ] ;
2525
2626 if ( colorFromProps ) {
@@ -32,14 +32,17 @@ export function useThemeColor(
3232
3333export function Text ( props : TextProps ) {
3434 const { style, lightColor, darkColor, ...otherProps } = props ;
35- const color = useThemeColor ( { light : lightColor , dark : darkColor } , ' text' ) ;
35+ const color = useThemeColor ( { light : lightColor , dark : darkColor } , " text" ) ;
3636
3737 return < DefaultText style = { [ { color } , style ] } { ...otherProps } /> ;
3838}
3939
4040export function View ( props : ViewProps ) {
4141 const { style, lightColor, darkColor, ...otherProps } = props ;
42- const backgroundColor = useThemeColor ( { light : lightColor , dark : darkColor } , 'background' ) ;
42+ const backgroundColor = useThemeColor (
43+ { light : lightColor , dark : darkColor } ,
44+ "background"
45+ ) ;
4346
4447 return < DefaultView style = { [ { backgroundColor } , style ] } { ...otherProps } /> ;
4548}
0 commit comments