-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
UncontrolledDropdown in 8.0.0 does not find toggle function in this.context #1457
Comments
I've also tested the same example in reactstrap==7.1.0 and get the expected output. |
This works with the latest version of react: https://stackblitz.com/edit/reactstrap-v8-6oafs2?file=Example.js I can confirm that I am gettin the same error when using For now, the suggested workaround is to upgrade react to 16.8 if you can. |
@twheys Hi, Did you solve the problem? I use react@16.8.6 and reactstrap@8.0.0, but i see this.context.toggle error :( |
I also get this error with react@16.8.6 and reactstrap@8.0.0. |
It turns about the minimum supported version for the way context is being consumed within DropdownToggle is react 16.6 which would explain why it works in newer version of react and not the 16.4 version reported here. For everyone reporting this issues while using the latest version of react, please provide an example using stackblitz or something similar as I cannot reproduce it in the latest version of react. (see my sample: stackblitz.com/edit/reactstrap-v8-6oafs2?file=Example.js) Chances are that you are not using the version of react you think you are using. |
Using your example, I have worked out how to replicate it. It appears to only be an issue if you're importing the DropDownToggle (or DropDownMenu) directly out of the lib folder. Here is the modified stackblitz with the issue: I am running react@16.8.6 and also had the issue with reactstrap@8.0.0 (there is no way I could be running an earlier version of react as I'm using hooks quite extensively). So the simple "fix" is just to change how you do the imports for reactstrap. |
Thanks to @leighmetzroth I got a fix. I am also using react@16.8.6 with reactstrap@8.0.0 and I was also importing Earlier:
Fixed code:
|
Ok, so when importing directly it seems that two different versions/instances of DropdownContext are being used. To avoid this, always import things the same way (or know which import style is getting used under the hood.) |
@TheSharpieOne with react 16.8 I get the same error. @YaroslavLyzlov no I did not solve the issue, but rolling back to reactstrap 7.1 fixed it for me. |
I have the same Issue for me, version 8.0.0 React 16.x.x |
@twheys, @canotech: Can you create an example showing the issue via something like stackblitz |
|
@canotech the dropdown in your example works perfectly: https://stackblitz.com/edit/reactstrap-v8-n8zlcz?file=Example.js Make sure the version of react you are using is 16.6+ |
https://stackblitz.com/edit/react-5evsqd To reproduce the error, click on the dropdown button |
@TheSharpieOne and also I make sure the version of react-dom is 16.8.+ That's works for me! thank you @TheSharpieOne ! |
Please expose the context as said in #1462 . There is no way to import it via Every possibility returns the same error upon compilation On standard Webpack + Babel configuration it works fine but still looks hacky. |
This simply solved it for me. I added
may also work with |
I didn't even have to use UncontrolledDropdown to replace Dropdown. From the quoted example I found missing property "inNavbar" and added to Dropdown as below:
The one property. Using React 16.8.6 and Reactstrap 8.0.1 |
Anyone working on it. I would like to take this issue. |
@onlywicked, It's all your. Thank you! |
|
it still not works in v8.9.0 |
UncontrolledDrownDown
#8.0.0
umd/csj/es
#16.4.1
#4.3.1
What is happening?
On clicking the dropdown button in the UncontrolledDropdown component, an unhandled exception is raised and the dropdown menu does not appear.
What should be happening?
On clicking the dropdown button, the dropdown menu should appear.
Steps to reproduce issue
Error message in console
Code
The text was updated successfully, but these errors were encountered: