Skip to content

Platform support ​

MasonKit runs on iOS, Android and Windows. The Rust layout engine (mason-core, built on taffy) is shared by all three; each platform has its own native view layer that draws, measures text and handles input.

Requirements ​

PlatformNativeScript runtimeOS minimumNative library shipped in the package
iOS@nativescript/ios 8.0+iOS 15.6platforms/ios/Mason.xcframework (iOS device, iOS simulator, visionOS device and simulator slices)
Android@nativescript/android 8.0+API 21platforms/android/masonkit-release.aar (arm, arm64, x86, x86_64)
Windows@nativescript/windows 9.1+Windows 10/11 with the Windows App SDK (WinUI 3)platforms/windows/{x64,arm64}/NativeScript.Mason.{dll,winmd}

The runtime minimums come from the nativescript.platforms field of the package's package.json. The OS minimums come from the native projects: MinimumOSVersion in the xcframework and minSdk in the AAR's Gradle build.

The Android library also depends on Glide (images), Gson and org.nativescript:fontmanager; these are declared in platforms/android/include.gradle and resolved by Gradle when you build your app.

Feature differences ​

Almost everything in these docs behaves the same on every platform. The differences below are the ones confirmed in the native code.

FeatureiOSAndroidWindows
Flexbox, grid, block, inline flow, floatYesYesYes
position: fixed / stickyYesYesYes
writing-mode: vertical-rl / vertical-lr, vertical containersYesYesYes
text-orientation, text-combine-uprightYesYesYes
text-spacing-trimYesYes (font's halt)Yes (fonts with halt/vhal)
Floats in vertical textYesYesYes
mask-*, clip-path, mask-border-*, border-imageYesYesYes (see notes)
SVG url() backgrounds and ImgBuilt-in static SVG readerBuilt-in static SVG readerDirect2D SVG renderer
backdrop-filterYes (snapshot of the content behind)Yes (RenderEffect on API 31+, software snapshot below)Yes
box-shadow backend switch (setBoxShadowRenderMode)No-opYesNo-op (always Composition)
<details> / <summary>NativeNativeNative
<input> typesAll types in InputType are mappedAll types mappedAll types mapped

Notes:

  • backdrop-filter on iOS renders a snapshot of what is behind the element through Core Image, refreshed while the screen changes and idle otherwise. The snapshot also includes content painted above the element, skips Metal-backed layers, and does not refresh for animations that run only on the render server.
  • backdrop-filter on Android below API 31 (Android 12) draws from a downscaled software snapshot, with the same filter functions.
  • Mask hit testing. As in browsers, clip-path limits where an element can be tapped and masks do not.
  • url(#id) masks and clip paths. There is no in-document SVG to reference, so they are none on every platform.
  • SVG. Shapes, paths, groups, transforms, fills, strokes, opacity, gradients, patterns, masks, markers, text, <use>, <symbol>, <clipPath>, <style> sheets with simple selectors and raster data-URL <image> work on every platform. Filters and <textPath> are not supported anywhere.
  • SVG text uses the platform's fonts, so glyphs differ between platforms as fonts do. iOS and Android find app fonts by family name; Windows uses installed fonts only, with serif, sans-serif and monospace mapped to Times New Roman, Arial and Consolas as Chrome does.
  • SVG on Windows. A pattern on a stroke uses the paint's fallback color, and a mask inside a masked element is not applied.
  • Vertical writing modes. Cell sizes come from the font's vertical metrics where it has them, so they can differ between platforms as the fonts do. See Writing modes.

Platform-specific APIs ​

The box-shadow backend can be switched on Android (iOS and Windows export both functions as no-ops):

ts
import { setBoxShadowRenderMode, setBoxShadowSoftwareRasterScale } from '@triniwiz/nativescript-masonkit';

if (__ANDROID__) {
  // 'auto' | 'render-node' | 'software'
  setBoxShadowRenderMode('auto');
  setBoxShadowSoftwareRasterScale(null);
}

More ​

  • Windows: how the Windows component is packaged and what differs there.
  • Using Mason natively: driving the Kotlin and Swift libraries without NativeScript.

Released under the Apache 2.0 License.