From 8645e361f13eb694b3c9028bfbfd231ecb8b9298 Mon Sep 17 00:00:00 2001 From: "satyajit.happy" Date: Thu, 22 Aug 2019 05:03:52 +0530 Subject: [PATCH] fix: check if left button is truthy to add a left offset --- .../stack/src/views/Header/HeaderSegment.tsx | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/packages/stack/src/views/Header/HeaderSegment.tsx b/packages/stack/src/views/Header/HeaderSegment.tsx index e2466eae..02df692e 100644 --- a/packages/stack/src/views/Header/HeaderSegment.tsx +++ b/packages/stack/src/views/Header/HeaderSegment.tsx @@ -274,6 +274,24 @@ export default class HeaderSegment extends React.Component { } } + const leftButton = left + ? left({ + backImage, + pressColorAndroid, + allowFontScaling: backAllowFontScaling, + onPress: onGoBack, + labelVisible: headerBackTitleVisible, + label: leftLabel !== undefined ? leftLabel : previousTitle, + truncatedLabel, + labelStyle: [leftLabelStyle, customLeftLabelStyle], + onLabelLayout: this.handleLeftLabelLayout, + screenLayout: layout, + titleLayout, + tintColor: headerTintColor, + canGoBack: Boolean(onGoBack), + }) + : null; + return ( { style={{ height: headerStatusBarHeight }} /> - {left ? ( + {leftButton ? ( - {left({ - backImage, - pressColorAndroid, - allowFontScaling: backAllowFontScaling, - onPress: onGoBack, - labelVisible: headerBackTitleVisible, - label: leftLabel !== undefined ? leftLabel : previousTitle, - truncatedLabel, - labelStyle: [leftLabelStyle, customLeftLabelStyle], - onLabelLayout: this.handleLeftLabelLayout, - screenLayout: layout, - titleLayout, - tintColor: headerTintColor, - canGoBack: Boolean(onGoBack), - })} + {leftButton} ) : null} { style={[ Platform.select({ ios: null, - default: { left: left ? 72 : 16 }, + default: { left: leftButton ? 72 : 16 }, }), styles.title, titleStyle,