Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5664] iOS: SearchBar inside ListView barColor and backgroundColor not working

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionDuplicate
Resolution Date2018-03-18T16:11:42.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labels7.1.0.GA, barColor, ios-11, searchBar
ReporterFlavio Bontà
AssigneeShak Hossain
Created2018-03-18T09:43:34.000+0000
Updated2018-03-19T04:04:06.000+0000

Description

Hi, I have created a simple navigationWindow in Alloy. Inside the window I have a listView with a searchBar. SearchBar barColor and backgroundColor do not make changes.
<Alloy>
	<NavigationWindow id="index" platform="ios">
		<Window id="main">
		</Window>
	</NavigationWindow>
</Alloy>
"#main": {
	title: "test",
	largeTitleEnabled: true
}
var counter = 0;

function genData() {
	var data = [];
	var i = 1;
	for (i = 1; i <= 3; i++) {
		data.push({ properties: { title: 'ROW ' + (counter + i) } })
	}
	counter += 3;
	return data;
}
var search = Titanium.UI.createSearchBar({
    barColor:'red', 
    backgroungColor: 'green',
    showCancel:true,
    top:0,
});

var section = Ti.UI.createListSection();
section.setHeaderTitle("title");
section.setItems(genData());

var control = Ti.UI.createRefreshControl({
	tintColor: 'red'
})

var listView = Ti.UI.createListView({
	sections: [section],
	refreshControl: control,
        searchView: search
});

control.addEventListener('refreshstart', function(e) {
	Ti.API.info('refreshstart');
	setTimeout(function() {
		Ti.API.debug('Timeout');
		section.appendItems(genData());
		control.endRefreshing();
	}, 100); //if setTimeout is about 1s the problem not occurs
})

$.main.add(listView);
$.index.open();

Attachments

FileDateSize
Simulator Screen Shot - iPhone 8 - 2018-03-18 at 10.40.42.png2018-03-18T09:41:00.000+000030960

Comments

  1. Hans Knöchel 2018-03-18

    Hey there! This should be fixed by TIMOB-25850 (cc [~vijaysingh]) and [this pull request](https://github.com/appcelerator/titanium_mobile/pull/9932) that you can use to patch your SDK today. I will resolve the ticket to indicate its relation, thank you for reporting this!
  2. Vijay Singh 2018-03-19

    Hans is correct, it will be fixed in above ticket. Simple workaround is - Set searchBar property after creating list view. e.g.
       var listView = Ti.UI.createListView({
       	sections: [section],
       	refreshControl: control,
               searchView: search
       });
       
       searchView.setBarColor('red');
       searchView.setBackgroungColor('green');
       
    Thanks!

JSON Source