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 |
---|---|---|
| - | |
| string | "View" |
Returns: View
Properties
Protected
Optional
backgroundColor
Protected
Optional
backgroundColor• backgroundColor? : undefined | string
Protected
Optional
borderColor
Protected
Optional
borderColor• borderColor? : undefined | string
Protected
Optional
borderRect
Protected
Optional
borderRect• borderRect? : Rect
Readonly
context
Readonly
context• context: Context
Protected
height
Protected
height• height: number = 0
Optional
id
Optional
id• id? : undefined | number
Protected
innerRect
Protected
innerRect• innerRect: Rect = new Rect(0)
This are the bounds of view including padding.
Protected
lp
Protected
lp• lp: LayoutParams = new LayoutParams()
Readonly
name
Readonly
name• name: string
offsetRect
• offsetRect: Rect = new Rect(0)
This are the bounds of view absolute offset.
Protected
Optional
onMount
Protected
Optional
onMount• onMount? : undefined | function
Protected
rect
Protected
rect• rect: Rect = new Rect(0)
This are bounds of a view including margin and padding
Protected
visibility
Protected
visibility• visibility: Visibility = Visibility.VISIBLE
Protected
width
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 |
---|---|---|
| - | |
| 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 |
---|---|---|
| - | |
| 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 |
---|---|
|
Returns: number | undefined
getInternalWrappedWidth
▸ getInternalWrappedWidth(_canvas
: ViewCanvas): number | undefined
Parameters:
Name | Type |
---|---|
|
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 | View‹ViewProps›
Returns: null | View‹ViewProps›
getRootView
▸ getRootView(): View‹ViewProps›
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 |
---|---|
| 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 |
---|---|
| |
| 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 |
---|---|
|
Returns: void
onLayout
▸ onLayout(): void
Returns: void
onMeasure
▸ onMeasure(width
: number, height
: number): object
Parameters:
Name | Type |
---|---|
| number |
| number |
Returns: object
height: number
width: number
onPointerEvent
▸ onPointerEvent(_event
: CanvasPointerEvent): boolean
Parameters:
Name | Type |
---|---|
|
Returns: boolean
onSizeChanged
▸ onSizeChanged(_width
: number, _height
: number, _oldWidth
: number, _oldHeight
: number): void
Parameters:
Name | Type |
---|---|
| number |
| number |
| number |
| number |
Returns: void
onSnapshot
▸ onSnapshot(): object
Returns: object
removeChild
▸ removeChild(child
: View | number): void
Parameters:
Name | Type |
---|---|
| View | number |
Returns: void
removeChildAt
▸ removeChildAt(startIndex
: number, endIndex
: number): void
Parameters:
Name | Type | Default |
---|---|---|
| number | - |
| number | startIndex + 1 |
Returns: void
require
▸ require(requiredChanges
: RequiredViewChanges): void
Parameters:
Name | Type |
---|---|
|
Returns: void
requireGuard
▸ requireGuard(requiredChanges
: RequiredViewChanges): boolean
Parameters:
Name | Type |
---|---|
|
Returns: boolean
requireGuardAndTake
▸ requireGuardAndTake(requiredChanges
: RequiredViewChanges, force?
: undefined | false | true): boolean
Parameters:
Name | Type |
---|---|
| |
| 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 |
---|---|
| string | undefined |
Returns: void
setBorder
▸ setBorder(borderRect
: RectLike | undefined): void
Parameters:
Name | Type |
---|---|
| RectLike | undefined |
Returns: void
setBorderColor
▸ setBorderColor(borderColor
: string | undefined): void
Parameters:
Name | Type |
---|---|
| string | undefined |
Returns: void
setChildAt
▸ setChildAt(child
: View, position
: number): void
Parameters:
Name | Type |
---|---|
| |
| number |
Returns: void
setId
▸ setId(id?
: undefined | string): void
Parameters:
Name | Type |
---|---|
| undefined | string |
Returns: void
setLayoutParams
▸ setLayoutParams(lp
: LayoutParams): void
Parameters:
Name | Type |
---|---|
|
Returns: void
setOnMount
▸ setOnMount(callback
: function): void
Parameters:
▪ callback: function
▸ (view
: View‹any›): void
Parameters:
Name | Type |
---|---|
| View‹any› |
Returns: void
setVisibility
▸ setVisibility(visibility
: Visibility): void
Parameters:
Name | Type | Default |
---|---|---|
| Visibility.VISIBLE |
Returns: void
snapshot
▸ snapshot(): object
Returns: object
Last updated