React Popovers Only Work with Clickable True


Topic: React Popovers Only Work with Clickable True

sedonawebservices pro asked 5 years ago

Expected behavior Setting clickable to false, would show popover on mouseOver

Actual behavior popover does not show unless clickable is true

Resources (screenshots, code snippets etc.)


Konrad Stępień staff answered 5 years ago

Hi @sedonawebservices,

Make you sure you didn't write a typo.

Can you test my code and write to me if the problem still exists?

import React from "react";
import {
  MDBPopover,
  MDBPopoverBody,
  MDBPopoverHeader,
  MDBBtn,
  MDBContainer,
  MDBSwitch
} from "mdbreact";

class PopoverTest extends React.Component {
  state = {
    switch1: true
  };

  handleSwitchChange = nr => () => {
    let switchNumber = `switch${nr}`;
    this.setState({
      [switchNumber]: !this.state[switchNumber]
    });
  };

  render() {
    return (
      <MDBContainer>
        <MDBSwitch
          checked={this.state.switch1}
          onChange={this.handleSwitchChange(1)}
          labelLeft="Hover"
          labelRight="Click"
        />

        <MDBPopover
          placement="bottom"
          popover
          clickable={this.state.switch1}
          id="popper1"
        >
          <MDBBtn>popover on bottom</MDBBtn>
          <div>
            <MDBPopoverHeader>popover on bottom</MDBPopoverHeader>
            <MDBPopoverBody>
              Sed posuere consectetur est at lobortis. Aenean eu leo quam.
              Pellentesque ornare sem lacinia quam venenatis vestibulum.
            </MDBPopoverBody>
          </div>
        </MDBPopover>
      </MDBContainer>
    );
  }
}

export default PopoverTest;

Best, Konrad.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.16.0
  • Device: Macbook
  • Browser: Chrome
  • OS: OS X
  • Provided sample code: No
  • Provided link: No
Tags