chore: enable expo lint config
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
// https://docs.expo.dev/guides/using-eslint/
|
||||||
|
const { defineConfig } = require("eslint/config");
|
||||||
|
const expoConfig = require("eslint-config-expo/flat");
|
||||||
|
|
||||||
|
module.exports = defineConfig([
|
||||||
|
expoConfig,
|
||||||
|
{
|
||||||
|
ignores: ["dist/*"],
|
||||||
|
},
|
||||||
|
]);
|
||||||
@@ -1,21 +1,20 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useSyncExternalStore } from "react";
|
||||||
import { useColorScheme as useRNColorScheme } from 'react-native';
|
import { useColorScheme as useRNColorScheme } from "react-native";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To support static rendering, this value needs to be re-calculated on the client side for web
|
* To support static rendering, this value needs to be re-calculated on the client side for web
|
||||||
*/
|
*/
|
||||||
export function useColorScheme() {
|
export function useColorScheme() {
|
||||||
const [hasHydrated, setHasHydrated] = useState(false);
|
const hasHydrated = useSyncExternalStore(
|
||||||
|
() => () => {},
|
||||||
useEffect(() => {
|
() => true,
|
||||||
setHasHydrated(true);
|
() => false,
|
||||||
}, []);
|
);
|
||||||
|
|
||||||
const colorScheme = useRNColorScheme();
|
const colorScheme = useRNColorScheme();
|
||||||
|
|
||||||
if (hasHydrated) {
|
if (hasHydrated) {
|
||||||
return colorScheme;
|
return colorScheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'light';
|
return "light";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user