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

onUpdate bug #1

Closed
TimNZ opened this issue Nov 6, 2016 · 7 comments
Closed

onUpdate bug #1

TimNZ opened this issue Nov 6, 2016 · 7 comments
Assignees
Labels

Comments

@TimNZ
Copy link

TimNZ commented Nov 6, 2016

Great component, thanks!

What argument are you intending to pass to onUpdate callback as this.state.props doesn't exist?
this.state.panels?

 componentWillUpdate: function componentWillUpdate() {
    if (this.props.onUpdate) {
      this.props.onUpdate(this.state.props.slice());  
    }
  }
@DanFessler
Copy link
Owner

DanFessler commented Nov 7, 2016

good catch. The intent was to pass out the panels object, yeah.

Related to this, when you update the props externally it's supposed to update the internal panels state in componentWillReceiveProps, but it's not making a correct props comparison so it wont work. I'll fix both of these issues.

@TimNZ
Copy link
Author

TimNZ commented Nov 7, 2016

Thanks Dan.

I want to do a mash up of your component and this: http://zippyui.com/docs/react-split-container.
I like it's open/close shortcut feature.

@DanFessler
Copy link
Owner

Pushed a fix.

To do what you want, maintain the panel widths in your container's state and supply it to the PanelGroup as a panelWidths prop. Stay in sync with the PanelGroup's internal state changes by supplying a hook to props.onUpdate that then updates your container's copy.

With that, you should be able to collapse a panel programmatically or whatever other special thing you want to do. I tested this scenario locally, but let me know if you get it working too.

@DanFessler DanFessler self-assigned this Nov 7, 2016
@DanFessler DanFessler added the bug label Nov 7, 2016
@TimNZ
Copy link
Author

TimNZ commented Nov 7, 2016

Cheers bro, appreciate your time.

@TimNZ
Copy link
Author

TimNZ commented Nov 7, 2016

I'll make some modifications and submit a pull request if I decide to use it for the current project to incorporate more customisability.

Thanks again for it.

@TimNZ
Copy link
Author

TimNZ commented Nov 7, 2016

Can you please publish an update to npm.

@DanFessler
Copy link
Owner

Done. Closing issue

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

No branches or pull requests

2 participants