tidev / titanium-sdk

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

Cannot click on tableview after closing window with focus on SearchBar on NavigationWindow #13070

Closed trkas closed 3 years ago

trkas commented 3 years ago

Describe the bug

If you have a NavigationWindow with e.g. 2 windows. Window 1 has a tableView with rows. Click on a row and window 2 is shown with a tableView with rows and a SearchBar. You click on SearchBar so background is dimmed and SearchBar gets focus and then click on the back button. The window 1 is shown but you cannot interact with the table on window 1 anymore. It's a critical bug for us so I hope you can fix it as soon as possible :o).

It's started to break from SDK 10.0.1. It works on 10.0.0

To Reproduce

Just run the following code, and you get the error as described above:

var win2 = Titanium.UI.createWindow({ title : 'window 1' });

var table = Ti.UI.createTableView({ width : '100%', });

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

var row = Ti.UI.createTableViewRow({ title : 'test' }); row.addEventListener('click', function(e) { Ti.API.info('click!'); showNextWindow(); });

var tableData = [];

tableData.push(row);

table.data = tableData;

win1.open();

function showNextWindow() { var win3 = Ti.UI.createWindow({ title : 'window 2' }); var search = Titanium.UI.createSearchBar(); var table2 = Ti.UI.createTableView({ search : search }); win3.add(table2); var row = Ti.UI.createTableViewRow({ title : 'test2', }); var tableData = []; tableData.push(row); table2.data = tableData; win1.openWindow(win3);

}

Expected behavior

After clicking on back button on window 2 after following the description as mentioned above, I expect to be able to interact with the tableView on window 1

Environment

Titanium SDK version: 10.0.1 CLI version: 9.0.1 Simulator Screen Shot - iPhone 12 - 2021-09-16 at 09 33 39 Simulator Screen Shot - iPhone 12 - 2021-09-16 at 09 33 52 Simulator Screen Shot - iPhone 12 - 2021-09-16 at 09 34 02 trace.pdf

Logs

attached trace.pdf

(Attach by dragging into this issue)

m1ga commented 3 years ago

If it started with 10.0.1 it might be a regression of https://github.com/appcelerator/titanium_mobile/pull/12906 which had a backport to 10.0.1. Not sure if there is a workaround by bluring the searchbar before closing the window?

m1ga commented 3 years ago

@trkas you can edit the file locally iphone/Classes/TiUITableView.m (inside your mobilesdk/ folder) and switch back to the old version: https://github.com/appcelerator/titanium_mobile/pull/12906/files#diff-091b65382eb52bdd5bea8e4e965d65b6e044cac879d9e10104ac7a68e18868a8

trkas commented 3 years ago

@m1ga ok. it seems to work if I replace the TiUITableView.m from 10.0.2 to TiUITableView.m from 10.0.0 in the mobilesdk folder. It would not break anything else?

I have tried to call blur() on SearchBar when window is closed, but that doesn't seem to work.

m1ga commented 3 years ago

that was the only change I saw. Also made a not in the original ticket https://jira.appcelerator.org/browse/TIMOB-28492

garymathews commented 3 years ago

Thanks for reporting this, you can follow the ticket and PR here:

https://jira.appcelerator.org/browse/TIMOB-28536 https://github.com/appcelerator/titanium_mobile/pull/13072

ewanharris commented 3 years ago

This shipped in 10.1.0.GA, thanks for the report @trkas!