alexkuz/react-dock

Make size “controlled” when onSizeChanged is present

Closed this issue · 3 comments

Currently, there seems to be no way to react to the size change. In Redux DevTools, we want to persist the last chosen size, so it's important to essentially treat this component as a controlled one—all user changes should trigger onSizeChanged and if, and only if the size prop has been updated by the parent, the changes should apply.

Does this make sense?

(Nitpick: onSizeChange would be a better name given React's convention, but that wouldn't match an existing onVisibleChanged event. Perhaps both could be given *Change name though.)

Yeah, I'm not great at naming things :)
I also think isResizing and isWindowResizing might be confusing (if we renaming something, it's better to rename all at once).

As for onSizeChange - makes sense indeed. I suppose we should add defaultSize prop and treat Dock with size prop as a controlled component, just like <input>.

@gaearon check out v0.2.0

Awesome, it works now.