fix(ios): searcbar hint color before hint property (#6902)

This commit is contained in:
Martin Yankov
2019-02-14 16:21:19 +02:00
committed by GitHub
parent 0416f7e80e
commit 5dd01a3cb9
3 changed files with 31 additions and 25 deletions

View File

@@ -3,7 +3,12 @@ import { Color } from "tns-core-modules/color";
import { getColor } from "../helper";
export function getNativeHintColor(searchBar: SearchBar): Color {
return (<any>searchBar)._placeholderLabel ? getColor((<any>searchBar)._placeholderLabel.textColor) : undefined;
if ((<any>searchBar)._textField) {
const placeholder = (<any>searchBar)._textField.valueForKey("placeholderLabel");
return getColor(placeholder.textColor);
}
return undefined;
}
export function getNativeTextFieldBackgroundColor(searchBar: SearchBar): Color {

View File

@@ -92,6 +92,9 @@ export var testSearchBarPropertiesWithCSS = function () {
helper.buildUIAndRunTest(_createSearchBarFunc(), function (views: Array<viewModule.View>) {
var searchBar = <searchBarModule.SearchBar>views[0];
searchBar.text = "";
searchBar.hint = "hint css test";
const expectedHintColor = "#0000FF"; // blue
const expectedTextFieldBackgroundColor = "#FF0000"; // red
const expectedFontSize = 30;
@@ -105,8 +108,6 @@ export var testSearchBarPropertiesWithCSS = function () {
TKUnit.assertAreClose(expectedFontSize, fontSizeActualValue, 0.2, "Font Size - Actual: " + fontSizeActualValue + "; Expected: " + expectedFontSize);
}, { pageCss: `
SearchBar {
text: test;
hint: test;
text-field-hint-color: blue;
text-field-background-color: red;
font-size: 30;