Skip to content

Commit

Permalink
fix: theme flash
Browse files Browse the repository at this point in the history
  • Loading branch information
awais-codes committed May 29, 2024
1 parent 7b6e733 commit 38b2b33
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/app/context/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import {
type PropsWithChildren,
createContext,
useReducer,
useEffect,
} from 'react';
import { type PropsWithChildren, createContext, useReducer } from 'react';
import { getTheme } from '../theme';
import { ThemeEnum, type ThemeType } from '../theme/types';
import ThirdPartyThemeProviders from './ThirdPartyThemeProviders';
import React from 'react';
import { useStorage } from '../hooks/storage/useStorage';
import { useIsomorphicLayoutEffect } from 'tamagui';

const DEFAULT_THEME = ThemeEnum.LIGHT as ThemeType;

Expand Down Expand Up @@ -71,7 +67,7 @@ export const ThemeProvider = ({ children }: PropsWithChildren) => {
* Initializes the app theme based on the stored theme preference.
* If no preference is stored, sets the default theme preference in local storage.
*/
useEffect(() => {
useIsomorphicLayoutEffect(() => {
if (storedTheme) {
dispatch({ type: `ENABLE_${storedTheme}_MODE` });
} else {
Expand Down

0 comments on commit 38b2b33

Please sign in to comment.