UNPKG

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