chore: enable expo lint config

This commit is contained in:
baizhi958216
2026-06-30 13:57:57 +08:00
parent 53ed4a7ca5
commit 65cce4868d
2 changed files with 18 additions and 9 deletions
+10
View File
@@ -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/*"],
},
]);
+8 -9
View File
@@ -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";
} }