Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
perf(floating-menu): reduce forced synchronous layout (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
asudoh authored and iangfleming committed Jul 7, 2017
1 parent bb1a90d commit dcdc8ec
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion components/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class OverflowMenu extends Component {
};

componentDidMount() {
this.getMenuPosition();
requestAnimationFrame(() => {
this.getMenuPosition();
});
this.hResize = OptimizedResize.add(() => {
this.getMenuPosition();
});
Expand Down
4 changes: 3 additions & 1 deletion components/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class Tooltip extends Component {
};

componentDidMount() {
this.getTriggerPosition();
requestAnimationFrame(() => {
this.getTriggerPosition();
});
}

getTriggerPosition = () => {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@
"coverageDirectory": "./coverage",
"moduleNameMapper": {
"^.+\\.(scss)$": "<rootDir>/lib/styleMock.js"
}
},
"setupFiles": [
"<rootDir>/setup-jest.js"
]
},
"lint-staged": {
"*.js": [
Expand Down
1 change: 1 addition & 0 deletions setup-jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.requestAnimationFrame = (callback) => { callback(); };

1 comment on commit dcdc8ec

@chrisdhanaraj
Copy link
Contributor

Choose a reason for hiding this comment

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

Bluemix toolchain: Delivery Pipeline deployed carbon-components-react to Bluemix Design System, including this commit

Please sign in to comment.