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: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ PythonNative is a cross-platform toolkit for building native Android and iOS app
33
33
-**Declarative UI:** Describe *what* your UI should look like with element functions (`Text`, `Button`, `Column`, `Row`, etc.). PythonNative creates and updates native views automatically.
34
34
-**Hooks and function components:** Manage state with `use_state`, side effects with `use_effect`, and navigation with `use_navigation`, all through one consistent pattern.
35
35
-**`style` prop:** Pass all visual and layout properties through a single `style` dict, composable via `StyleSheet`.
36
+
-**Cross-platform flexbox engine:** A pure-Python, Yoga-style layout engine computes frames once and applies them to native views, so `flex`, `padding`, `aspect_ratio`, and `position: "absolute"` produce the same geometry on Android and iOS.
36
37
-**Virtual view tree + reconciler:** Element trees are diffed and patched with minimal native mutations, similar to React's reconciliation.
37
38
-**Direct native bindings:** Python calls platform APIs directly through Chaquopy and rubicon-objc, with no JavaScript bridge.
38
39
-**CLI scaffolding:**`pn init` creates a ready-to-run project; `pn run android` and `pn run ios` build and launch your app.
Copy file name to clipboardExpand all lines: docs/api/component-properties.md
+59-10Lines changed: 59 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,57 @@
2
2
3
3
All visual and layout properties are passed via the `style` dict (or list of dicts) to element functions. Behavioural properties (callbacks, data, content) remain as keyword arguments.
4
4
5
+
> Layout is computed by PythonNative's pure-Python flexbox engine (see
6
+
> [Layout engine](../concepts/layout.md)). The same `style` keys produce the
7
+
> same frames on Android and iOS — every property listed below is honoured by
8
+
> the engine and applied via `set_frame` on the underlying native view.
9
+
5
10
## Common layout properties (inside `style`)
6
11
7
12
All components accept these layout properties in their `style` dict:
8
13
9
-
-`width` — fixed width in dp (Android) / pt (iOS)
10
-
-`height` — fixed height
11
-
-`flex` — flex grow factor (shorthand for `flex_grow`)
12
-
-`flex_grow` — how much a child grows to fill available space
13
-
-`flex_shrink` — how much a child shrinks when space is limited
14
-
-`margin` — outer spacing (int, float, or dict with `horizontal`, `vertical`, `left`, `top`, `right`, `bottom`)
0 commit comments