View

Type parameters

_Props: Record‹string, any›

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new View(context: Context, name: string): View

Parameters:

Returns: View

Properties

Protected Optional backgroundColor

backgroundColor? : undefined | string


Protected Optional borderColor

borderColor? : undefined | string


Protected Optional borderRect

borderRect? : Rect


Readonly context

context: Context


Protected height

height: number = 0


Optional id

id? : undefined | number


Protected innerRect

innerRect: Rect = new Rect(0)

This are the bounds of view including padding.


Protected lp

lp: LayoutParams = new LayoutParams()


Readonly name

name: string


offsetRect

offsetRect: Rect = new Rect(0)

This are the bounds of view absolute offset.


Protected Optional onMount

onMount? : undefined | function


Protected rect

rect: Rect = new Rect(0)

This are bounds of a view including margin and padding


Protected visibility

visibility: Visibility = Visibility.VISIBLE


Protected width

width: number = 0

Accessors

innerHeight

get innerHeight(): number

Returns: number


innerWidth

get innerWidth(): number

Returns: number

Methods

addChild

addChild(child: View, position: number): void

Parameters:

Returns: void


destroy

destroy(): void

Returns: void


dispatchPointerEvent

dispatchPointerEvent(event: CanvasPointerEvent): boolean

Parameters:

Returns: boolean


draw

draw(canvas: ViewCanvas, force: boolean): void

Parameters:

Returns: void


getBackgroundColor

getBackgroundColor(): undefined | string

Returns: undefined | string


getBorder

getBorder(): undefined | string

Returns: undefined | string


getBorderColor

getBorderColor(): undefined | string

Returns: undefined | string


getId

getId(): undefined | string | number

Returns: undefined | string | number


getInternalWrappedHeight

getInternalWrappedHeight(_canvas: ViewCanvas): number | undefined

Parameters:

Returns: number | undefined


getInternalWrappedWidth

getInternalWrappedWidth(_canvas: ViewCanvas): number | undefined

Parameters:

Returns: number | undefined


getLayoutParams

getLayoutParams(): LayoutParams‹›

Returns: LayoutParams‹›


getMatchParentHeight

getMatchParentHeight(): number

Returns: number


getMatchParentWidth

getMatchParentWidth(): number

Returns: number


getOnMount

getOnMount(): undefined | function

Returns: undefined | function


getParent

getParent(): null | ViewViewProps

Returns: null | ViewViewProps


getRootView

getRootView(): ViewViewProps

Returns: ViewViewProps


getVisibility

getVisibility(): Visibility

Returns: Visibility


hasParent

hasParent(): boolean

Returns: boolean


layout

layout(force?: undefined | false | true): void

Prepares the layout for all children

Parameters:

Returns: void


measure

measure(canvas: ViewCanvas, force?: undefined | false | true): void

Measures the component and adjusts it's dimensions to min/max width and height values.

Parameters:

Returns: void

true if width or height changed, false otherwise


mount

mount(): void

Returns: void


onDestroy

onDestroy(): void

Returns: void


onDraw

onDraw(_canvas: ViewCanvas): void

Parameters:

Returns: void


onLayout

onLayout(): void

Returns: void


onMeasure

onMeasure(width: number, height: number): object

Parameters:

Returns: object

  • height: number

  • width: number


onPointerEvent

onPointerEvent(_event: CanvasPointerEvent): boolean

Parameters:

Returns: boolean


onSizeChanged

onSizeChanged(_width: number, _height: number, _oldWidth: number, _oldHeight: number): void

Parameters:

Returns: void


onSnapshot

onSnapshot(): object

Returns: object


removeChild

removeChild(child: View | number): void

Parameters:

Returns: void


removeChildAt

removeChildAt(startIndex: number, endIndex: number): void

Parameters:

Returns: void


require

require(requiredChanges: RequiredViewChanges): void

Parameters:

Returns: void


requireGuard

requireGuard(requiredChanges: RequiredViewChanges): boolean

Parameters:

Returns: boolean


requireGuardAndTake

requireGuardAndTake(requiredChanges: RequiredViewChanges, force?: undefined | false | true): boolean

Parameters:

Returns: boolean


resolvePositionDependencies

resolvePositionDependencies(): void

Prepare arrays of children ordered horizontally and vertically, so that they could be measured in a single pass, without waiting for their dependencies to be resolved.

This has to be called before measure whenever child's layoutParams change or views are added/removed.

throws an error in case of unresolvable dependency (circular or lack of required view)

Returns: void


screenshot

screenshot(): string | undefined

Returns: string | undefined


setBackgroundColor

setBackgroundColor(backgroundColor: string | undefined): void

Parameters:

Returns: void


setBorder

setBorder(borderRect: RectLike | undefined): void

Parameters:

Returns: void


setBorderColor

setBorderColor(borderColor: string | undefined): void

Parameters:

Returns: void


setChildAt

setChildAt(child: View, position: number): void

Parameters:

Returns: void


setId

setId(id?: undefined | string): void

Parameters:

Returns: void


setLayoutParams

setLayoutParams(lp: LayoutParams): void

Parameters:

Returns: void


setOnMount

setOnMount(callback: function): void

Parameters:

callback: function

▸ (view: View‹any›): void

Parameters:

Returns: void


setVisibility

setVisibility(visibility: Visibility): void

Parameters:

Returns: void


snapshot

snapshot(): object

Returns: object

Last updated