moveable icon indicating copy to clipboard operation
moveable copied to clipboard

Moveable target maybe not update. Consider to add componentWillReceiveProps for MoveableManager

Open ladifire opened this issue 6 years ago • 3 comments

Hi, Sorry I can not make a codepen demo for this issue, because my case is complicate. I've make a complex app that using your lib. Everything work perfect, but when there is only one item selected, then click outside (click on container to unselect it), Moveable target is set to null but the control box is not disappear. Screenshot from 2020-01-08 12-25-10

Add this to MoveableManager.tsx will fixed: UNSAFE_componentWillReceiveProps(nextProps: Readonly<MoveableManagerProps<T>>, nextContext: any): void { if (nextProps.target !== this.props.target) { this.setState({target: nextProps.target}); } }

You maybe consider to add this to your library.

ladifire avatar Jan 08 '20 05:01 ladifire

This is video demo for before and after add above code: https://drive.google.com/file/d/1YBa_kK5QL7OLjboV6krTMOzSulxhUeOb/view

ladifire avatar Jan 08 '20 05:01 ladifire

@ladifire

What version of react-moveable are you using?

daybrush avatar Jan 10 '20 03:01 daybrush

if i change target properties exsternally (eg. width) moveable does not 'react'!

rended avatar Mar 12 '20 16:03 rended