Skip to content

Commit

Permalink
fix: theme undefined with antd@4 (#49)
Browse files Browse the repository at this point in the history
* fix:  theme undefined with antd@4

* Create silent-buckets-grab.md

* chore: format
  • Loading branch information
lvisei authored Dec 6, 2024
1 parent 70a7ac0 commit 4ea7cac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-buckets-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@antv/gpt-vis': patch
---

fix: theme undefined with antd@4
5 changes: 3 additions & 2 deletions src/Text/utils/useAntdDarkAlgorithm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { ConfigProvider, theme as antdTheme } from 'antd';
import { isArray } from 'lodash';
import { useContext } from 'react';

const { darkAlgorithm } = antdTheme;

/** 判断是否运用了 antd dark algorithm */
export const useAntdDarkAlgorithm = () => {
// 放到函数内部,避免用户使用 antd@4,theme 变量不存在情况!!!
const darkAlgorithm = antdTheme?.darkAlgorithm;

const config = useContext(ConfigProvider.ConfigContext);
const currentAlgorithm = config.theme?.algorithm;

Expand Down

0 comments on commit 4ea7cac

Please sign in to comment.