Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25538] iOS: Original back button in iOS navigation bar shows briefly after replacing it with a custom one.

GitHub Issuen/a
TypeBug
PriorityNone
StatusResolved
ResolutionNot Our Bug
Resolution Date2017-11-20T11:33:03.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterJebun Naher
AssigneeHans Knöchel
Created2017-11-20T11:08:23.000+0000
Updated2017-11-29T23:41:31.000+0000

Description

*Issue Description:* When I add a custom back button using leftNavButton, the original iOS back button appears briefly before the custom one appears. I'm experiencing this behaviour using latest ti SDK 6.3.0.GA. *Steps to reproduce:* - Add a custom image in project directory and rename it to backbtn.png - Then run the sample code below - A red window should appear, click *Open blue window* button At this point, observe that the default iOS back button appears briefly before the custom one. *Expected:* The default iOS back button should not appear. *Actual:* The default iOS back button appears briefly before the custom back button appears. *Test Code:* *app.js*
var back_btn = Ti.UI.createView({
	backgroundImage: 'backbtn.png',
	width : 50,
	height : 20,
	left : '5'
});

var win2 = Titanium.UI.createWindow({
	backgroundColor : 'red',
	title : 'Red Window',

});

var win1 = Titanium.UI.iOS.createNavigationWindow({
	window : win2
});

var win3 = Titanium.UI.createWindow({
	backgroundColor : 'blue',
	title : 'Blue Window',
	leftNavButton : back_btn
});

var button = Titanium.UI.createButton({
	title : 'Open Blue Window'
});

button.addEventListener('click', function() {
	win1.openWindow(win3);

});

win2.add(button);

back_btn.addEventListener('click', function() {
	win3.close();
});

win1.open();

Attachments

FileDateSize
leftArrow@2x.png2017-11-20T11:33:18.000+00001821

Comments

  1. Hans Knöchel 2017-11-20

    You should use a Ti.UI.Button instance for left/right nav butttons to confirm to the iOS archtecture. I changed your code a bit and it now works perfectly (see the "leftArrow.png" attached as well):
       var back_btn = Ti.UI.createButton({
       	image: 'leftArrow.png',
       });
        
       var win2 = Titanium.UI.createWindow({
       	backgroundColor : 'red',
       	title : 'Red Window',
        
       });
        
       var win1 = Titanium.UI.iOS.createNavigationWindow({
       	window : win2
       });
        
       var win3 = Titanium.UI.createWindow({
       	backgroundColor : 'blue',
       	title : 'Blue Window',
       	leftNavButton : back_btn
       });
        
       var button = Titanium.UI.createButton({
       	title : 'Open Blue Window'
       });
        
       button.addEventListener('click', function() {
       	win1.openWindow(win3);
        
       });
        
       win2.add(button);
        
       back_btn.addEventListener('click', function() {
       	win3.close();
       });
        
       win1.open();
       
  2. Brenton House 2017-11-29

    I am seeing this with Appcelerator 6.3.0 and Titanium SDK 6.2.2 when navigating within an iOS TabGroup, even when I use Ti.UI.Button.

JSON Source