ListView requestAnimationFrame leak (#21802)

Summary:
Related to https://github.com/facebook/react-native/pull/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: https://github.com/facebook/react-native/pull/21802

Differential Revision: D10391812

Pulled By: RSNara

fbshipit-source-id: 49f0b0a4641ec29bcb4cc04bd3bafb42b3842b69
This commit is contained in:
Thomas BARRAS 2018-10-15 18:07:07 -07:00 committed by Facebook Github Bot
parent 8a3a0ad2d0
commit 70b5eb3aa2
1 changed files with 1 additions and 1 deletions

View File

@ -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);