mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(core): nativescript.config and webpack updates (#8801)
This commit is contained in:
27
apps/automated/src/ui/label/label-tests-native.ios.ts
Normal file
27
apps/automated/src/ui/label/label-tests-native.ios.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as labelModule from '@nativescript/core/ui/label';
|
||||
import * as enums from '@nativescript/core/ui/enums';
|
||||
import * as colorModule from '@nativescript/core/color';
|
||||
import { getColor } from '../../ui-helper';
|
||||
|
||||
export function getNativeTextAlignment(label: labelModule.Label): string {
|
||||
switch (label.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 getNativeBackgroundColor(label: labelModule.Label): colorModule.Color {
|
||||
var layer = (<UILabel>label.ios).layer;
|
||||
if (!layer || !layer.backgroundColor) {
|
||||
return undefined;
|
||||
}
|
||||
var uiColor = UIColor.colorWithCGColor(layer.backgroundColor);
|
||||
|
||||
return getColor(uiColor);
|
||||
}
|
||||
Reference in New Issue
Block a user