Skip to content

Commit

Permalink
fix(Affix): update postion in didmount
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna committed Nov 14, 2018
1 parent 08bc736 commit 1438cdf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/affix/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Affix extends React.Component {

componentDidMount() {
const { container } = this.props;
this._updateNodePosition();
// wait for parent rendered
this.timeout = setTimeout(() => {
this._setEventHandlerForContainer(container);
Expand Down Expand Up @@ -87,6 +88,9 @@ class Affix extends React.Component {
const { container } = this.props;
const affixContainer = container();

if (!affixContainer) {
return false;
}
const containerScrollTop = getScroll(affixContainer, true); // 容器在垂直位置上的滚动 offset
const affixOffset = this._getOffset(this.affixNode, affixContainer); // 目标节点当前相对于容器的 offset
const containerHeight = getNodeHeight(affixContainer); // 容器的高度
Expand Down

0 comments on commit 1438cdf

Please sign in to comment.