Files
NativeScript/tests/app/ui/text-field/text-field-tests-native.ios.ts
Panayot Cankov 1236f66f44 Add npm script that generates ios .d.ts-es from the tests app
Less than 30 erros left, let's hope it still works

Added lib.*.d.ts from typescript, removed lib and dom stuff, added by hand XHR, alert etc. .d.ts-es for polyfills

Roll back some changes involved in separating UIEvent for dom and ios

Test combined dts-es will now use lib, while internally we will not to avoid UIEvent conflict with dom stuff
2016-08-29 09:58:17 +03:00

49 lines
1.7 KiB
TypeScript

import textFieldModule = require("ui/text-field");
import colorModule = require("color");
import utilsModule = require("utils/utils");
import enums = require("ui/enums");
export function getNativeText(textField: textFieldModule.TextField): string {
return textField.ios.text;
}
export function getNativeHint(textField: textFieldModule.TextField): string {
return textField.ios.placeholder;
}
export function getNativeSecure(textField: textFieldModule.TextField): boolean {
return textField.ios.secureTextEntry;
}
export function getNativeFontSize(textField: textFieldModule.TextField): number {
return textField.ios.font.pointSize;
}
export function getNativeColor(textField: textFieldModule.TextField): colorModule.Color {
return utilsModule.ios.getColor(textField.ios.textColor);
}
export function getNativeBackgroundColor(textField: textFieldModule.TextField): colorModule.Color {
return utilsModule.ios.getColor(textField.ios.backgroundColor);
}
export function getNativeTextAlignment(textField: textFieldModule.TextField): string {
switch (textField.ios.textAlignment) {
case NSTextAlignment.Left:
return enums.TextAlignment.left;
case NSTextAlignment.Center:
return enums.TextAlignment.center;
case NSTextAlignment.Right:
return enums.TextAlignment.right;
default:
return "unexpected value";
}
}
export function typeTextNatively(textField: textFieldModule.TextField, text: string): void {
textField.ios.text = text;
// Setting the text will not trigger the delegate method, so we have to do it by hand.
textField.ios.delegate.textFieldDidEndEditing(textField.ios);
}