From f541ffb38af879f73e9d34b26a2b3bdb2bbdd573 Mon Sep 17 00:00:00 2001 From: Adrian Perez Date: Thu, 4 Aug 2016 09:30:17 +0200 Subject: [PATCH] fix(NavBar): don't render custom BackButton if root nav state (#998) Avoid rendering a custom `BackButton` if the default implementation should avoid rendering, such as when the current scene is the root scene. Since main `state` isn't being passed to the custom component we have no way (that I'm aware of) of determining whether it should actually render a back button. --- src/NavBar.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/NavBar.js b/src/NavBar.js index 0f71d7423..ca975f352 100644 --- a/src/NavBar.js +++ b/src/NavBar.js @@ -205,6 +205,11 @@ class NavBar extends React.Component { state.leftButtonStyle, childState.leftButtonStyle, ]; + + if (state.index === 0) { + return null; + } + if (BackButton) { return (