Beagle v1.5 is no longer actively maintained. The documented version you are viewing may contain deprecated functionality. For up-to-date documentation, see the latest version .
The SetContext
action is responsible for changing the value of a context.
The setContext structure is:
Attribute | Type | Required | Definition |
---|---|---|---|
contextId | String | ✓ | Context identifier |
value | Any | ✓ | New value to apply in the context |
path | String | Specific context point for changing value in case of arrays and maps <key, value>. |
See below an example of a text that is set by context and have an initial value “Set Context Example”. The click event have a SetContext
action that change the context value to “Context has changed”.
Container(
children = listOf(
Text(text = "@{myContext}"),
Button(
text = "Change context",
onPress = listOf(
SetContext(
contextId = "myContext",
value = "Context has changed"
)
)
)
),
context = ContextData(
id = "myContext",
value = "Set Context Example"
)
)
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.