From b878143b639d1803088aae4bff2dda4aac16367c Mon Sep 17 00:00:00 2001 From: Alexander Djenkov Date: Wed, 28 Feb 2018 15:36:26 +0200 Subject: [PATCH] fix(ios-action-bar): enable NavigationButton text change on first navigation (#5458) --- tns-core-modules/ui/frame/frame.ios.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tns-core-modules/ui/frame/frame.ios.ts b/tns-core-modules/ui/frame/frame.ios.ts index e212dee8d..18c409195 100644 --- a/tns-core-modules/ui/frame/frame.ios.ts +++ b/tns-core-modules/ui/frame/frame.ios.ts @@ -13,6 +13,8 @@ import * as utils from "../../utils/utils"; export * from "./frame-common"; +const majorVersion = utils.ios.MajorVersion; + const ENTRY = "_entry"; const NAV_DEPTH = "_navDepth"; const TRANSITION = "_transition"; @@ -88,6 +90,13 @@ export class Frame extends FrameBase { backstackEntry[NAV_DEPTH] = navDepth; viewController[ENTRY] = backstackEntry; + if (!animated && majorVersion > 10) { + // Reset back button title before pushing view controller to prevent + // displaying default 'back' title (when NavigaitonButton custom title is set). + let barButtonItem = UIBarButtonItem.alloc().initWithTitleStyleTargetAction("", UIBarButtonItemStyle.Plain, null, null); + viewController.navigationItem.backBarButtonItem = barButtonItem; + } + // First navigation. if (!this._currentEntry) { // Update action-bar with disabled animations before the initial navigation.