Skip to content

Commit 32ec367

Browse files
committed
feat: Add keepAlign support
ref ant-design/ant-design#20677
1 parent 1b8e9a3 commit 32ec367

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"classnames": "^2.2.6",
5959
"prop-types": "15.x",
6060
"raf": "^3.4.1",
61-
"rc-align": "^3.0.0-alpha.3",
61+
"rc-align": "^3.0.0-rc.0",
6262
"rc-animate": "^2.10.2",
6363
"rc-util": "^4.15.2"
6464
}

src/Popup.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ interface PopupProps {
5959
point?: Point;
6060
zIndex?: number;
6161
mask?: boolean;
62+
keepAlign?: boolean;
6263

6364
// Motion
6465
motion: MotionType;
@@ -249,6 +250,7 @@ class Popup extends Component<PopupProps, PopupState> {
249250
prefixCls,
250251
className,
251252
style,
253+
keepAlign,
252254
stretch,
253255
visible,
254256
align,
@@ -332,6 +334,7 @@ class Popup extends Component<PopupProps, PopupState> {
332334
disabled={mergedAlignDisabled}
333335
align={align}
334336
onAlign={this.onAlign}
337+
keepAlign={keepAlign}
335338
>
336339
<PopupInner
337340
prefixCls={prefixCls}

src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export interface TriggerProps {
7575

7676
stretch?: string;
7777
alignPoint?: boolean; // Maybe we can support user pass position in the future
78+
/** Align will repeat trigger when component did updated */
79+
keepAlign?: boolean;
7880

7981
/** Set popup motion. You can ref `rc-animate` for more info. */
8082
popupMotion?: MotionType;
@@ -458,6 +460,7 @@ export function generateTrigger(PortalComponent: any): React.ComponentClass<Trig
458460
popup,
459461
stretch,
460462
alignPoint,
463+
keepAlign,
461464
} = this.props;
462465
const { popupVisible, point } = this.state;
463466

@@ -497,6 +500,7 @@ export function generateTrigger(PortalComponent: any): React.ComponentClass<Trig
497500
maskMotion={maskMotion}
498501
ref={this.popupRef}
499502
motion={popupMotion}
503+
keepAlign={keepAlign}
500504
>
501505
{typeof popup === 'function' ? popup() : popup}
502506
</Popup>

0 commit comments

Comments
 (0)