react-bootstrap / react-overlays

Utilities for creating robust overlay components
https://react-bootstrap.github.io/react-overlays
MIT License
899 stars 222 forks source link

Dropdown toggle bug #970

Open Boilingwaterr opened 3 years ago

Boilingwaterr commented 3 years ago

Toggle handler has an error in the interface

image

To Reproduce it open sandbox

Steps to reproduce the behavior:

  1. Create dropdown with Dropdown component
  2. Pass an onToggle function as a props
  3. Click it
  4. See an error

Reproducible Example

Minimal example by using CodeSandbox.

Expected behavior

Flag show should be boolean

Received

false or event image

Environment

soetji commented 3 years ago

I have this issue too with react-overlays version 5.1.1.

It happens when I use the toggle from useDropdownToggle in the onClick for my button element. The show from useDropdownToggle becomes an event object when it is supposed to be true. It works when I don't have toggle on the onClick. See on the codesandbox below.

https://codesandbox.io/s/react-playground-forked-3xe86?file=/DropDownBar.js