[TIMOB-28492] iOS: SearchBar blur function not working on iOS
| GitHub Issue | n/a |
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-06-23T16:09:26.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 10.0.1 |
| Components | iOS |
| Labels | blur, ios, searchBar |
| Reporter | Gustavo Velez |
| Assignee | Gary Mathews |
| Created | 2021-06-11T00:00:23.000+0000 |
| Updated | 2021-09-16T10:19:57.000+0000 |
Description
I have a view with three TableViews controlled by a custom tabs. Each TableView has a SearchBar instantiated in Alloy. When I search between the tabs, I call the blur() function on each SearchBar. However, I notice that the SearchBar does not lose focus. As a result, if I enter text in say SearchBar #1, then switch to Search #2, the search functionality breaks and will not work.
However, if I go back to Search #1 and press Cancel, and then back to Search #2 that is shown when I press on the second tab, I am then able to successfully search.
Attachments
*TEST CASE* 1. Enter text into _Search A_ 2. Click _Toggle List_ 3. Enter text into _Search B_, list *should* update but does not
const win = Titanium.UI.createWindow({ layout: 'vertical' }); const toggle = Ti.UI.createButton({ top: 80, title: 'Toggle List' }); const search_a = Ti.UI.createSearchBar({ hintText: 'Search A' }); const search_b = Ti.UI.createSearchBar({ hintText: 'Search B' }); const tableView_a = Ti.UI.createTableView({ data: [createSection(5, 'A')], search: search_a, height: '40%' }); const tableView_b = Ti.UI.createTableView({ data: [createSection(5, 'B')], search: search_b, height: '40%', visible: false }); toggle.addEventListener('click', e => { tableView_a.visible = tableView_b.visible; tableView_b.visible = !tableView_b.visible; if (!tableView_a.visible) { search_a.blur(); } if (!tableView_b.visible) { search_b.blur(); } }); win.add([toggle, tableView_a, tableView_b]); win.open(); function createSection(rows, suffix) { const section = Ti.UI.createTableViewSection({ headerTitle: "Section ".concat(suffix) }); for (let i = 1; i <= rows; i++) { section.add(Ti.UI.createTableViewRow({ title: "Row #".concat(i) })); } return section; }master: https://github.com/appcelerator/titanium_mobile/pull/12906
merged to master and 10_0_X
Might have introduced an issue here: https://github.com/appcelerator/titanium_mobile/issues/13070 If I revert the changes it works for me again