Class: ValueTouchButton<S>
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:92
A touchscreen button which displays the value of a bound state.
The root element of the button contains the touch-button-value CSS class by default, in addition to all
root-element classes used by TouchButton.
The value of the button's bound state is rendered into a child div element containing the CSS class
touch-button-value-value.
Extends
Type Parameters
| Type Parameter |
|---|
S extends Subscribable<any> |
Constructors
Constructor
new ValueTouchButton<
S>(props):ValueTouchButton<S>
Defined in: src/sdk/components/FSComponent.ts:73
Creates an instance of a DisplayComponent.
Parameters
| Parameter | Type | Description |
|---|---|---|
props | ValueTouchButtonProps | The propertis of the component. |
Returns
ValueTouchButton<S>
Inherited from
Properties
buttonRef
protectedreadonlybuttonRef:NodeReference<TouchButton<TouchButtonProps>>
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:95
context?
optionalcontext: [] =undefined
Defined in: src/sdk/components/FSComponent.ts:64
The context on this component, if any.
Inherited from
contextType?
readonlyoptionalcontextType: readonly [] =undefined
Defined in: src/sdk/components/FSComponent.ts:67
The type of context for this component, if any.
Inherited from
cssClassSet
protectedreadonlycssClassSet:SetSubject<string>
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:98
props
props:
ValueTouchButtonProps<S> &ComponentProps
Defined in: src/sdk/components/FSComponent.ts:61
The properties of the component.
Inherited from
renderedValue?
protectedoptionalrenderedValue:string|VNode
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:100
valueRef
protectedreadonlyvalueRef:NodeReference<HTMLDivElement>
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:96
RESERVED_CSS_CLASSES
protectedreadonlystaticRESERVED_CSS_CLASSES:Set<string>
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:93
Methods
cleanUpRenderedValue()
protectedcleanUpRenderedValue():void
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:154
Cleans up this button's rendered value.
Returns
void
destroy()
destroy():
void
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:298
Destroys this component.
Returns
void
Overrides
getContext()
protectedgetContext(context):never
Defined in: src/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: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:293
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/ValueTouchButton.tsx:121
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():
void
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:106
A callback that is called after the component is rendered.
Returns
void
Overrides
DisplayComponent.onAfterRender
onBeforeRender()
onBeforeRender():
void
Defined in: src/sdk/components/FSComponent.ts:80
A callback that is called before the component is rendered.
Returns
void
Inherited from
DisplayComponent.onBeforeRender
onHoldEnded()
protectedonHoldEnded(button,totalHoldDuration,endReason):void
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:235
Responds to when this button exits the held state.
Parameters
| Parameter | Type | Description |
|---|---|---|
button | TouchButton | The button that was held. |
totalHoldDuration | number | The total amount of time, in milliseconds, that this button was held. |
endReason | TouchButtonHoldEndReason | The reason that this button exited the held state. |
Returns
void
onHoldStarted()
protectedonHoldStarted(button):TouchButtonHoldAction
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:208
Responds to when this button enters the held state.
Parameters
| Parameter | Type | Description |
|---|---|---|
button | TouchButton | The button that is held. |
Returns
The action to take. Ignored if the value is equal to TouchButtonHoldAction.EndHold.
onHoldTick()
protectedonHoldTick(button,dt,totalTime,timeSinceLastPress):TouchButtonHoldAction
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:223
A callback which is called every frame when this button is held.
Parameters
| Parameter | Type | Description |
|---|---|---|
button | TouchButton | The button that is held. |
dt | number | The elapsed time, in milliseconds, since the previous frame. |
totalTime | number | The total amount of time, in milliseconds, that this button has been held. |
timeSinceLastPress | number | The amount of time, in milliseconds, that this button has been held since the last time the button was pressed as a tick action. |
Returns
The action to take.
onPressed()
protectedonPressed(button,isHeld):void
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:198
Responds to when this button is pressed.
Parameters
| Parameter | Type | Description |
|---|---|---|
button | TouchButton | The button that was pressed. |
isHeld | boolean | Whether the button was held when it was pressed. |
Returns
void
onTouched()
protectedonTouched(button):TouchButtonOnTouchedAction
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:187
Responds to when this button is touched.
Parameters
| Parameter | Type | Description |
|---|---|---|
button | TouchButton | The button that was touched. |
Returns
The action to take as a result of the button being touched.
processRenderedValue()
protectedprocessRenderedValue(rendered):void
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:139
Processes a newly rendered value. The new rendered value will rendered into this button's value container, replacing any existing rendered value.
Parameters
| Parameter | Type | Description |
|---|---|---|
rendered | string | VNode | The newly rendered value. |
Returns
void
render()
render():
VNode
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:240
Renders the component.
Returns
A JSX element to be rendered.
Overrides
renderValueContainer()
protectedrenderValueContainer():VNode
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:279
Renders this button's value container.
Returns
This button's rendered value container.
simulatePressed()
simulatePressed(
ignoreDisabled):void
Defined in: src/garminsdk/components/touchbutton/ValueTouchButton.tsx:130
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