diff --git a/examples/CSSMotion.tsx b/examples/CSSMotion.tsx index 584fbbd..beb6979 100644 --- a/examples/CSSMotion.tsx +++ b/examples/CSSMotion.tsx @@ -5,6 +5,7 @@ import './CSSMotion.less'; interface DemoState { show: boolean; + forceRender: boolean; motionLeaveImmediately: boolean; removeOnLeave: boolean; hasMotionClassName: boolean; @@ -12,7 +13,7 @@ interface DemoState { } async function forceDelay(): Promise { - return new Promise((resolve) => { + return new Promise(resolve => { setTimeout(resolve, 2000); }); } @@ -32,6 +33,7 @@ const Div = React.forwardRef((props, ref) => { class Demo extends React.Component<{}, DemoState> { state: DemoState = { show: true, + forceRender: false, motionLeaveImmediately: false, removeOnLeave: true, hasMotionClassName: true, @@ -48,6 +50,10 @@ class Demo extends React.Component<{}, DemoState> { this.setState(({ prepare }) => ({ prepare: !prepare })); }; + onForceRender = () => { + this.setState(({ forceRender }) => ({ forceRender: !forceRender })); + }; + onRemoveOnLeave = () => { this.setState(({ removeOnLeave }) => ({ removeOnLeave: !removeOnLeave })); }; @@ -84,6 +90,7 @@ class Demo extends React.Component<{}, DemoState> { render() { const { show, + forceRender, motionLeaveImmediately, removeOnLeave, hasMotionClassName, @@ -106,6 +113,15 @@ class Demo extends React.Component<{}, DemoState> { hasMotionClassName + +