tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.75k stars 1.21k forks source link

iOS: SearchBar in NavigationWindow not visible on creation #13388

Open caspahouzer opened 2 years ago

caspahouzer commented 2 years ago

I have searched and made sure there are no existing issues for the issue I am filing

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

hansemannn commented 2 years ago

That actually native behavior. I think there is a property to show it from the beginning, but this is the usual way right now.

caspahouzer commented 2 years ago

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

hansemannn commented 2 years ago

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!