component from refinedev/antd doesn't follow the ConfigProvider dark mode
component from refinedev/antd doesn't follow the ConfigProvider dark mode after build. The theme works on yarn dev. but when it gets built, it doesn't follow the theme
@refinedev/antd.@refinedev/antd to the transpilePackages array in your next.config.js file. Here's how you can do it:@refinedev/antd are correctly transpiled during the build process, allowing them to correctly switch themes.vite.config.ts file and ensure that it's correctly configured.@refinedev/antd are correctly transpiled during the build process, allowing them to correctly switch themes.@refinedev/antd are consuming the current theme context. useNotificationProvider hook that allows the Notification component to consume the current theme context. You can use this hook in the notificationProvider prop of the <Refine /> component. Here's an example:useNotificationProvider hook is used to enable the Notification component to consume the current theme context. <App /> component to make sure the notifications are also receiving the current theme configuration.ColorModeContext is a context that holds the current theme mode and a function to toggle it. You can use the useContext hook in any component to access the current theme mode and the function to toggle it.``
In this example, MyComponent` is a component that displays the current theme mode and a button to toggle it.List component from @refinedev/antd not correctly switching to dark mode. refine and @refinedev/antd. If you're not, try updating to the latest versions and see if that resolves the issue.refine and @refinedev/antd you're using, a description of the issue, steps to reproduce, and a minimal reproducible example if possible. The maintainers of Refine or other community members might be able to provide more specific guidance.List component from @refinedev/antd not correctly switching to dark mode. refine and @refinedev/antd. If you're not, try updating to the latest versions and see if that resolves the issue.refine and @refinedev/antd you're using, a description of the issue, steps to reproduce, and a minimal reproducible example if possible. The maintainers of Refine or other community members might be able to provide more specific guidance.@refinedev/antd are not explicitly mentioned in the provided knowledge sources. However, you can check the latest versions by running the following command in your terminal:@refinedev/core (Refine) and @refinedev/antd respectively.package.json files in the packages/core and packages/antd directories for the latest versions.@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antd@refinedev/antdtranspilePackagesnext.config.jsuseNotificationProvideruseNotificationProviderNotificationNotificationnotificationProvider<Refine /><App />ColorModeContextuseContext``
In this example, ListList@refinedev/corepackages/corepackages/antd/** @type {import('next').NextConfig} */
module.exports = {
transpilePackages: [
"@refinedev/antd",
],
};import { Refine } from "@refinedev/core";
import { ThemedLayoutV2, useNotificationProvider } from "@refinedev/antd";
import { ConfigProvider, App as AntdApp } from "antd";
const App: React.FC = () => {
return (
<ConfigProvider theme={RefineThemes.Blue}>
<AntdApp>
<Refine
//...
notificationProvider={useNotificationProvider}
>
<ThemedLayoutV2>{/* ... */}</ThemedLayoutV2>
</Refine>
</AntdApp>
</ConfigProvider>
);
};import React, { createContext, useState, useEffect } from "react";
type ColorModeContextType = {
mode: string;
setMode: () => void;
};
export const ColorModeContext = createContext<ColorModeContextType>(
{} as ColorModeContextType,
);
export const ColorModeContextProvider: React.FC = ({ children }) => {
const colorModeFromLocalStorage = localStorage.getItem("colorMode");
const isSystemPreferenceDark = window?.matchMedia(
"(prefers-color-scheme: dark)",
).matches;
const systemPreference = isSystemPreferenceDark ? "dark" : "light";
const [mode, setMode] = useState(
colorModeFromLocalStorage || systemPreference,
);
useEffect(() => {
window.localStorage.setItem("colorMode", mode);
}, [mode]);
const setColorMode = () => {
if (mode === "light") {
setMode("dark");
} else {
setMode("light");
}
};
return (
<ColorModeContext.Provider
value={{
setMode: setColorMode,
mode,
}}
>
{children}
</ColorModeContext.Provider>
);
};npm show @refinedev/core version
npm show @refinedev/antd version