Files
Alexander Vakrilov 23757e5dfc Enable recycling of nativeView 2 (#4467)
* enable recycling of nativeView

* backgroundInternal is reset if setting new value leads to background.isEmpty() == true.

* android background.getDefault always return copy of the background. Now all controls that mutate the background can be reset to initial state (e.g. Button & ActionBar)
passing resources to copied background so it respect density.
fix properties initNativeView

* reset padding when backgroundInternal is reset.

* Fix text reset
Fix padding reset

* fix tsc errors

* fix ugly text rendering.

* Add unit tests for recycling native views
Fix several issues that came from the above tests
Fix maxLength property missing a converter callback
Remove old files

* Remove old files

* Revert backgroundInternal setter

* change the order of tests so that appium can work again

* Remove suggestion on every TextView & TextField init (strangely it is enabled after view is recycled....)

* Fix function to get parent layout if specified

* Button stateListAnimator restored when button is recycled
zIndex defaultValue is now undefined instead of NaN

* revert zIndex.setNative to always clear stateListAnimator because it was breaking one UI test (setting value=0 was returning the previous stateListAnimator)

* fix search-bar backgound-color recycling

* Fix alignments setters

* Fix imageView recycling
Fix button recycling
Fix edit-text recycling
resetNativeView is called only if recycleNativeView flag is true

* Fix incorrect merge

* Fix text-view & text-field textTransform

* Fix EditText text reset

* Fix runtime crash on ARM emulator API 21

* Fix text-base minHeight. maxHeight reset
Fix reset of isUserInteractionEnabled
2017-06-29 18:01:22 +03:00

121 lines
3.0 KiB
TypeScript

/**
* @module "ui/text-base"
*/ /** */
import { View, AddChildFromBuilder, Property, CssProperty, InheritedCssProperty, Style, Length } from "../core/view";
import { FormattedString } from "../../text/formatted-string";
export * from "../core/view";
export { FormattedString } from "../../text/formatted-string";
export class TextBase extends View implements AddChildFromBuilder {
/**
* Gets or sets the text.
*/
text: string;
/**
* Gets or sets a formatted string.
*/
formattedText: FormattedString;
/**
* Gets or sets font-size style property.
*/
fontSize: number;
/**
* Gets or sets letterSpace style property.
*/
letterSpacing: number;
/**
* Gets or sets text-alignment style property.
*/
textAlignment: TextAlignment;
/**
* Gets or sets text decorations style property.
*/
textDecoration: TextDecoration;
/**
* Gets or sets text transform style property.
*/
textTransform: TextTransform;
/**
* Gets or sets white space style property.
*/
whiteSpace: WhiteSpace;
/**
* Gets or sets padding style property.
*/
padding: string | Length;
/**
* Specify the bottom padding of this layout.
*/
paddingBottom: Length;
/**
* Specify the left padding of this layout.
*/
paddingLeft: Length;
/**
* Specify the right padding of this layout.
*/
paddingRight: Length;
/**
* Specify the top padding of this layout.
*/
paddingTop: Length;
/**
* Called for every child element declared in xml.
* This method will add a child element (value) to current element.
* @private
* @param name - Name of the element.
* @param value - Value of the element.
*/
_addChildFromBuilder(name: string, value: any): void;
//@private
/**
* Called when the text property is changed to request layout.
* @private
*/
_requestLayoutOnTextChanged(): void;
/**
* @private
*/
_setNativeText(reset?: boolean): void;
/**
* @private
*/
_isSingleLine: boolean;
//@endprivate
}
export const textProperty: Property<TextBase, string>;
export const formattedTextProperty: Property<TextBase, FormattedString>;
export type WhiteSpace = "initial" | "normal" | "nowrap";
export type TextAlignment = "initial" | "left" | "center" | "right";
export type TextTransform = "initial" | "none" | "capitalize" | "uppercase" | "lowercase";
export type TextDecoration = "none" | "underline" | "line-through" | "underline line-through";
export const textAlignmentProperty: InheritedCssProperty<Style, TextAlignment>;
export const textDecorationProperty: CssProperty<Style, TextDecoration>;
export const textTransformProperty: CssProperty<Style, TextTransform>;
export const whiteSpaceProperty: CssProperty<Style, WhiteSpace>;
export const letterSpacingProperty: CssProperty<Style, number>;
//Used by tab view
export function getTransformedText(text: string, textTransform: TextTransform): string;