FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnative/src/pythonnative/navigation/__init__.py at main · pythonnative/pythonnative · GitHub
pythonnative
/
pythonnative
Public
Notifications
You must be signed in to change notification settings
Fork
23
Star
131
Code
Issues
11
Pull requests
4
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnative
/
src
/
pythonnative
/
navigation
/
__init__.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
110 lines (96 loc) · 3.17 KB
Breadcrumbs
pythonnative
/
src
/
pythonnative
/
navigation
/
__init__.py
Copy path
File metadata and controls
110 lines (96 loc) · 3.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
"""Navigation: typed stack, tab, and drawer navigators.
Screens are ordinary components whose parameters are their route
params; navigators are module-level values listing them:
```python
import pythonnative as pn
@pn.component
def HomeScreen() -> pn.Node:
nav = pn.use_navigation()
return pn.Button("Open 42", on_press=lambda: nav.push(ItemScreen(id=42)))
@pn.component
def ItemScreen(id: int) -> pn.Node:
pn.use_screen_options(title=f"Item {id}")
return pn.Text(f"Item {id}")
Root = pn.StackNavigator(
pn.Screen(HomeScreen, title="Home"),
pn.Screen(ItemScreen, path="items/{id}"),
screen_options=pn.ScreenOptions(header_large_title=True),
)
nav_ref = pn.NavigationRef()
@pn.component
def App() -> pn.Node:
return pn.NavigationContainer(Root, link_prefixes=["myapp://"], ref=nav_ref)
```
``nav.push(ItemScreen(id=42))`` builds the destination with the screen
component's own signature, so a missing or mistyped param is a type
error. Public surface (all re-exported from ``pythonnative``):
- Navigators: [`StackNavigator`][pythonnative.StackNavigator],
[`TabNavigator`][pythonnative.TabNavigator],
[`DrawerNavigator`][pythonnative.DrawerNavigator],
[`Screen`][pythonnative.Screen], [`Group`][pythonnative.Group], and
[`NavigationContainer`][pythonnative.NavigationContainer].
- Hooks: [`use_navigation`][pythonnative.use_navigation],
[`use_route`][pythonnative.use_route],
[`use_screen_options`][pythonnative.use_screen_options],
[`use_is_focused`][pythonnative.use_is_focused], and
[`use_focus_effect`][pythonnative.use_focus_effect].
- Types: [`Navigation`][pythonnative.Navigation],
[`NavigationRef`][pythonnative.NavigationRef],
[`Route`][pythonnative.navigation.Route],
[`NavigationState`][pythonnative.navigation.NavigationState],
[`ScreenOptions`][pythonnative.ScreenOptions], and
[`TabBarStyle`][pythonnative.TabBarStyle].
"""
from
.
container
import
ContainerContext
,
NavigationContainer
from
.
handle
import
(
DrawerNavigation
,
EventName
,
FocusContext
,
HostNavigator
,
Navigation
,
NavigationContext
,
NavigationEvent
,
NavigatorCore
,
TabNavigation
,
)
from
.
hooks
import
use_focus_effect
,
use_is_focused
,
use_navigation
,
use_route
from
.
host
import
NAV_STATE_ARG
,
HostContext
,
HostRoot
from
.
linking
import
LinkTable
from
.
navigators
import
DrawerNavigator
,
Navigator
,
StackNavigator
,
TabNavigator
,
use_screen_options
from
.
ref
import
NavigationRef
from
.
screen
import
Group
,
Screen
,
ScreenOptions
,
ScreenTarget
,
TabBarStyle
from
.
state
import
NavigationState
,
Route
__all__
=
[
"NAV_STATE_ARG"
,
"ContainerContext"
,
"DrawerNavigation"
,
"DrawerNavigator"
,
"EventName"
,
"FocusContext"
,
"Group"
,
"HostContext"
,
"HostNavigator"
,
"HostRoot"
,
"LinkTable"
,
"Navigation"
,
"NavigationContainer"
,
"NavigationContext"
,
"NavigationEvent"
,
"NavigationRef"
,
"NavigationState"
,
"Navigator"
,
"NavigatorCore"
,
"Route"
,
"Screen"
,
"ScreenOptions"
,
"ScreenTarget"
,
"StackNavigator"
,
"TabBarStyle"
,
"TabNavigation"
,
"TabNavigator"
,
"use_focus_effect"
,
"use_is_focused"
,
"use_navigation"
,
"use_route"
,
"use_screen_options"
,
]
Back
|
FazBrowse Home
|
New Git URL