Skip to content
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

Sidebar: couldn't change the visibility of sidebar component #3762

Closed
thormengkheang opened this issue Aug 27, 2019 · 2 comments · Fixed by #3772
Closed

Sidebar: couldn't change the visibility of sidebar component #3762

thormengkheang opened this issue Aug 27, 2019 · 2 comments · Fixed by #3772
Assignees
Labels

Comments

@thormengkheang
Copy link

thormengkheang commented Aug 27, 2019

Bug Report

Steps

Couldn't change the visibility of sidebar component via state visible.

import React, { Component } from "react";
import {
  Button,
  Header,
  Icon,
  Image,
  Menu,
  Segment,
  Sidebar
} from "semantic-ui-react";

export default class SidebarExampleSidebar extends Component {
  state = { visible: false };

  handleSidebarHide = () => this.setState({ visible: false });
  handleSidebarToggle = () =>
    this.setState(prevState => ({ visible: !prevState.visible }));

  render() {
    const { visible } = this.state;
    return (
      <div>
        <Button.Group>
          <Button onClick={this.handleSidebarToggle}>Toggle sidebar</Button>
        </Button.Group>
        <Sidebar.Pushable as={Segment}>
          <Sidebar
            as={Menu}
            animation="overlay"
            icon="labeled"
            inverted
            onHide={this.handleSidebarHide}
            vertical
            visible={visible}
            width="thin"
          >
            <Menu.Item as="a">
              <Icon name="home" />
              Home
            </Menu.Item>
            <Menu.Item as="a">
              <Icon name="gamepad" />
              Games
            </Menu.Item>
            <Menu.Item as="a">
              <Icon name="camera" />
              Channels
            </Menu.Item>
          </Sidebar>

          <Sidebar.Pusher>
            <Segment basic>
              <Header as="h3">Application Content</Header>
              <Image src="https://react.semantic-ui.com/images/wireframe/paragraph.png" />
            </Segment>
          </Sidebar.Pusher>
        </Sidebar.Pushable>
      </div>
    );
  }
}

Expected Result

Should close the sidebar when click on toggle sidebar.

Actual Result

Screen Recording 2019-08-27 at 4 36 20 PM

Version

^0.88.0

Testcase

https://codesandbox.io/embed/loving-shadow-3btuw

@welcome
Copy link

welcome bot commented Aug 27, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@layershifter layershifter self-assigned this Aug 27, 2019
@layershifter layershifter changed the title Couldn't change the visibility of sidebar component Sidebar: couldn't change the visibility of sidebar component Sep 2, 2019
@layershifter
Copy link
Member

Thanks for reporting, fixed in #3772 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants