diff --git a/package.json b/package.json index 2263ade..e1abe5c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codingapi/ui-framework", - "version": "0.0.37", + "version": "0.0.38", "description": "A UI Framework built with React and Typescript", "keywords": [ "ui", diff --git a/src/ThemeProvider/component.tsx b/src/ThemeProvider/component.tsx index 85580f1..b74a754 100644 --- a/src/ThemeProvider/component.tsx +++ b/src/ThemeProvider/component.tsx @@ -4,7 +4,7 @@ import {ThemeConfig} from "./types"; interface ThemeProviderProps { children: React.ReactNode; - theme: ThemeConfig + theme?: ThemeConfig } export const ThemeProviderContext = React.createContext(null); @@ -13,9 +13,11 @@ export const ThemeProvider: React.FC = (props) => { const currentTheme = React.useContext(ThemeProviderContext) || {}; + const propsTheme = props.theme || {} as ThemeConfig; + const [theme, dispatch] = React.useState({ ...currentTheme, - ...props.theme + ...propsTheme }); const themeContextRef = React.useRef(null);