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
+16-19Lines changed: 16 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,17 +26,18 @@
26
26
27
27
## Overview
28
28
29
-
PythonNative is a cross-platform toolkit for building native Android and iOS apps in Python. It provides a **declarative, React-like component model** with automatic reconciliation, powered by Chaquopy on Android and rubicon-objc on iOS. Describe your UI as a tree of elements, manage state with `set_state()`, and let PythonNative handle creating and updating native views.
29
+
PythonNative is a cross-platform toolkit for building native Android and iOS apps in Python. It provides a **declarative, React-like component model** with hooks and automatic reconciliation, powered by Chaquopy on Android and rubicon-objc on iOS. Write function components with `use_state`, `use_effect`, and friends, just like React, and let PythonNative handle creating and updating native views.
30
30
31
31
## Features
32
32
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
-
-**Reactive state:** Call `self.set_state(key=value)` and the framework re-renders only what changed — no manual view mutation.
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
+
-**`style` prop:** Pass all visual and layout properties through a single `style` dict, composable via `StyleSheet`.
35
36
-**Virtual view tree + reconciler:** Element trees are diffed and patched with minimal native mutations, similar to React's reconciliation.
36
37
-**Direct native bindings:** Python calls platform APIs directly through Chaquopy and rubicon-objc, with no JavaScript bridge.
37
38
-**CLI scaffolding:**`pn init` creates a ready-to-run project; `pn run android` and `pn run ios` build and launch your app.
38
-
-**Navigation:** Push and pop screens with argument passing for multi-page apps.
39
-
-**Bundled templates:** Android Gradle and iOS Xcode templates are included — scaffolding requires no network access.
39
+
-**Navigation:** Push and pop screens with argument passing via the `use_navigation()` hook.
40
+
-**Bundled templates:** Android Gradle and iOS Xcode templates are included, so scaffolding requires no network access.
Copy file name to clipboardExpand all lines: docs/api/component-properties.md
+39-42Lines changed: 39 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# Component Property Reference
2
2
3
-
All style and behaviour properties are passed as keyword arguments to element functions.
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
-
## Common layout properties
5
+
## Common layout properties (inside `style`)
6
6
7
-
All components accept these layout properties:
7
+
All components accept these layout properties in their `style` dict:
8
8
9
9
-`width` — fixed width in dp (Android) / pt (iOS)
10
10
-`height` — fixed height
@@ -13,108 +13,104 @@ All components accept these layout properties:
Each returns an `Element` descriptor. See the Component Property Reference for full signatures.
14
+
Each returns an `Element` descriptor. Visual and layout properties are passed via `style={...}`. See the Component Property Reference for full details.
15
15
16
16
### Element
17
17
@@ -24,6 +24,7 @@ Function component primitives:
24
24
-`pythonnative.component` — decorator to create a function component
25
25
-`pythonnative.use_state(initial)` — local component state
26
26
-`pythonnative.use_effect(effect, deps)` — side effects
@@ -47,12 +48,12 @@ Function component primitives:
47
48
48
49
-`pythonnative.utils.IS_ANDROID` — platform flag with robust detection for Chaquopy/Android.
49
50
-`pythonnative.utils.get_android_context()` — returns the current Android `Activity`/`Context` when running on Android.
50
-
-`pythonnative.utils.set_android_context(ctx)` — set by `Page` on Android; you generally don't call this directly.
51
+
-`pythonnative.utils.set_android_context(ctx)` — set internally during page bootstrapping; you generally don't call this directly.
51
52
-`pythonnative.utils.get_android_fragment_container()` — returns the current Fragment container `ViewGroup` used for page rendering.
52
53
53
54
## Reconciler
54
55
55
-
`pythonnative.reconciler.Reconciler` — diffs element trees and applies minimal native mutations. Supports key-based child reconciliation, function components, and context providers. Used internally by `Page`.
56
+
`pythonnative.reconciler.Reconciler` — diffs element trees and applies minimal native mutations. Supports key-based child reconciliation, function components, and context providers. Used internally by `create_page`.
0 commit comments