Skip to content

Commit

Permalink
Move if one layer up
Browse files Browse the repository at this point in the history
  • Loading branch information
YoussefHenna committed Nov 20, 2024
1 parent 55fd0a0 commit cdc7e60
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/theme/src/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ const Provider: React.FC<React.PropsWithChildren<ProviderProps>> = ({
const savedSelectedThemeName = await AsyncStorage.getItem(
SAVED_SELECTED_THEME_KEY
);
const themeExists = themes.some((t) => t.name === savedSelectedThemeName);
console.log("RUNNING", savedSelectedThemeName);

if (savedSelectedThemeName) {
const themeExists = themes.some(
(t) => t.name === savedSelectedThemeName
);
console.log("RUNNING", savedSelectedThemeName);

if (themeExists) {
changeTheme(savedSelectedThemeName);
} else {
await AsyncStorage.removeItem(SAVED_SELECTED_THEME_KEY).catch((e) => {
AsyncStorage.removeItem(SAVED_SELECTED_THEME_KEY).catch((e) => {
console.warn("Failed to reset persisted selected theme", e);
});
}
Expand Down

0 comments on commit cdc7e60

Please sign in to comment.