question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add event listeners on Sidebar.

See original GitHub issue
  • Hey How to add event listeners(like on Click etc) on AppAside(Right side slide bar).I tried to add onClick listener but its not working.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
xidedixcommented, Jun 22, 2018

@vpn1997 here is a quick and dirty solution

  • modify src/containers/DefaultLayout/DefaultHeader.js like this:
// add ReactDOM import 
import ReactDOM from 'react-dom';
//...
class DefaultHeader extends Component {

  // createRef in contructor
  constructor(props) {
    super(props);
    this.asideTogglerRef = React.createRef();
  }

  // addEventListener
  componentDidMount() {
    ReactDOM.findDOMNode(this.asideTogglerRef.current).addEventListener('click', this.handleClick);
  }
 

  // removeEventListener
  componentWillUnmount() {
    ReactDOM.findDOMNode(this.asideTogglerRef.current).removeEventListener('click', this.handleClick);
  }

  // handle event
  handleClick() {
    console.log('Click')
  }

  render() {
  //...
  // add ref to AppAsideToggler
     <AppAsideToggler className="d-md-down-none" ref={this.asideTogglerRef}/>
  //...
  }
}
0reactions
xidedixcommented, Aug 28, 2018

I’m closing this since it appears to be inactive or answered above. Please comment and/or reopen if you feel the issue has not been resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change setting AND add an event listener to semantic ...
I have a Semantic UI sidebar and I want the page NOT to be dimmed when the sidebar is shown and also I...
Read more >
JavaScript Sidebar - Event Handling | DHTMLX Suite 7 Docs
You can explore the event handling of Sidebar in the documentation of the DHTMLX JavaScript UI library ... You can add any handler...
Read more >
w2sidebar.onMenuClick | JavaScript UI - w2ui
You can add event listener during the object creation: let sidebar ... This property is used for context menu when any of the...
Read more >
Event listeners popup, @media sidebar, Cubic bezier editor + ...
Event listeners popup · @media sidebar · Add new rule · Edit keyframes · Cubic bezier editor · More videos on YouTube ·...
Read more >
Catch Mobile Sidebar Open/Close Event - OutSystems
Adding the event listener manually on the onRender did not work, however adding it on the container onTouchStart via the container properties did....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found