Skip to content

SearchBar is not displayed - Android API 24  #4272

Closed

Description

@ADjenkov

<SearchBar> Is not showing at all on Android >= 7.0 . I've tested on Emulator with 7.0 API 24, 7.1.1 API 25 and on a device with 7.0. I'll log an issue, but I'm writing you here because I'm pretty sure that this problem was occuring on my phone some months ago with {N} 2.5 + Android 7.0 .

Working as expected on lower Android versions.
PS: Testing with SearchBar inside the page not in the ActionBar

Activity

  1. NickIliev commented on May 29, 2017

    @NickIliev
    Contributor

    @ADjenkov please share the code that you are using for the XML page.

    I have tested the SearchBar in both API25 and API24 and it works as expected on my side. Here is the used test application.

    screen shot 2017-05-29 at 9 35 20 am

  2. ADjenkov commented on May 29, 2017

    @ADjenkov
    ContributorAuthor

    @NickIliev After some more testing I've noticed that the control does not init with default sizes. What I mean is that if the control is inside layout with auto size for example:

    <GridLayout rows="auto, *"> <SearchBar row="0" id="searchBar" hint="Search" text="" clear="onClear"></SearchBar> <Label row="1" text="Test"></Label> </GridLayout>

    The SearchBar is not displayed (it's hidden with height=0 I guess) -> only the Label is visible. If i change the grid to <GridLayout rows="*, *"> or hardcode a height=50 on the SearchBar then it is visible.
    Sorry for the initial misleading info, but I think that this is a problem too because the SearchBar control is behaving differently from the other controls

  3. NickIliev commented on May 29, 2017

    @NickIliev
    Contributor

    @ADjenkov you are right - some of the controls like ListView needs to be initialized with size or the parents in which they are nested needs to have a size so they can be rendered as expected. These limitations are coming from the native design of the controls that lies behind ListView.

    However, this should not be the case for SearchBar - I have modified my application using your snippet you provided and the SearchBar is still visible for iOS (10.2) and Android (API25).

  4. ADjenkov commented on May 29, 2017

    @ADjenkov
    ContributorAuthor

    @NickIliev I've just tested again. It is ok on Android 6.0 API 23, but not visible in Android 7.0 API 24

    image

    Here is an app search-bar-test-tsc.zip

    Also tested on device.

  5. NickIliev commented on May 29, 2017

    @NickIliev
    Contributor

    @ADjenkov I can confirm that indeed the SearchBar is not showing on API-24 if some size is not explicitly set (either for its container or for the SearchBar itself). Working as expected on API25 and all API levels before API23 We will need some additional time to investigate if this is not a specific behavior of android.wdiget.SearchView for API-24 and will post the info here.

    App demonstrating the issue (only on API 24) here. (works w/ API == 25 && API <= 23)

    As a temporary workaround you can set only the height of your SearchBar for Android API 24
    e.g.
    XML

    <SearchBar row="0" loaded="onSearchBarLoaded" />
    

    code behind

    export function onSearchBarLoaded(args: EventData) {
        let searchBar = <SearchBar>args.object;
    
        if (androidApp && (android.os.Build.VERSION.SDK_INT == 24))) {
            searchBar.height = 50;
        }
    }
    
  6. changed the title [-]SearchBar is not displayed on Android >= 7.0[/-] [+]SearchBar is not displayed - Android API 24 (works w/ API == 25 && API <= 23)[/+] on May 29, 2017
  7. ADjenkov commented on May 29, 2017

    @ADjenkov
    ContributorAuthor

    Yes, I've already hardcoded id for my scenario.

    Тhanks for your time!

  8. changed the title [-]SearchBar is not displayed - Android API 24 (works w/ API == 25 && API <= 23)[/-] [+]SearchBar is not displayed - Android API 24 [/+] on May 29, 2017
  9. added this to the 3.1 milestone on May 30, 2017
  10. ADjenkov commented on May 30, 2017

    @ADjenkov
    ContributorAuthor

    Btw , on my phone Sony Xperia Compact with Android 7.0.0 I'm not able to display it with even when I'm setting hardcoded sizes (height="50") (Tested on another 7.1.2 Nexus device and it works)

  11. self-assigned this
    on Jun 13, 2017
  12. added
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    and removed on Jun 14, 2017
  13. SvetoslavTsenov commented on Jun 14, 2017

    @SvetoslavTsenov
    Contributor

    The fix is already available in tns-core-modules@next and will also be released with tns-core-modules@3.1.0

  14. added and removed
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Jun 14, 2017
  15. removed their assignment
    on Jun 14, 2017
  16. lock commented on Aug 28, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  17. locked and limited conversation to collaborators on Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions