@tamagui/core 1.0.1-beta.189 → 1.0.1-beta.190
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/views/ThemeProvider.js +4 -3
- package/dist/cjs/views/ThemeProvider.js.map +3 -3
- package/dist/cjs/views/ThemeReset.js +3 -3
- package/dist/cjs/views/ThemeReset.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +2 -1
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/esm/views/ThemeReset.js +4 -4
- package/dist/esm/views/ThemeReset.js.map +2 -2
- package/package.json +11 -11
- package/src/views/ThemeProvider.tsx +2 -1
- package/src/views/ThemeReset.tsx +4 -4
|
@@ -28,9 +28,10 @@ __export(ThemeProvider_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(ThemeProvider_exports);
|
|
30
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_constants = require("@tamagui/constants");
|
|
31
32
|
var import_react = __toESM(require("react"));
|
|
32
33
|
var import_config = require("../config");
|
|
33
|
-
var
|
|
34
|
+
var import_constants2 = require("../constants/constants");
|
|
34
35
|
var import_ThemeContext = require("../contexts/ThemeContext");
|
|
35
36
|
var import_Theme = require("./Theme");
|
|
36
37
|
import_react.default["createElement"];
|
|
@@ -40,12 +41,12 @@ const ThemeProvider = (props) => {
|
|
|
40
41
|
throw new Error(`Missing configureThemes() call, add to your root file`);
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
if (
|
|
44
|
+
if (import_constants.isClient) {
|
|
44
45
|
(0, import_react.useLayoutEffect)(() => {
|
|
45
46
|
if (props.disableRootThemeClass) {
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
const cn = `${
|
|
49
|
+
const cn = `${import_constants2.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`;
|
|
49
50
|
const target = props.themeClassNameOnRoot ? document.documentElement : document.body;
|
|
50
51
|
target.classList.add(cn);
|
|
51
52
|
return () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getConfig, getHasConfigured } from '../config'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (process.env.NODE_ENV === 'development') {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["React"]
|
|
4
|
+
"sourcesContent": ["import { isClient } from '@tamagui/constants'\nimport React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getConfig, getHasConfigured } from '../config'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (process.env.NODE_ENV === 'development') {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (isClient) {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n const target = props.themeClassNameOnRoot ? document.documentElement : document.body\n target.classList.add(cn)\n return () => {\n target.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass, props.themeClassNameOnRoot])\n }\n\n const themeContext = useMemo(() => {\n return {\n get themes() {\n return getConfig().themes\n },\n defaultTheme: props.defaultTheme,\n }\n }, [props.defaultTheme])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqDM;AArDN,uBAAyB;AACzB,mBAAgD;AAEhD,oBAA4C;AAC5C,IAAAA,oBAAuC;AACvC,0BAA6B;AAC7B,mBAAsB;AAGtB,aAAAC,QAAM;AAWC,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,KAAC,gCAAiB,GAAG;AACvB,YAAM,IAAI,MAAM,uDAAuD;AAAA,IACzE;AAAA,EACF;AAGA,MAAI,2BAAU;AACZ,sCAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,2CAAyB,MAAM;AAC7C,YAAM,SAAS,MAAM,uBAAuB,SAAS,kBAAkB,SAAS;AAChF,aAAO,UAAU,IAAI,EAAE;AACvB,aAAO,MAAM;AACX,eAAO,UAAU,OAAO,EAAE;AAAA,MAC5B;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,uBAAuB,MAAM,oBAAoB,CAAC;AAAA,EAClF;AAEA,QAAM,mBAAe,sBAAQ,MAAM;AACjC,WAAO;AAAA,MACL,IAAI,SAAS;AACX,mBAAO,yBAAU,EAAE;AAAA,MACrB;AAAA,MACA,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,YAAY,CAAC;AAEvB,SACE,4CAAC,iCAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,IAC5B,sDAAC;AAAA,MACC,WAAW,MAAM;AAAA,MACjB,MAAM,MAAM;AAAA,MACZ,mBAAmB,MAAM;AAAA,MAExB,gBAAM;AAAA,KACT;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": ["import_constants", "React"]
|
|
7
7
|
}
|
|
@@ -36,21 +36,21 @@ import_react.default["createElement"];
|
|
|
36
36
|
const ThemeReset = (props) => {
|
|
37
37
|
const themeManager = (0, import_react.useContext)(import_ThemeManager.ThemeManagerContext);
|
|
38
38
|
const [name, setName] = (0, import_react.useState)(null);
|
|
39
|
-
if (
|
|
39
|
+
if (import_constants.isClient) {
|
|
40
40
|
(0, import_react.useLayoutEffect)(() => {
|
|
41
41
|
if (!themeManager)
|
|
42
42
|
return;
|
|
43
43
|
if (name !== themeManager.parentName) {
|
|
44
44
|
setName(themeManager.parentName);
|
|
45
45
|
}
|
|
46
|
-
}, [themeManager == null ? void 0 : themeManager.parentName]);
|
|
46
|
+
}, [name, themeManager, themeManager == null ? void 0 : themeManager.parentName]);
|
|
47
47
|
(0, import_react.useLayoutEffect)(() => {
|
|
48
48
|
if (!themeManager)
|
|
49
49
|
return;
|
|
50
50
|
return themeManager.onChangeTheme(() => {
|
|
51
51
|
setName(themeManager.parentName);
|
|
52
52
|
});
|
|
53
|
-
}, []);
|
|
53
|
+
}, [themeManager]);
|
|
54
54
|
}
|
|
55
55
|
if (!themeManager || !props.children) {
|
|
56
56
|
return props.children || null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeReset.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { ThemeManagerContext } from '../helpers/ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCI;AAtCJ,
|
|
4
|
+
"sourcesContent": ["import { isClient, isWeb } from '@tamagui/constants'\nimport React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { ThemeManagerContext } from '../helpers/ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (isClient) {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [name, themeManager, themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [themeManager])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" reset name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCI;AAtCJ,uBAAgC;AAChC,mBAA6D;AAE7D,0BAAoC;AACpC,mBAAsB;AAGtB,aAAAA,QAAM;AAGC,MAAM,aAAa,CAAC,UAA8B;AACvD,QAAM,mBAAe,yBAAW,uCAAmB;AACnD,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAwB,IAAI;AAKpD,MAAI,2BAAU;AACZ,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,6CAAc,UAAU,CAAC;AAEjD,sCAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,YAAY,CAAC;AAAA,EACnB;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,4CAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,IACtC,gBAAM;AAAA,GACT;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isClient } from "@tamagui/constants";
|
|
2
3
|
import React, { useLayoutEffect, useMemo } from "react";
|
|
3
4
|
import { getConfig, getHasConfigured } from "../config";
|
|
4
5
|
import { THEME_CLASSNAME_PREFIX } from "../constants/constants";
|
|
@@ -11,7 +12,7 @@ const ThemeProvider = (props) => {
|
|
|
11
12
|
throw new Error(`Missing configureThemes() call, add to your root file`);
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
if (
|
|
15
|
+
if (isClient) {
|
|
15
16
|
useLayoutEffect(() => {
|
|
16
17
|
if (props.disableRootThemeClass) {
|
|
17
18
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getConfig, getHasConfigured } from '../config'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (process.env.NODE_ENV === 'development') {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { isClient } from '@tamagui/constants'\nimport React, { useLayoutEffect, useMemo } from 'react'\n\nimport { getConfig, getHasConfigured } from '../config'\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { ThemeContext } from '../contexts/ThemeContext'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\nexport type ThemeProviderProps = {\n className?: string\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (process.env.NODE_ENV === 'development') {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n if (isClient) {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n const target = props.themeClassNameOnRoot ? document.documentElement : document.body\n target.classList.add(cn)\n return () => {\n target.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass, props.themeClassNameOnRoot])\n }\n\n const themeContext = useMemo(() => {\n return {\n get themes() {\n return getConfig().themes\n },\n defaultTheme: props.defaultTheme,\n }\n }, [props.defaultTheme])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n >\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAqDM;AArDN,SAAS,gBAAgB;AACzB,OAAO,SAAS,iBAAiB,eAAe;AAEhD,SAAS,WAAW,wBAAwB;AAC5C,SAAS,8BAA8B;AACvC,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AAGtB,MAAM;AAWC,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,iBAAiB,GAAG;AACvB,YAAM,IAAI,MAAM,uDAAuD;AAAA,IACzE;AAAA,EACF;AAGA,MAAI,UAAU;AACZ,oBAAgB,MAAM;AACpB,UAAI,MAAM,uBAAuB;AAC/B;AAAA,MACF;AACA,YAAM,KAAK,GAAG,yBAAyB,MAAM;AAC7C,YAAM,SAAS,MAAM,uBAAuB,SAAS,kBAAkB,SAAS;AAChF,aAAO,UAAU,IAAI,EAAE;AACvB,aAAO,MAAM;AACX,eAAO,UAAU,OAAO,EAAE;AAAA,MAC5B;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,uBAAuB,MAAM,oBAAoB,CAAC;AAAA,EAClF;AAEA,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO;AAAA,MACL,IAAI,SAAS;AACX,eAAO,UAAU,EAAE;AAAA,MACrB;AAAA,MACA,cAAc,MAAM;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,YAAY,CAAC;AAEvB,SACE,oBAAC,aAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,IAC5B,8BAAC;AAAA,MACC,WAAW,MAAM;AAAA,MACjB,MAAM,MAAM;AAAA,MACZ,mBAAmB,MAAM;AAAA,MAExB,gBAAM;AAAA,KACT;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { isClient } from "@tamagui/constants";
|
|
3
3
|
import React, { useContext, useLayoutEffect, useState } from "react";
|
|
4
4
|
import { ThemeManagerContext } from "../helpers/ThemeManager";
|
|
5
5
|
import { Theme } from "./Theme";
|
|
@@ -7,21 +7,21 @@ React["createElement"];
|
|
|
7
7
|
const ThemeReset = (props) => {
|
|
8
8
|
const themeManager = useContext(ThemeManagerContext);
|
|
9
9
|
const [name, setName] = useState(null);
|
|
10
|
-
if (
|
|
10
|
+
if (isClient) {
|
|
11
11
|
useLayoutEffect(() => {
|
|
12
12
|
if (!themeManager)
|
|
13
13
|
return;
|
|
14
14
|
if (name !== themeManager.parentName) {
|
|
15
15
|
setName(themeManager.parentName);
|
|
16
16
|
}
|
|
17
|
-
}, [themeManager == null ? void 0 : themeManager.parentName]);
|
|
17
|
+
}, [name, themeManager, themeManager == null ? void 0 : themeManager.parentName]);
|
|
18
18
|
useLayoutEffect(() => {
|
|
19
19
|
if (!themeManager)
|
|
20
20
|
return;
|
|
21
21
|
return themeManager.onChangeTheme(() => {
|
|
22
22
|
setName(themeManager.parentName);
|
|
23
23
|
});
|
|
24
|
-
}, []);
|
|
24
|
+
}, [themeManager]);
|
|
25
25
|
}
|
|
26
26
|
if (!themeManager || !props.children) {
|
|
27
27
|
return props.children || null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeReset.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { ThemeManagerContext } from '../helpers/ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (
|
|
5
|
-
"mappings": "AAsCI;AAtCJ,SAAS,
|
|
4
|
+
"sourcesContent": ["import { isClient, isWeb } from '@tamagui/constants'\nimport React, { useContext, useLayoutEffect, useState } from 'react'\n\nimport { ThemeManagerContext } from '../helpers/ThemeManager'\nimport { Theme } from './Theme'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// resets the theme to the parent theme\nexport const ThemeReset = (props: { children?: any }) => {\n const themeManager = useContext(ThemeManagerContext)\n const [name, setName] = useState<string | null>(null)\n\n // this component doesn't work with SSR, so must run only client side\n // we could at least prevent more flickering by having the ssr head script\n // that changes to dark initially also go through and change all of these\n if (isClient) {\n useLayoutEffect(() => {\n if (!themeManager) return\n if (name !== themeManager.parentName) {\n setName(themeManager.parentName)\n }\n }, [name, themeManager, themeManager?.parentName])\n\n useLayoutEffect(() => {\n if (!themeManager) return\n return themeManager.onChangeTheme(() => {\n setName(themeManager.parentName)\n })\n }, [themeManager])\n }\n\n if (!themeManager || !props.children) {\n return props.children || null\n }\n\n return (\n <Theme className=\"tui-theme-reset\" reset name={name}>\n {props.children}\n </Theme>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAsCI;AAtCJ,SAAS,gBAAuB;AAChC,OAAO,SAAS,YAAY,iBAAiB,gBAAgB;AAE7D,SAAS,2BAA2B;AACpC,SAAS,aAAa;AAGtB,MAAM;AAGC,MAAM,aAAa,CAAC,UAA8B;AACvD,QAAM,eAAe,WAAW,mBAAmB;AACnD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAwB,IAAI;AAKpD,MAAI,UAAU;AACZ,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,UAAI,SAAS,aAAa,YAAY;AACpC,gBAAQ,aAAa,UAAU;AAAA,MACjC;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,6CAAc,UAAU,CAAC;AAEjD,oBAAgB,MAAM;AACpB,UAAI,CAAC;AAAc;AACnB,aAAO,aAAa,cAAc,MAAM;AACtC,gBAAQ,aAAa,UAAU;AAAA,MACjC,CAAC;AAAA,IACH,GAAG,CAAC,YAAY,CAAC;AAAA,EACnB;AAEA,MAAI,CAAC,gBAAgB,CAAC,MAAM,UAAU;AACpC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SACE,oBAAC;AAAA,IAAM,WAAU;AAAA,IAAkB,OAAK;AAAA,IAAC;AAAA,IACtC,gBAAM;AAAA,GACT;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.190",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@expo/match-media": "^0.3.0",
|
|
31
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
32
|
-
"@tamagui/constants": "^1.0.1-beta.
|
|
33
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
34
|
-
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.
|
|
35
|
-
"@tamagui/rnw": "^1.0.1-beta.
|
|
36
|
-
"@tamagui/rnw-lite": "^1.0.1-beta.
|
|
37
|
-
"@tamagui/use-did-finish-ssr": "^1.0.1-beta.
|
|
38
|
-
"@tamagui/use-event": "^1.0.1-beta.
|
|
39
|
-
"@tamagui/use-force-update": "^1.0.1-beta.
|
|
31
|
+
"@tamagui/compose-refs": "^1.0.1-beta.190",
|
|
32
|
+
"@tamagui/constants": "^1.0.1-beta.190",
|
|
33
|
+
"@tamagui/helpers": "^1.0.1-beta.190",
|
|
34
|
+
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.190",
|
|
35
|
+
"@tamagui/rnw": "^1.0.1-beta.190",
|
|
36
|
+
"@tamagui/rnw-lite": "^1.0.1-beta.190",
|
|
37
|
+
"@tamagui/use-did-finish-ssr": "^1.0.1-beta.190",
|
|
38
|
+
"@tamagui/use-event": "^1.0.1-beta.190",
|
|
39
|
+
"@tamagui/use-force-update": "^1.0.1-beta.190",
|
|
40
40
|
"expo-screen-orientation": "^4.3.0",
|
|
41
41
|
"hyphenate-style-name": "^1.0.4"
|
|
42
42
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react-dom": "*"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
48
|
+
"@tamagui/build": "^1.0.1-beta.190",
|
|
49
49
|
"@types/node": "^16.11.9",
|
|
50
50
|
"@types/react": "^18.0.15",
|
|
51
51
|
"csstype": "^3.0.10",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isClient } from '@tamagui/constants'
|
|
1
2
|
import React, { useLayoutEffect, useMemo } from 'react'
|
|
2
3
|
|
|
3
4
|
import { getConfig, getHasConfigured } from '../config'
|
|
@@ -25,7 +26,7 @@ export const ThemeProvider = (props: ThemeProviderProps) => {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
// ensure theme is attached to root body node as well to work with modals by default
|
|
28
|
-
if (
|
|
29
|
+
if (isClient) {
|
|
29
30
|
useLayoutEffect(() => {
|
|
30
31
|
if (props.disableRootThemeClass) {
|
|
31
32
|
return
|
package/src/views/ThemeReset.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isWeb } from '@tamagui/constants'
|
|
1
|
+
import { isClient, isWeb } from '@tamagui/constants'
|
|
2
2
|
import React, { useContext, useLayoutEffect, useState } from 'react'
|
|
3
3
|
|
|
4
4
|
import { ThemeManagerContext } from '../helpers/ThemeManager'
|
|
@@ -15,20 +15,20 @@ export const ThemeReset = (props: { children?: any }) => {
|
|
|
15
15
|
// this component doesn't work with SSR, so must run only client side
|
|
16
16
|
// we could at least prevent more flickering by having the ssr head script
|
|
17
17
|
// that changes to dark initially also go through and change all of these
|
|
18
|
-
if (
|
|
18
|
+
if (isClient) {
|
|
19
19
|
useLayoutEffect(() => {
|
|
20
20
|
if (!themeManager) return
|
|
21
21
|
if (name !== themeManager.parentName) {
|
|
22
22
|
setName(themeManager.parentName)
|
|
23
23
|
}
|
|
24
|
-
}, [themeManager?.parentName])
|
|
24
|
+
}, [name, themeManager, themeManager?.parentName])
|
|
25
25
|
|
|
26
26
|
useLayoutEffect(() => {
|
|
27
27
|
if (!themeManager) return
|
|
28
28
|
return themeManager.onChangeTheme(() => {
|
|
29
29
|
setName(themeManager.parentName)
|
|
30
30
|
})
|
|
31
|
-
}, [])
|
|
31
|
+
}, [themeManager])
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (!themeManager || !props.children) {
|