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 .
Some elements provided by Beagle can be better used in some platforms than other, for example, ScrollView works better in mobile and it is not needed for web.
Beagle has a platform specification functionality, so it is able to control which elements are sent by BFF and which platforms will be used.
Beagle uses a customized header beagle-platform
with the possible values:
ALL
;MOBILE
;ANDROID
;IOS
;WEB
;This way, the BFF response is intercepted according to the platform which it is being sent.
There are two way you can access this control:
fun createComponentPlatformDependent(beaglePlatform: BeaglePlatform) = when {
this.beaglePlatform.isMobilePlatform() -> {
ScrollView(
children = listOf(
Text("Mobile platform")
)
)
}
this.beaglePlatform == BeaglePlatform.WEB -> {
Text("Web platform")
}
else -> {
ScrollView(
children = listOf(
Text("Mobile platform"),
Text("Web platform")
)
)
}
}
Button(text = "mobile only text").forPlatform(BeaglePlatform.MOBILE),
Button(text = "web only text").forPlatform(BeaglePlatform.WEB),
Button(text = "ios only text").forPlatform(BeaglePlatform.IOS),
Button(text = "android only text").forPlatform(BeaglePlatform.ANDROID),
Button(text = "text free for all")
You can check how to configure this functionality, see Beagle customization section.
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.