mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 01:25:39 +00:00
a4bb4d25f5
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 https://github.com/facebook/react-native/pull/10789 Differential Revision: D4140502 Pulled By: ericvicenti fbshipit-source-id: 4491ad3c16642914c3081295cf95c4cf36be9f94