You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/architecture.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,16 +54,42 @@ The entry point `create_page()` is called internally by native templates to boot
54
54
55
55
## Layout
56
56
57
-
All components support layout properties inside the `style` dict: `width`, `height`, `flex`, `margin`, `min_width`, `max_width`, `min_height`, `max_height`, `align_self`. Containers (`Column`, `Row`) support `spacing`, `padding`, `alignment`, `align_items`, and `justify_content`.
57
+
PythonNative uses a **flexbox-inspired layout model** built on platform-native layout managers.
58
+
59
+
`View` is the **universal flex container** (like React Native's `View`). It defaults to `flex_direction: "column"`. `Column` and `Row` are convenience wrappers that fix the direction.
-**Android:**`LinearLayout` with gravity, weights, and divider-based spacing
81
+
-**iOS:**`UIStackView` with axis, alignment, distribution, and layout margins
58
82
59
83
## Native view handlers
60
84
61
85
Platform-specific rendering logic lives in the `native_views` package, organised into dedicated submodules:
62
86
63
-
-`native_views.base` — shared `ViewHandler` protocol and common utilities (colour parsing, padding resolution, layout keys)
87
+
-`native_views.base` — shared `ViewHandler` protocol and common utilities (colour parsing, padding resolution, layout keys, flex constants)
64
88
-`native_views.android` — Android handlers using Chaquopy's Java bridge (`jclass`, `dynamic_proxy`)
65
89
-`native_views.ios` — iOS handlers using rubicon-objc (`ObjCClass`, `objc_method`)
66
90
91
+
Column, Row, and View share a single `FlexContainerHandler` class on each platform. The handler reads `flex_direction` from the element's props to configure the native layout container.
92
+
67
93
Each handler class maps an element type name (e.g. `"Text"`, `"Button"`) to platform-native widget creation, property updates, and child management. The `NativeViewRegistry` lazily imports only the relevant platform module at runtime, so the package can be imported on any platform for testing.
0 commit comments