[bug] isDarkTheme from useThemeContext always returns false
See original GitHub issue🐛 Bug Report
In the default template for docusaurus, I am trying to use theme context to get isDarkTheme
’s value. It is always set to false, even when I change to dark theme and then reload.
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
(Write your steps here:)
- Use `const {isDarkTheme} = useThemeContext()
- add console.log for isDarkTheme
- turn on dark theme and reload
Expected behavior
Should provide true when dark theme is set
Actual Behavior
isDarkTheme is false even when dark them is on
Your Environment
- Docusaurus version used:2.0.0-alpha.56
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node version: v12.17.0
- Operating system and version (desktop or mobile): Ubuntu 16.04
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
920 Message "instanceof will always return true" is false!
Collection are instances of java.util.Collection". This is incorrect since object could be null. The error message is misleading and could ...
Read more >session_gc always returns FALSE for user defined handlers
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!...
Read more >[错误] isdarktheme来自Usethemecontext总是返回false - 软件工程师 ...
isDarkTheme from useThemeContext always returns false Bug Report In the default template for docusaurus , I am trying to use theme context to...
Read more >get_magic_quotes_gpc() returns false instead of 0 - externals.io
Happy to patch this once someone confirms this is a bug and not ... I think that when implementing it to always return...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
docs has been updated here by @Drewbi : https://github.com/facebook/docusaurus/pull/2934
still think it would be cool if the code did actually warn the user in case of using the hook without a provider (could throw with a link to the docs)
@apsdehal Willing to submit a PR with better docs? 😊