Skip to content

Fixed: SearchBar.textFieldHintColor not respected on iOS #1807

Closed

Description

@NordlingDev

As stated in the title, the textFieldHintColor property of SearchBar does not work when it's inside the ActionBar (tested in ActionBar.titleView). If I move the SearchBar outside the ActionBar tag, it works.

Tested on iOS only. As seen in the screenshot, the text color is gray, but should be white:

image

<Page.actionBar>
  <ActionBar title="{{ language.matches_title }}">
    <ActionBar.titleView>

      <AbsoluteLayout row="0" id="searchBar-container">
        <SearchBar top="0" id="searchBar" hint="{{ language.searchMatches }}" textFieldHintColor="#ffffff" textFieldBackgroundColor="#48af7a" width="{{ searchBarWidth }}" />
        <StackLayout top="0" class="border" width="{{ searchBarWidth }}" />
        <StackLayout top="43" class="border" width="{{ searchBarWidth }}" />
      </AbsoluteLayout>

    </ActionBar.titleView>
  </ActionBar>
</Page.actionBar>

Activity

  1. self-assigned this
    on Mar 23, 2016
  2. tsonevn commented on Mar 24, 2016

    @tsonevn
    Contributor

    Hi @NordlingArt,

    Unfortunatly, I found that textFieldHintColor is not supported for ios apps
    The code behind SearchBar textFieldHintColor property was create by @NathanaelA.
    He can give further information on this issue.

  3. tsonevn commented on Apr 27, 2016

    @tsonevn
    Contributor

    Hi @NordlingArt ,
    I apologize for the delay in replying. I made a little research and found that you can change textFieldHintColor manually in iOS by changing UILabel textColor property.
    I am attaching an example, how you can do this:

    main-page.xml

    <Page navigatingTo="navigatingTo">
      <Page.actionBar>
        <ActionBar title="{{ language.matches_title }}">
          <ActionBar.titleView>
            <AbsoluteLayout row="0" id="searchBar-container">
              <SearchBar top="0" id="search" hint="test" textFieldHintColor="white" textFieldBackgroundColor="#48af7a" width="300" loaded="load"/>
          </AbsoluteLayout>
          </ActionBar.titleView>
        </ActionBar>
      </Page.actionBar>
    </Page>
    

    main-page.ts

    import { EventData } from "data/observable"; 
    import { Page } from "ui/page"; 
    import {SearchBar} from "ui/search-bar"; 
    import {Color} from "color"; 
    import {Label} from "ui/label"; 
    
    export function navigatingTo(args: EventData){
    
      var page:Page = <Page> args.object;
      if(page.ios){
        var search:SearchBar = <SearchBar> page.getViewById("search");
        var searchField = search.ios.valueForKey("searchField");
        var label = searchField.valueForKey("placeholderLabel");
        label.textColor = UIColor.yellowColor();
      }
    }
    
    

    I hope this is applicable for you.

  4. NordlingDev commented on Apr 27, 2016

    @NordlingDev
    Author

    Hi @tsonevn,

    No worries. I'll take a look at this. Thanks for hitting back to it!

  5. added this to the 2.1 milestone on Jun 14, 2016
  6. changed the title [-]SearchBar textFieldHintColor not working inside ActionBar.titleView[/-] [+]Fixed: SearchBar.textFieldHintColor not respected on iOS[/+] on Jun 14, 2016
  7. added a commit that references this issue on Jun 14, 2016
    173620b
  8. added 2 commits that reference this issue on Jun 17, 2016
    56cdf41
    aece985
  9. lock commented on Aug 29, 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.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions