1
+ import { VerticalTextAlignment , verticalTextAlignmentProperty } from '@nativescript-community/text' ;
1
2
import { themer } from '@nativescript-community/ui-material-core' ;
2
3
import {
3
4
buttonColorProperty ,
@@ -12,26 +13,23 @@ import {
12
13
helperProperty ,
13
14
strokeColorProperty ,
14
15
strokeDisabledColorProperty ,
15
- strokeInactiveColorProperty ,
16
+ strokeInactiveColorProperty
16
17
} from '@nativescript-community/ui-material-core/textbase/cssproperties' ;
17
18
import {
18
19
Background ,
19
20
Color ,
20
21
Font ,
21
- Property ,
22
- Screen ,
23
22
Style ,
24
23
Utils ,
25
24
_updateCharactersInRangeReplacementString ,
26
25
backgroundInternalProperty ,
27
26
editableProperty ,
28
27
fontInternalProperty ,
29
- isAndroid ,
30
28
paddingBottomProperty ,
31
29
paddingLeftProperty ,
32
30
paddingRightProperty ,
33
31
paddingTopProperty ,
34
- placeholderColorProperty ,
32
+ placeholderColorProperty
35
33
} from '@nativescript/core' ;
36
34
import { textProperty } from '@nativescript/core/ui/text-base' ;
37
35
import { TextFieldBase } from './textfield.common' ;
@@ -180,7 +178,6 @@ export class TextField extends TextFieldBase {
180
178
181
179
_getTextInsetsForBounds ( insets : UIEdgeInsets ) : UIEdgeInsets {
182
180
const style = this . style ;
183
-
184
181
if ( this . variant === 'underline' && this . _controller . underlineHeightNormal === 0 ) {
185
182
// if no underline/custom background, remove all insets like on android
186
183
insets . top = 0 ;
@@ -358,4 +355,24 @@ export class TextField extends TextFieldBase {
358
355
const font = value instanceof Font ? value . getUIFont ( this . _controller . inlinePlaceholderFont ) : value ;
359
356
this . _controller . inlinePlaceholderFont = font ;
360
357
}
358
+
359
+ [ verticalTextAlignmentProperty . setNative ] ( value : VerticalTextAlignment ) {
360
+ // TODO: not working for now
361
+ const view = this . nativeTextViewProtected ;
362
+ view . backgroundColor = UIColor . redColor ;
363
+ switch ( value ) {
364
+ case 'initial' :
365
+ case 'top' :
366
+ view . contentVerticalAlignment = UIControlContentVerticalAlignment . Top ;
367
+ break ;
368
+ case 'middle' :
369
+ view . contentVerticalAlignment = UIControlContentVerticalAlignment . Center ;
370
+
371
+ break ;
372
+
373
+ case 'bottom' :
374
+ view . contentVerticalAlignment = UIControlContentVerticalAlignment . Bottom ;
375
+ break ;
376
+ }
377
+ }
361
378
}
0 commit comments