Class: ImgTouchButton
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
.
Hierarchy
DisplayComponent
<ImgTouchButtonProps
>↳
ImgTouchButton
Constructors
constructor
• new ImgTouchButton(props
): ImgTouchButton
Creates an instance of a DisplayComponent.
Parameters
Name | Type | Description |
---|---|---|
props | ImgTouchButtonProps | The propertis of the component. |
Returns
Inherited from
DisplayComponent<ImgTouchButtonProps>.constructor
Defined in
src/sdk/components/FSComponent.ts:73
Properties
buttonRef
• Protected
Readonly
buttonRef: NodeReference
<TouchButton
<TouchButtonProps
>>
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:24
context
• Optional
context: [] = undefined
The context on this component, if any.
Inherited from
DisplayComponent.context
Defined in
src/sdk/components/FSComponent.ts:64
contextType
• Optional
Readonly
contextType: readonly [] = undefined
The type of context for this component, if any.
Inherited from
DisplayComponent.contextType
Defined in
src/sdk/components/FSComponent.ts:67
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: undefined
| MappedSubscribable
<string
>
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:28
props
• props: ImgTouchButtonProps
& ComponentProps
The properties of the component.
Inherited from
DisplayComponent.props
Defined in
src/sdk/components/FSComponent.ts:61
RESERVED_CSS_CLASSES
▪ Static
Protected
Readonly
RESERVED_CSS_CLASSES: Set
<string
>
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:22
Methods
destroy
▸ destroy(): void
Returns
void
Inherit Doc
Overrides
DisplayComponent.destroy
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:113
getContext
▸ getContext(context
): never
Gets a context data subscription from the context collection.
Parameters
Name | 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
DisplayComponent.getContext
Defined in
src/sdk/components/FSComponent.ts:106
getReservedCssClasses
▸ getReservedCssClasses(): ReadonlySet
<string
>
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.
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:108
getRootElement
▸ getRootElement(): HTMLElement
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.
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:39
onAfterRender
▸ onAfterRender(node
): void
A callback that is called after the component is rendered.
Parameters
Name | Type | Description |
---|---|---|
node | VNode | The component's VNode. |
Returns
void
Inherited from
DisplayComponent.onAfterRender
Defined in
src/sdk/components/FSComponent.ts:87
onBeforeRender
▸ onBeforeRender(): void
A callback that is called before the component is rendered.
Returns
void
Inherited from
DisplayComponent.onBeforeRender
Defined in
src/sdk/components/FSComponent.ts:80
render
▸ render(): VNode
Returns
VNode
Inherit Doc
Overrides
DisplayComponent.render
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:53
renderImg
▸ renderImg(): null
| VNode
Renders this button's image.
Returns
null
| VNode
This button's rendered image, or null
if this button does not have an image.
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:92
simulatePressed
▸ simulatePressed(ignoreDisabled?
): void
Simulates this button being pressed. This will execute the onPressed()
callback if one is defined.
Parameters
Name | 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
Defined in
src/garminsdk/components/touchbutton/ImgTouchButton.tsx:48