View

Type parameters

_Props: Record‹string, any›

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

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

Parameters:

NameTypeDefault

context

-

name

string

"View"

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:

NameTypeDefault

child

-

position

number

-1

Returns: void


destroy

destroy(): void

Returns: void


dispatchPointerEvent

dispatchPointerEvent(event: CanvasPointerEvent): boolean

Parameters:

NameType

event

Returns: boolean


draw

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

Parameters:

NameTypeDefault

canvas

-

force

boolean

false

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:

NameType

_canvas

Returns: number | undefined


getInternalWrappedWidth

getInternalWrappedWidth(_canvas: ViewCanvas): number | undefined

Parameters:

NameType

_canvas

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:

NameType

force?

undefined | false | true

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:

NameType

canvas

force?

undefined | false | true

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:

NameType

_canvas

Returns: void


onLayout

onLayout(): void

Returns: void


onMeasure

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

Parameters:

NameType

width

number

height

number

Returns: object

  • height: number

  • width: number


onPointerEvent

onPointerEvent(_event: CanvasPointerEvent): boolean

Parameters:

NameType

_event

Returns: boolean


onSizeChanged

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

Parameters:

NameType

_width

number

_height

number

_oldWidth

number

_oldHeight

number

Returns: void


onSnapshot

onSnapshot(): object

Returns: object


removeChild

removeChild(child: View | number): void

Parameters:

NameType

child

View | number

Returns: void


removeChildAt

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

Parameters:

NameTypeDefault

startIndex

number

-

endIndex

number

startIndex + 1

Returns: void


require

require(requiredChanges: RequiredViewChanges): void

Parameters:

NameType

requiredChanges

Returns: void


requireGuard

requireGuard(requiredChanges: RequiredViewChanges): boolean

Parameters:

NameType

requiredChanges

Returns: boolean


requireGuardAndTake

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

Parameters:

NameType

requiredChanges

force?

undefined | false | true

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:

NameType

backgroundColor

string | undefined

Returns: void


setBorder

setBorder(borderRect: RectLike | undefined): void

Parameters:

NameType

borderRect

RectLike | undefined

Returns: void


setBorderColor

setBorderColor(borderColor: string | undefined): void

Parameters:

NameType

borderColor

string | undefined

Returns: void


setChildAt

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

Parameters:

NameType

child

position

number

Returns: void


setId

setId(id?: undefined | string): void

Parameters:

NameType

id?

undefined | string

Returns: void


setLayoutParams

setLayoutParams(lp: LayoutParams): void

Parameters:

NameType

lp

Returns: void


setOnMount

setOnMount(callback: function): void

Parameters:

callback: function

▸ (view: View‹any›): void

Parameters:

NameType

view

View‹any›

Returns: void


setVisibility

setVisibility(visibility: Visibility): void

Parameters:

NameTypeDefault

visibility

Visibility.VISIBLE

Returns: void


snapshot

snapshot(): object

Returns: object

Last updated