Hook useColorMode is called outside the <ColorModeProvider>.

See original GitHub issue

Hey,

I’m following the documentation example here : https://redocusaurus.vercel.app/docs/getting-started/Installation

My package JSON contains the following dependencies :

    "@docusaurus/core": "2.0.0-beta.18",
    "@docusaurus/preset-classic": "2.0.0-beta.18",
    "docusaurus-lunr-search": "2.1.15",
    "redocusaurus": "1.0.2"

My presets look like this in my config file :

  presets: [
    [
      require.resolve('@docusaurus/preset-classic'),
      {
        docs: { ... },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      },
    ],
    [
      'redocusaurus',
      {
        specs: [
          {
            spec: 'myyamlfile.yaml',
            route: '/testpage/',
          },
        ],
        // Theme Options for modifying how redoc renders them
        theme: {
          // Change with your site colors
          primaryColor: '#1890ff',
        },
      },
    ],
  ],

When accessing /testpage, I see the following :

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:5
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
elainegascacommented, May 4, 2022

I have the same problem, downgrading to 1.0.1 did not work.

1reaction
corysimmonscommented, Jun 14, 2022

@rohit-gohri Thank you so much for the great library and the great help. I think my company is adopting Redocusaurus and once it’s all styled up I’ll drop a link for you to showcase. ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug: useColorMode returned undefined colorMode if you use ...
Correction: Hooks actually get triggered, but the "colorMode"-value is "undefined". And this is unexpected, because everything else works: the ...
Read more >
useColorMode imported from Theme UI plugin in React-based ...
Looking at the doumentation link you provided, the useThemeUI hook return value seems to contain the theme , components , colorMode and ...
Read more >
Color Mode - Chakra UI
useColorMode is a React hook that gives you access to the current color mode, and a function to toggle the color mode. Toggle...
Read more >
Theme configuration - Docusaurus
useColorMode ​. A React hook to access the color context. This context contains functions for setting light and dark mode and exposes boolean ......
Read more >
Dark Mode - xstyled
Use the useColorMode hook in your application to change the color mode. This value will be stored in localStorage and used whenever the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found