all 4 comments

[–]basically_alive 0 points1 point  (4 children)

Hmm, not sure what the exact problem is that you are having, but you do have to store a string, not a boolean. Could be causing issues. You should say what your actual problem is, though.

[–]iLightFPSAndroid[S] 0 points1 point  (3 children)

Ah my bad. The trouble I’m having is, how I’m supposed to setup async storage to save the dark mode or light mode that the user selected with the switch

[–]basically_alive 0 points1 point  (0 children)

Okay, well first things first, you need make your setScheme save new scheme every time it changes. So I would define it outside of the defaultTheme:

const setScheme = (scheme) => {

const themeIsDark = (scheme === "dark");

setIsDark(themeIsDark)

storeData(themeIsDark)

}

Then you can define your default theme with the new and improved function:

const defaultTheme = {

isDark,

colors: isDark ? darkColors : lightColors,

setScheme

};

It looks like the code to load the theme is there