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.

Drawer `onRequestChange` function prop is not called

See original GitHub issue

Problem description

Using Drawer component, onRequestChange function is not called.

The non working code should be working, don’t know what is going on with this component.

Non working code

onDrawerStatusChange() {
  console.log('Drawer status changed');
}

render() {
  return (
     <Drawer onRequestChange={this.onDrawerStatusChange} />
  );
}

Regardless the previous code, the following examples are working fine.

Working code

onDrawerStatusChange() {
  console.log('Drawer status changed');
}

render() {
  return (
     <div>
         <Drawer onRequestChange={console.log('Drawer status changed')} />
         <Drawer onRequestChange={this.onDrawerStatusChange()} />
     </ div>
  );
}

Versions

  • Material-UI: 0.18.5
  • React: 15.6.1
  • Browser: Chrome 59

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
stfnlzvncommented, Dec 12, 2017

I’m fine with this and I was just pointing out how I managed to get onRequestChange to fire

1reaction
stfnlzvncommented, Dec 12, 2017

I’ve noticed that onRequestChange is called only if docked property is set to false

Read more comments on GitHub >

github_iconTop Results From Across the Web

Drawer onRequestChange function prop is not called #7322
Problem description Using Drawer component, onRequestChange function is not called. The non working code should be working, don't know what ...
Read more >
Material-UI Drawer will not close and chrome shows a Warning
in components/LeftDrawer but instead i get a warning in chrome which reads: Warning: Unknown prop `onRequestChange` on <div> tag. Remove this ...
Read more >
Components and Props - React
Such functions are called “pure” because they do not attempt to change their inputs, and always return the same result for the same...
Read more >
Navigation prop reference
In a native stack navigator, calling navigate with a screen name will result in different behavior based on if the screen is already...
Read more >
useDisclosure - Chakra UI
Callback function to retrieve a set of props for the button that triggers the disclosure. Usage#. You can use a combination of the...
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