Skip to content

Commit

Permalink
fix: forceRender not work (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored Apr 28, 2021
1 parent eac2f8f commit 748c301
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Popup/PopupInner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export interface PopupInnerProps {
// Motion
motion: CSSMotionProps;
destroyPopupOnHide?: boolean;
forceRender?: boolean;

// Legacy Motion
animation: AnimationType;
transitionName: TransitionNameType;
Expand Down Expand Up @@ -67,6 +69,7 @@ const PopupInner = React.forwardRef<PopupInnerRef, PopupInnerProps>(

stretch,
destroyPopupOnHide,
forceRender,

align,
point,
Expand Down Expand Up @@ -194,6 +197,7 @@ const PopupInner = React.forwardRef<PopupInnerRef, PopupInnerProps>(
onAppearPrepare={onShowPrepare}
onEnterPrepare={onShowPrepare}
removeOnLeave={destroyPopupOnHide}
forceRender={forceRender}
>
{({ className: motionClassName, style: motionStyle }, motionRef) => {
const mergedClassName = classNames(
Expand Down
1 change: 1 addition & 0 deletions src/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface PopupProps {
// Motion
motion: CSSMotionProps;
maskMotion: CSSMotionProps;
forceRender?: boolean;

// Legacy
animation: AnimationType;
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ export function generateTrigger(
stretch,
alignPoint,
mobile,
forceRender,
} = this.props;
const { popupVisible, point } = this.state;

Expand Down Expand Up @@ -550,6 +551,7 @@ export function generateTrigger(
ref={this.popupRef}
motion={popupMotion}
mobile={mobile}
forceRender={forceRender}
>
{typeof popup === 'function' ? popup() : popup}
</Popup>
Expand Down
1 change: 1 addition & 0 deletions tests/basic.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ describe('Trigger.Basic', () => {
<span>Hey!</span>
</Trigger>,
);

expect(wrapper.instance().getPopupDomNode()).toBeFalsy();
});

Expand Down

0 comments on commit 748c301

Please sign in to comment.