Version-aware Components in Nativescript (JS, XML)

  android-layout, nativescript

my situation is as follows:

I have an application that has had previous functionality that users with newer devices cannot use. I wanted to provide a version-aware component that based on the android version (ios does not experience this) either shows one option or the other, so that the need can be met for both demographics.

My initial thought is that it would be similar to how we can have platform-aware components via

<ios>
        <button text="Submit" tap="onSubmitIos"/>
</ios>
<android>
        <button text="Submit" tap="onSubmitAndroid"/>
</android>

or how we can set component properties to be platform-specific

 <statusbar:StatusBar ios:barStyle="light" barColor="#B01E07" />

Ultimately I’m looking for functionality similar to Build.VERSION.SDK_INT in java/kotlin if that helps with context.

If there is a way to use android version aware controls in the XML frontend or JS backend, either would be much appreciated.

Source: Android Layout Questions

LEAVE A COMMENT