@@ -69,6 +69,7 @@ interface ThemeProviderProps {
6969 } ;
7070 i18nConfig ?: I18nConfig ;
7171 scrollToHideProps ?: ScrollToHideProps ;
72+ themeStorageKeyName ?: string ;
7273}
7374
7475export const RNCProvider : React . FC < ThemeProviderProps > = ( {
@@ -80,6 +81,7 @@ export const RNCProvider: React.FC<ThemeProviderProps> = ({
8081 toast,
8182 i18nConfig,
8283 scrollToHideProps,
84+ themeStorageKeyName,
8385} ) => {
8486 const [ themeMode , setThemeModeState ] = useState < ThemeMode > ( defaultTheme ) ;
8587 const [ customTheme , setCustomTheme ] = useState < {
@@ -93,6 +95,7 @@ export const RNCProvider: React.FC<ThemeProviderProps> = ({
9395 const [ systemColorScheme , setSystemColorScheme ] = useState < ColorSchemeName > (
9496 Appearance . getColorScheme ( )
9597 ) ;
98+ const themeStorageKey = themeStorageKeyName ?? THEME_STORAGE_KEY ;
9699
97100 // Determine if dark mode should be active
98101 const isDark =
@@ -146,7 +149,7 @@ export const RNCProvider: React.FC<ThemeProviderProps> = ({
146149
147150 const loadThemeFromStorage = async ( ) => {
148151 try {
149- const storedConfig = await AsyncStorage . getItem ( THEME_STORAGE_KEY ) ;
152+ const storedConfig = await AsyncStorage . getItem ( themeStorageKey ) ;
150153 if ( storedConfig ) {
151154 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
152155 const config : ThemeConfig = JSON . parse ( storedConfig ) ;
@@ -218,7 +221,7 @@ export const RNCProvider: React.FC<ThemeProviderProps> = ({
218221 ) => {
219222 try {
220223 const config : ThemeConfig = { mode, customTheme, activePreset : preset } ;
221- await AsyncStorage . setItem ( THEME_STORAGE_KEY , JSON . stringify ( config ) ) ;
224+ await AsyncStorage . setItem ( themeStorageKey , JSON . stringify ( config ) ) ;
222225 } catch ( error ) {
223226 console . warn ( 'Failed to save theme to storage:' , error ) ;
224227 }
0 commit comments