Initial commit
Generated by create-expo-app 3.3.0.
This commit is contained in:
commit
84c0d8ecd0
38 changed files with 15429 additions and 0 deletions
21
hooks/useColorScheme.web.ts
Normal file
21
hooks/useColorScheme.web.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { useEffect, useState } from 'react';
|
||||
import { useColorScheme as useRNColorScheme } from 'react-native';
|
||||
|
||||
/**
|
||||
* To support static rendering, this value needs to be re-calculated on the client side for web
|
||||
*/
|
||||
export function useColorScheme() {
|
||||
const [hasHydrated, setHasHydrated] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setHasHydrated(true);
|
||||
}, []);
|
||||
|
||||
const colorScheme = useRNColorScheme();
|
||||
|
||||
if (hasHydrated) {
|
||||
return colorScheme;
|
||||
}
|
||||
|
||||
return 'light';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue