fix(ios-action-bar): enable NavigationButton text change on first navigation (#5458)

This commit is contained in:
Alexander Djenkov
2018-02-28 15:36:26 +02:00
committed by GitHub
parent a94ec9946f
commit b878143b63

View File

@ -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.