Skip to content

Commit

Permalink
ListView requestAnimationFrame leak (#21802)
Browse files Browse the repository at this point in the history
Summary:
Related to #21488
Disclaimer: I made this PR.

I think there's some requestAnimationFrame events that are not cleared on unmount because of bad use of `splice` method.

- All flow tests succeed.
- RNTester: iOS (this change should only affect iOS because calculateChildFrames is iOS only)
Show perf monitor, show ListView* screen, start scrolling. UI frame Rate is used at the beginning. When scrolling there is no drop in FPS rate.
- TODO: I'll write a load test for ListView

[GENERAL] [ENHANCEMENT] [ListView.js] - rm TimerMixin
Pull Request resolved: #21802

Differential Revision: D10391812

Pulled By: RSNara

fbshipit-source-id: 49f0b0a4641ec29bcb4cc04bd3bafb42b3842b69
  • Loading branch information
exced authored and facebook-github-bot committed Oct 16, 2018
1 parent 8a3a0ad commit 70b5eb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Lists/ListView/ListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ const ListView = createReactClass({

_requestAnimationFrame: function(fn: () => void): void {
const rafId = requestAnimationFrame(() => {
this._rafIds.splice(this._rafIds.indexOf(rafId));
this._rafIds = this._rafIds.filter(id => id !== rafId);
fn();
});
this._rafIds.push(rafId);
Expand Down

0 comments on commit 70b5eb3

Please sign in to comment.