Closed
Description
Description
One can observe retained memory while moving across different screens in the application. Even if you have one single stack with 3 different pages, you can observer a memory leak there. I have created a sample project to reproduce this issue. The link is given below
https://github.com/abhaynpai/rn-screens-leak
Screenshots
This is a YouTube video showcasing the leak in the project.
Steps To Reproduce
The steps are given in this GitHub link - https://github.com/abhaynpai/rn-screens-leak
Expected behavior
No memory leak should be displayed while moving across page.
Actual behavior
While moving between pages you can observe multiple memory leaks.
Snack or minimal code example
// App.js
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {StatusBar} from 'react-native';
import {enableScreens} from 'react-native-screens';
import TestStack from './src/TestStack';
enableScreens();
const App: () => React$Node = () => {
return (
<NavigationContainer>
<StatusBar barStyle="dark-content" />
{TestStack()}
</NavigationContainer>
);
};
export default App;
// ________________________
// TestStack.js
import React from 'react';
import {createNativeStackNavigator} from 'react-native-screens/native-stack';
import TestPage1 from './TestPage1';
import TestPage2 from './TestPage2';
import TestPage3 from './TestPage3';
const Stack = createNativeStackNavigator();
const TestStack = () => {
return (
<Stack.Navigator>
<Stack.Screen name="TestPage1" component={TestPage1} />
<Stack.Screen name="TestPage2" component={TestPage2} />
<Stack.Screen name="TestPage3" component={TestPage3} />
</Stack.Navigator>
);
};
export default TestStack;
Package versions
- React: 16.13.1
- React Native: 0.63.4
- React Native Screens: 2.18.1
Metadata
Metadata
Assignees
Labels
No labels