Foundation
Optional prebuilt blocks and type converters for demo, prototyping, and showcasing Nativeblocks.
Foundation is an optional package that provides ready-to-use blocks (text, button, image, layout) and type converters. Use it for demos, prototypes, and showcases. In production, bring your own design system components via @NativeBlock annotations.
Add the Dependency
build.gradle
dependencies {
implementation("io.nativeblocks:nativeblocks-foundation-android:1.3.0")
}
Register
Call FoundationProvider.provide() after NativeblocksManager.initialize:
NativeblocksManager.initialize(...)
FoundationProvider.provide()
Provided blocks
| Block | Description |
|---|---|
NativeBox | Box layout container |
NativeColumn | Vertical column |
NativeRow | Horizontal row |
NativeLazyColumn | Scrollable vertical list |
NativeLazyRow | Scrollable horizontal list |
NativeSpacer | Flexible spacer |
NativeText | Text display |
NativeTextField | Text input |
NativeButton | Button |
NativeImage | Image |
Provided type converters
Foundation also registers type converters so Nativeblocks can serialize/deserialize platform-specific types from frame JSON.
| Type | Description |
|---|---|
Dp | Density-independent pixel unit |
Color | Compose color |
LayoutDirection | LTR / RTL layout |
TextUnit | SP text size |
Alignment | Box alignment |
FontWeight | Font weight |
TextAlign | Text alignment |
ContentScale | Image content scale |
Arrangement.Horizontal | Horizontal arrangement |
Arrangement.Vertical | Vertical arrangement |
TextOverflow | Text overflow behaviour |
KeyboardType | Keyboard input type |