myxvisual / react-uwp

📱⌨ React Components that Implement Microsoft's UWP Design & Fluent Design.
https://react-uwp.com
MIT License
1.18k stars 78 forks source link

fix: Do not toggle NavigationView with boolean #109

Closed 7coil closed 4 years ago

7coil commented 4 years ago

If a boolean is used for the toggleExpanded function and the variable is the same as the current state (i.e. telling the NavigationView to close when it is already closed, or open when it is already open), the NavigationView would have toggled it's state in the past. This (hopefully) fixes this issue.

myxvisual commented 4 years ago

@7coil thanks

7coil commented 4 years ago

If you've googled this and need a temporary workaround, just check if the current state is expanded.

if (this.navigationView.current.state.expanded) {
  this.navigationView.current.toggleExpanded(false)
}