From 60988e136bdacd02315e415110883d3d7e06718d Mon Sep 17 00:00:00 2001 From: shao Date: Mon, 11 Nov 2019 13:59:31 +0800 Subject: [PATCH] use monitorResize --- examples/simple.js | 14 +++++++++++++- src/Align.tsx | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/examples/simple.js b/examples/simple.js index cf916ca..4adac23 100644 --- a/examples/simple.js +++ b/examples/simple.js @@ -10,6 +10,7 @@ class Test extends Component { align: { points: ['cc', 'cc'], }, + sourceWidth: 50, }; componentDidMount() { @@ -65,6 +66,13 @@ class Test extends Component { this.$align.forceAlign(); }; + toggleSourceSize = () => { + this.setState({ + // eslint-disable-next-line react/no-access-state-in-setstate + sourceWidth: this.state.sourceWidth + 10, + }); + }; + render() { const { random, randomWidth } = this.state; @@ -79,6 +87,10 @@ class Test extends Component { Force align     + +