Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only retain the previousViews that need to be validated
Summary: Fixes #4740, where views would unnecessarily be retained after performing `navigator.pop()` - this was particularly problematic for big lists and memory-intensive custom views. This fix causes no functional change: `_previousViews` are only used in the loop starting at line 564 to ensure that the JavaScript and Native navigation stacks are equivalent at all times. As we do in this fix, that loop limits itself to only the views expected to be on the React navigation stack. So overall this change makes the code logically 'more correct'. Tested by checking that `_previousViews.count` is always equivalent to `previousReactCount` in the loop (which means we could remove the complex `MIN(... MIN(previousReactCount, _previousViews.count)` in the loop too, but I wanted to keep the diff as small as possible for now). Closes #10789 Differential Revision: D4140502 Pulled By: ericvicenti fbshipit-source-id: 4491ad3c16642914c3081295cf95c4cf36be9f94
- Loading branch information