titanium-sdk
titanium-sdk copied to clipboard
iOS: SearchBar in NavigationWindow not visible on creation
I have searched and made sure there are no existing issues for the issue I am filing
- [X] I have searched the existing issues
Description
The SearchBar of a TableView with showSearchBarInNavBar: true, is not visible until a scroll was fired
Expected Behavior
The SearchBar should be visible on creation
Actual behavior
The SearchBar is not visible on creation
https://user-images.githubusercontent.com/1126641/162887574-0a7d3b60-fda4-4440-932c-b01883e11cea.mov
Reproducible sample
var win = Ti.UI.createWindow({title: 'Appcelerator Titanium'});
var navigagtionWindow = Ti.UI.createNavigationWindow({
window: win
});
var search = Titanium.UI.createSearchBar({
height: 43
});
Ti.UI.backgroundColor = 'white';
var sectionFruit = Ti.UI.createTableViewSection({headerTitle: 'Fruit'});
sectionFruit.add(Ti.UI.createTableViewRow({title: 'Apples'}));
sectionFruit.add(Ti.UI.createTableViewRow({title: 'Bananas'}));
sectionFruit.add(Ti.UI.createTableViewRow({title: 'Mangos'}));
sectionFruit.add(Ti.UI.createTableViewRow({title: 'Ananas'}));
sectionFruit.add(Ti.UI.createTableViewRow({title: 'Peaches'}));
var sectionVeg = Ti.UI.createTableViewSection({headerTitle: 'Vegetables'});
sectionVeg.add(Ti.UI.createTableViewRow({title: 'Carrots'}));
sectionVeg.add(Ti.UI.createTableViewRow({title: 'Potatoes'}));
var sectionFish = Ti.UI.createTableViewSection({headerTitle: 'Fish'});
sectionFish.add(Ti.UI.createTableViewRow({title: 'Cod'}));
sectionFish.add(Ti.UI.createTableViewRow({title: 'Haddock'}));
var table = Ti.UI.createTableView({
id: 'tableView',
search: search,
dimBackgroundForSearch: true,
showSearchBarInNavBar: true,
data: [sectionFruit, sectionVeg, sectionFish]
});
win.add(table);
navigagtionWindow.open();
Steps to reproduce
Execute the example
Platform
iOS
SDK version you are using
10.1.1.GA
Alloy version you are using
none
That actually native behavior. I think there is a property to show it from the beginning, but this is the usual way right now.
That's strange. If I put that in a TabGroup, the Searchbar is already visible. But that's also an Alloy project. Could that be related?
https://user-images.githubusercontent.com/1126641/162897065-4fa661c0-a346-4628-ad6b-13d99df32e29.mov
Interesting. Tab groups handle windows differently internally (it's actually a view controller inside a navigation controller inside a tab bar controller). I really have to check that in more detail. On my list!