Search…
View

Type parameters

_Props: Record‹string, any›

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new View(context: Context, name: string): View
Parameters:
Name
Type
Default
context
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:
Name
Type
Default
child
View
-
position
number
-1
Returns: void

destroy

destroy(): void
Returns: void

dispatchPointerEvent

dispatchPointerEvent(event: CanvasPointerEvent): boolean
Parameters:
Name
Type
Returns: boolean

draw

draw(canvas: ViewCanvas, force: boolean): void
Parameters:
Name
Type
Default
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:
Name
Type
_canvas
Returns: number | undefined

getInternalWrappedWidth

getInternalWrappedWidth(_canvas: ViewCanvas): number | undefined
Parameters:
Name
Type
_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:
Name
Type
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:
Name
Type
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:
Name
Type
_canvas
Returns: void

onLayout

onLayout(): void
Returns: void

onMeasure

onMeasure(width: number, height: number): object
Parameters:
Name
Type
width
number
height
number
Returns: object
  • height: number
  • width: number

onPointerEvent

onPointerEvent(_event: CanvasPointerEvent): boolean
Parameters:
Name
Type
_event
Returns: boolean

onSizeChanged

onSizeChanged(_width: number, _height: number, _oldWidth: number, _oldHeight: number): void
Parameters:
Name
Type
_width
number
_height
number
_oldWidth
number
_oldHeight
number
Returns: void

onSnapshot

onSnapshot(): object
Returns: object

removeChild

removeChild(child: View | number): void
Parameters:
Name
Type
child
View | number
Returns: void

removeChildAt

removeChildAt(startIndex: number, endIndex: number): void
Parameters:
Name
Type
Default
startIndex
number
-
endIndex
number
startIndex + 1
Returns: void

require

require(requiredChanges: RequiredViewChanges): void
Parameters:
Name
Type
requiredChanges
Returns: void

requireGuard

requireGuard(requiredChanges: RequiredViewChanges): boolean
Parameters:
Name
Type
requiredChanges
Returns: boolean

requireGuardAndTake

requireGuardAndTake(requiredChanges: RequiredViewChanges, force?: undefined | false | true): boolean
Parameters:
Name
Type
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:
Name
Type
backgroundColor
string | undefined
Returns: void

setBorder

setBorder(borderRect: RectLike | undefined): void
Parameters:
Name
Type
borderRect
RectLike | undefined
Returns: void

setBorderColor

setBorderColor(borderColor: string | undefined): void
Parameters:
Name
Type
borderColor
string | undefined
Returns: void

setChildAt

setChildAt(child: View, position: number): void
Parameters:
Name
Type
child
View
position
number
Returns: void

setId

setId(id?: undefined | string): void
Parameters:
Name
Type
id?
undefined | string
Returns: void

setLayoutParams

setLayoutParams(lp: LayoutParams): void
Parameters:
Name
Type
lp
Returns: void

setOnMount

setOnMount(callback: function): void
Parameters:
callback: function
▸ (view: View‹any›): void
Parameters:
Name
Type
view
View‹any›
Returns: void

setVisibility

setVisibility(visibility: Visibility): void
Parameters:
Name
Type
Default
visibility
Visibility.VISIBLE
Returns: void

snapshot

snapshot(): object
Returns: object
Last modified 8mo ago
Export as PDF
Copy link
On this page
Type parameters
Hierarchy
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Properties
Protected Optional backgroundColor
Protected Optional borderColor
Protected Optional borderRect
Readonly context
Protected height
Optional id
Protected innerRect
Protected lp
Readonly name
offsetRect
Protected Optional onMount
Protected rect
Protected visibility
Protected width
Accessors
innerHeight
innerWidth
Methods
addChild
destroy
dispatchPointerEvent
draw
getBackgroundColor
getBorder
getBorderColor
getId
getInternalWrappedHeight
getInternalWrappedWidth
getLayoutParams
getMatchParentHeight
getMatchParentWidth
getOnMount
getParent
getRootView
getVisibility
hasParent
layout
measure
mount
onDestroy
onDraw
onLayout
onMeasure
onPointerEvent
onSizeChanged
onSnapshot
removeChild
removeChildAt
require
requireGuard
requireGuardAndTake
resolvePositionDependencies
screenshot
setBackgroundColor
setBorder
setBorderColor
setChildAt
setId
setLayoutParams
setOnMount
setVisibility
snapshot