fix: handle system theme change and set color scheme, closes #571 (#607)

This commit is contained in:
Huang Xin
2025-03-14 23:55:27 +08:00
committed by GitHub
parent cd9290240a
commit f0270eec4e
3 changed files with 8 additions and 7 deletions
@@ -36,7 +36,7 @@ const FoliateViewer: React.FC<{
const { getView, setView: setFoliateView, setProgress } = useReaderStore();
const { getViewSettings, setViewSettings } = useReaderStore();
const { getParallels } = useParallelViewStore();
const { themeCode } = useThemeStore();
const { themeCode, isDarkMode } = useThemeStore();
const viewSettings = getViewSettings(bookKey)!;
const [toastMessage, setToastMessage] = useState('');
@@ -129,7 +129,7 @@ const FoliateViewer: React.FC<{
viewRef.current.renderer.setStyles?.(getStyles(viewSettings));
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [themeCode]);
}, [themeCode, isDarkMode]);
useEffect(() => {
if (isViewCreated.current) return;