Class: ImgTouchButton
Defined in: 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: sdk/components/FSComponent.ts:73
Creates an instance of a DisplayComponent.
Parameters
| Parameter | Type | Description |
|---|---|---|
props | ImgTouchButtonProps | The propertis of the component. |
Returns
ImgTouchButton
Inherited from
Properties
buttonRef
protectedreadonlybuttonRef:NodeReference<TouchButton<TouchButtonProps>>
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:24
context?
optionalcontext: [] =undefined
Defined in: sdk/components/FSComponent.ts:64
The context on this component, if any.
Inherited from
contextType?
readonlyoptionalcontextType: readonly [] =undefined
Defined in: sdk/components/FSComponent.ts:67
The type of context for this component, if any.
Inherited from
cssClassSet
protectedreadonlycssClassSet:SetSubject<string>
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:26
cssClassSub?
protectedoptionalcssClassSub:Subscription
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:32
imgSrc
protectedreadonlyimgSrc:undefined|MappedSubscribable<string>
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:28
props
props:
ImgTouchButtonProps&ComponentProps
Defined in: sdk/components/FSComponent.ts:61
The properties of the component.
Inherited from
RESERVED_CSS_CLASSES
protectedreadonlystaticRESERVED_CSS_CLASSES:Set<string>
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:22
Methods
destroy()
destroy():
void
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:113
Destroys this component.
Returns
void
Overrides
getContext()
protectedgetContext(context):never
Defined in: sdk/components/FSComponent.ts:106
Gets a context data subscription from the context collection.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | never | The 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
getReservedCssClasses()
protectedgetReservedCssClasses():ReadonlySet<string>
Defined in: 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: 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: sdk/components/FSComponent.ts:87
A callback that is called after the component is rendered.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | VNode | The component's VNode. |
Returns
void
Inherited from
DisplayComponent.onAfterRender
onBeforeRender()
onBeforeRender():
void
Defined in: sdk/components/FSComponent.ts:80
A callback that is called before the component is rendered.
Returns
void
Inherited from
DisplayComponent.onBeforeRender
render()
render():
VNode
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:53
Renders the component.
Returns
A JSX element to be rendered.
Overrides
renderImg()
protectedrenderImg():null|VNode
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:92
Renders this button's image.
Returns
null | VNode
This button's rendered image, or null if this button does not have an image.
simulatePressed()
simulatePressed(
ignoreDisabled):void
Defined in: garminsdk/components/touchbutton/ImgTouchButton.tsx:48
Simulates this button being pressed. This will execute the onPressed() callback if one is defined.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
ignoreDisabled | boolean | false | Whether to simulate the button being pressed regardless of whether the button is disabled. Defaults to false. |
Returns
void