UNPKG

3.68 kBTypeScriptView Raw
1import { View, AddChildFromBuilder } from '../core/view';
2import { FormattedString } from './formatted-string';
3import { Style } from '../styling/style';
4import { Length } from '../styling/style-properties';
5import { Property, CssProperty, InheritedCssProperty } from '../core/properties';
6import { CoreTypes } from '../../core-types';
7import { CSSShadow } from '../styling/css-shadow';
8
9export class TextBase extends View implements AddChildFromBuilder {
10 /**
11 * Gets of the text widget. In some cases(android TextInputLayout) the TextView is made of 2 views: the layout and the text view
12 * So we need a different getter for the layout and text functions
13 */
14 public readonly nativeTextViewProtected: any;
15
16 /**
17 * Gets or sets the text.
18 */
19 text: string;
20
21 /**
22 * Gets or sets a formatted string.
23 */
24 formattedText: FormattedString;
25
26 /**
27 * Gets or sets font-size style property.
28 */
29 fontSize: number;
30
31 /**
32 * Gets or sets letterSpace style property.
33 */
34 letterSpacing: number;
35
36 /**
37 * Gets or sets lineHeight style property.
38 */
39 lineHeight: number;
40
41 /**
42 * Gets or sets text-alignment style property.
43 */
44 textAlignment: CoreTypes.TextAlignmentType;
45
46 /**
47 * Gets or sets text decorations style property.
48 */
49 textDecoration: CoreTypes.TextDecorationType;
50
51 /**
52 * Gets or sets text transform style property.
53 */
54 textTransform: CoreTypes.TextTransformType;
55
56 /**
57 * Gets or sets text shadow style property.
58 */
59 textShadow: CSSShadow;
60
61 /**
62 * Gets or sets white space style property.
63 */
64 whiteSpace: CoreTypes.WhiteSpaceType;
65
66 /**
67 * Gets or sets white space style property.
68 */
69 maxLines: CoreTypes.MaxLinesType;
70
71 /**
72 * Gets or sets padding style property.
73 */
74 padding: string | CoreTypes.LengthType;
75
76 /**
77 * Specify the bottom padding of this layout.
78 */
79 paddingBottom: CoreTypes.LengthType;
80
81 /**
82 * Specify the left padding of this layout.
83 */
84 paddingLeft: CoreTypes.LengthType;
85
86 /**
87 * Specify the right padding of this layout.
88 */
89 paddingRight: CoreTypes.LengthType;
90
91 /**
92 * Specify the top padding of this layout.
93 */
94 paddingTop: CoreTypes.LengthType;
95
96 /**
97 * Called for every child element declared in xml.
98 * This method will add a child element (value) to current element.
99 * @private
100 * @param name - Name of the element.
101 * @param value - Value of the element.
102 */
103 _addChildFromBuilder(name: string, value: any): void;
104
105 //@private
106 /**
107 * Called when the text property is changed to request layout.
108 * @private
109 */
110 _requestLayoutOnTextChanged(): void;
111
112 /**
113 * @private
114 */
115 _setNativeText(reset?: boolean): void;
116
117 /**
118 * @private
119 */
120 _isSingleLine: boolean;
121 //@endprivate
122}
123
124export interface TextTransformation {
125 new (owner: TextBase): any /* android.text.method.TransformationMethod */;
126}
127
128export const textProperty: Property<TextBase, string>;
129export const formattedTextProperty: Property<TextBase, FormattedString>;
130
131export const maxLinesProperty: InheritedCssProperty<Style, number>;
132export const textAlignmentProperty: InheritedCssProperty<Style, CoreTypes.TextAlignmentType>;
133export const textDecorationProperty: CssProperty<Style, CoreTypes.TextDecorationType>;
134export const textTransformProperty: CssProperty<Style, CoreTypes.TextTransformType>;
135export const textShadowProperty: CssProperty<Style, CSSShadow>;
136export const whiteSpaceProperty: CssProperty<Style, CoreTypes.WhiteSpaceType>;
137export const letterSpacingProperty: CssProperty<Style, number>;
138export const lineHeightProperty: CssProperty<Style, number>;
139
140//Used by tab view
141export function getTransformedText(text: string, textTransform: CoreTypes.TextTransformType): string;
142
143export const resetSymbol: symbol;