Skip to main content

Class: ImgTouchButton

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:21

A touchscreen button which displays an optional label and image.

The root element of the button contains the touch-button-img CSS class by default, in addition to all root-element classes used by TouchButton.

The root element contains an optional child <img> element with the CSS class touch-button-img-img and an optional label element with the CSS class touch-button-label.

Extends​

Constructors​

Constructor​

new ImgTouchButton(props): ImgTouchButton

Defined in: src/sdk/components/FSComponent.ts:76

Creates an instance of a DisplayComponent.

Parameters​

ParameterTypeDescription
propsImgTouchButtonPropsThe propertis of the component.

Returns​

ImgTouchButton

Inherited from​

DisplayComponent.constructor

Properties​

buttonRef​

protected readonly buttonRef: NodeReference<TouchButton<TouchButtonProps>>

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:24


context?​

optional context: [] = undefined

Defined in: src/sdk/components/FSComponent.ts:67

The context on this component, if any.

Inherited from​

DisplayComponent.context


contextType?​

readonly optional contextType: readonly [] = undefined

Defined in: src/sdk/components/FSComponent.ts:70

The type of context for this component, if any.

Inherited from​

DisplayComponent.contextType


cssClassSet​

protected readonly cssClassSet: SetSubject<string>

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:26


cssClassSub?​

protected optional cssClassSub: Subscription

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:32


imgSrc​

protected readonly imgSrc: MappedSubscribable<string> | undefined

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:28


props​

props: ImgTouchButtonProps & ComponentProps

Defined in: src/sdk/components/FSComponent.ts:64

The properties of the component.

Inherited from​

DisplayComponent.props


RESERVED_CSS_CLASSES​

protected readonly static RESERVED_CSS_CLASSES: Set<string>

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:22

Methods​

destroy()​

destroy(): void

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:113

Destroys this component.

Returns​

void

Overrides​

DisplayComponent.destroy


getContext()​

protected getContext(context): never

Defined in: src/sdk/components/FSComponent.ts:109

Gets a context data subscription from the context collection.

Parameters​

ParameterTypeDescription
contextneverThe context to get the subscription for.

Returns​

never

The requested context.

Throws​

An error if no data for the specified context type could be found.

Inherited from​

DisplayComponent.getContext


getReservedCssClasses()​

protected getReservedCssClasses(): ReadonlySet<string>

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:108

Gets the CSS classes that are reserved for this button's root element.

Returns​

ReadonlySet<string>

The CSS classes that are reserved for this button's root element.


getRootElement()​

getRootElement(): HTMLElement

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:39

Gets this button's root HTML element.

Returns​

HTMLElement

This button's root HTML element.

Throws​

Error if this button has not yet been rendered.


onAfterRender()​

onAfterRender(node): void

Defined in: src/sdk/components/FSComponent.ts:90

A callback that is called after the component is rendered.

Parameters​

ParameterTypeDescription
nodeVNodeThe component's VNode.

Returns​

void

Inherited from​

DisplayComponent.onAfterRender


onBeforeRender()​

onBeforeRender(): void

Defined in: src/sdk/components/FSComponent.ts:83

A callback that is called before the component is rendered.

Returns​

void

Inherited from​

DisplayComponent.onBeforeRender


render()​

render(): VNode

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:53

Renders the component.

Returns​

VNode

A JSX element to be rendered.

Overrides​

DisplayComponent.render


renderImg()​

protected renderImg(): VNode | null

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:92

Renders this button's image.

Returns​

VNode | null

This button's rendered image, or null if this button does not have an image.


simulatePressed()​

simulatePressed(ignoreDisabled): void

Defined in: src/garminsdk/components/touchbutton/ImgTouchButton.tsx:48

Simulates this button being pressed. This will execute the onPressed() callback if one is defined.

Parameters​

ParameterTypeDefault valueDescription
ignoreDisabledbooleanfalseWhether to simulate the button being pressed regardless of whether the button is disabled. Defaults to false.

Returns​

void