Skip to content

fix: should re-align correctly when resize window, close: #56 #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ node_modules
*.css
build
lib
es
coverage
yarn.lock
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"build": "rc-tools run build",
"gh-pages": "rc-tools run gh-pages",
"start": "rc-tools run server",
"compile": "rc-tools run compile",
"pub": "rc-tools run pub --babel-runtime",
"lint": "rc-tools run lint",
"karma": "rc-test run karma",
Expand Down
5 changes: 3 additions & 2 deletions src/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ class Popup extends Component {

onAlign = (popupDomNode, align) => {
const props = this.props;
const alignClassName = props.getClassNameFromAlign(props.align);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window resize 时触发的 onAlign,这时 props.align 根本没有更新过,所以以 props.getClassNameFromAlign(props.align) 作为参考是不合理的。

const currentAlignClassName = props.getClassNameFromAlign(align);
if (alignClassName !== currentAlignClassName) {
// FIX: https://github.com/react-component/trigger/issues/56
// FIX: https://github.com/react-component/tooltip/issues/79
if (this.currentAlignClassName !== currentAlignClassName) {
this.currentAlignClassName = currentAlignClassName;
popupDomNode.className = this.getClassName(currentAlignClassName);
}
Expand Down