From a253dfc8cbd903c3f0183cd3607266c3bdb00a50 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 8 Nov 2023 00:44:30 +0700 Subject: [PATCH] add comment --- .../AppNavigator/createCustomStackNavigator/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.js b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.js index ec38aa35420a..8924b01e2acb 100644 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.js +++ b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.js @@ -29,8 +29,11 @@ const defaultProps = { function reduceReportRoutes(routes) { const result = []; let count = 0; - routes.forEach((route) => { + const reverseRoutes = [...routes].reverse(); + + reverseRoutes.forEach((route) => { if (route.name === NAVIGATORS.CENTRAL_PANE_NAVIGATOR) { + // Remove all report routes except the last 3. This will improve performance. if (count < 3) { result.push(route); count++; @@ -40,7 +43,7 @@ function reduceReportRoutes(routes) { } }); - return result; + return result.reverse(); } function ResponsiveStackNavigator(props) {