File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
src/contexts/themeContext Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -16,17 +16,18 @@ export const ThemeContext = React.createContext({} as Theme);
1616export const ThemeProvider : React . FC < ThemeProviderInputValue > = ( props ) => {
1717 const { children, style } = props ;
1818 const { theme } = useTheme ( ) ;
19- const modifiedTheme = useMemo (
20- ( ) =>
19+ const modifiedTheme = useMemo ( ( ) => {
20+ const finalTheme =
2121 Object . keys ( theme ) . length === 0
2222 ? JSON . parse ( JSON . stringify ( defaultTheme ) )
23- : JSON . parse ( JSON . stringify ( theme ) ) ,
24- [ theme ] ,
25- ) ;
23+ : JSON . parse ( JSON . stringify ( theme ) ) ;
24+
25+ if ( style ) {
26+ merge ( finalTheme , style ) ;
27+ }
2628
27- if ( style ) {
28- merge ( modifiedTheme , style ) ;
29- }
29+ return finalTheme ;
30+ } , [ theme , style ] ) ;
3031
3132 return (
3233 < ThemeContext . Provider value = { modifiedTheme } >
You can’t perform that action at this time.
0 commit comments