Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

theme: improve check for inheriting emotion theme

Abdullah Atta66d50be35a35
diff --git a/packages/theme/src/emotion/theme-provider.tsx b/packages/theme/src/emotion/theme-provider.tsx
index 9a1f3b2e2..7de3b35c7 100644
--- a/packages/theme/src/emotion/theme-provider.tsx
+++ b/packages/theme/src/emotion/theme-provider.tsx
@@ -23,7 +23,8 @@ import {
useThemeColors,
useThemeEngineStore,
ScopedThemeProvider as NNScopedThemeProvider,
- ThemeFactory
+ ThemeFactory,
+ Theme
} from "../";
import React, { ForwardedRef, PropsWithChildren, useMemo } from "react";
import { Box, BoxProps } from "@theme-ui/components";
@@ -45,7 +46,7 @@ function _EmotionThemeProvider(
className,
...restProps
} = props;
- const emotionTheme = useTheme();
+ const emotionTheme = useTheme() as Theme;
const theme = useThemeEngineStore((store) => store.theme);
const themeScope = useThemeColors(scope);
const { colors } = themeScope;
@@ -62,7 +63,9 @@ function _EmotionThemeProvider(
return (
<ThemeProvider
theme={{
- ...(emotionTheme || themeProperties),
+ ...(emotionTheme && "space" in emotionTheme
+ ? emotionTheme
+ : themeProperties),
colors: themeProperties.colors
}}
>