Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useThemeVars not working correctly with ConfigProvider #1194

Closed
linkurzweg opened this issue Sep 17, 2021 · 5 comments
Closed

useThemeVars not working correctly with ConfigProvider #1194

linkurzweg opened this issue Sep 17, 2021 · 5 comments
Labels
untriaged need to sort

Comments

@linkurzweg
Copy link

linkurzweg commented Sep 17, 2021

TuSimple/naive-ui version (版本)

2.18.2

Vue version (Vue 版本)

3.2.6

Browser and its version (浏览器及其版本)

Chrome(93.0.4577.82)

System and its version (系统及其版本)

MacOS(11.5.2)

Node version (Node 版本)

Reappearance link (重现链接)

https://codesandbox.io/s/fragrant-glitter-6773d?file=/src/Demo.vue

Reappearance steps (重现步骤)

Wrap components in n-config-provider and provide custom colors. Then try to get the theme colors with useThemeVars.

Expected results (期望的结果)

Colors provided from useThemeVars are the same as provided from custom theme with n-config-provider.

Actual results (实际的结果)

useThemeVars returns just the default colors.

Remarks (补充说明)

First of all, thank you very much for your great work on Naive UI!

Unfortunately useThemeVars is unusable right now when using a custom theme. I would expect it to return the customized theme instead of just default values. I hope this can be fixed and I will be able to use the theme vars across my project with custom components! :)

Edit: I hope this is not the same bug as 1176. Unfortunately I don't speak Chinese :)

@github-actions github-actions bot added the untriaged need to sort label Sep 17, 2021
@07akioni
Copy link
Collaborator

@Volankey This seems to be an actual bug, take a look.

@Ciferlingvulo
Copy link
Contributor

@07akioni Hello, is this issue actually fixed ? In the CodeSandbox link provided by the author, and using the latest naiveui version (2.25.2), the themeVars values still don't match the themeOverrides values...

@07akioni
Copy link
Collaborator

@07akioni Hello, is this issue actually fixed ? In the CodeSandbox link provided by the author, and using the latest naiveui version (2.25.2), the themeVars values still don't match the themeOverrides values...

The bug is fixed. In the demo the config provider and useThemeVars are used in the same component, which isn't correct.

@07akioni
Copy link
Collaborator

This is the correct behavior

image

@Ciferlingvulo
Copy link
Contributor

Oh right, my bad. Thanks for your answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged need to sort
Projects
None yet
Development

No branches or pull requests

3 participants