@momo-kits/native-kits 0.158.1-beta.1-debug → 0.158.1-beta.2-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compose/build.gradle.kts +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +15 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +15 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +4 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +11 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +56 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +167 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -0
- package/gradle.properties +1 -1
- package/local.properties +2 -2
- package/package.json +1 -1
- package/.claude/settings.local.json +0 -11
- package/.claude/skills/design-system/SKILL.md +0 -88
- package/.claude/skills/design-system/references/components/avatar.md +0 -134
- package/.claude/skills/design-system/references/components/badge.md +0 -127
- package/.claude/skills/design-system/references/components/bottom-tab.md +0 -177
- package/.claude/skills/design-system/references/components/bottomsheet.md +0 -170
- package/.claude/skills/design-system/references/components/button.md +0 -206
- package/.claude/skills/design-system/references/components/carousel.md +0 -117
- package/.claude/skills/design-system/references/components/checkbox.md +0 -98
- package/.claude/skills/design-system/references/components/chip.md +0 -146
- package/.claude/skills/design-system/references/components/collapse.md +0 -120
- package/.claude/skills/design-system/references/components/date-picker.md +0 -119
- package/.claude/skills/design-system/references/components/divider.md +0 -84
- package/.claude/skills/design-system/references/components/icon.md +0 -130
- package/.claude/skills/design-system/references/components/image.md +0 -81
- package/.claude/skills/design-system/references/components/information.md +0 -107
- package/.claude/skills/design-system/references/components/input-dropdown.md +0 -138
- package/.claude/skills/design-system/references/components/input-money.md +0 -157
- package/.claude/skills/design-system/references/components/input-otp.md +0 -132
- package/.claude/skills/design-system/references/components/input-phone-number.md +0 -140
- package/.claude/skills/design-system/references/components/input-search.md +0 -124
- package/.claude/skills/design-system/references/components/input-text-area.md +0 -133
- package/.claude/skills/design-system/references/components/input.md +0 -152
- package/.claude/skills/design-system/references/components/loader.md +0 -87
- package/.claude/skills/design-system/references/components/pagination.md +0 -105
- package/.claude/skills/design-system/references/components/popup-notify.md +0 -128
- package/.claude/skills/design-system/references/components/progress-info.md +0 -114
- package/.claude/skills/design-system/references/components/radio.md +0 -86
- package/.claude/skills/design-system/references/components/rating.md +0 -126
- package/.claude/skills/design-system/references/components/skeleton.md +0 -120
- package/.claude/skills/design-system/references/components/slider.md +0 -141
- package/.claude/skills/design-system/references/components/snackbar.md +0 -97
- package/.claude/skills/design-system/references/components/stepper.md +0 -100
- package/.claude/skills/design-system/references/components/steps.md +0 -91
- package/.claude/skills/design-system/references/components/suggest-action.md +0 -95
- package/.claude/skills/design-system/references/components/swipe.md +0 -121
- package/.claude/skills/design-system/references/components/switch.md +0 -98
- package/.claude/skills/design-system/references/components/tab-view.md +0 -120
- package/.claude/skills/design-system/references/components/tag.md +0 -118
- package/.claude/skills/design-system/references/components/text.md +0 -151
- package/.claude/skills/design-system/references/components/toast.md +0 -99
- package/.claude/skills/design-system/references/components/tooltip.md +0 -138
- package/.claude/skills/design-system/references/components/top-nav-miniapp.md +0 -94
- package/.claude/skills/design-system/references/components/top-nav.md +0 -226
- package/.claude/skills/design-system/references/components/uploader.md +0 -115
- package/.claude/skills/design-system/references/navigation/bottom-tab.md +0 -131
- package/.claude/skills/design-system/references/navigation/bottomsheet.md +0 -161
- package/.claude/skills/design-system/references/navigation/modal.md +0 -133
- package/.claude/skills/design-system/references/navigation/navigation-options.md +0 -225
- package/.claude/skills/design-system/references/navigation/navigator.md +0 -111
- package/.claude/skills/design-system/references/navigation/setup.md +0 -134
- package/.claude/skills/design-system/references/navigation/stack.md +0 -128
- package/.claude/skills/design-system/references/spec-convention.md +0 -80
- package/.claude/skills/design-system/references/tokens/colors.md +0 -131
- package/.claude/skills/design-system/references/tokens/spacing-radius.md +0 -144
- package/.claude/skills/design-system/references/tokens/theme.md +0 -125
- package/.claude/skills/design-system/references/tokens/typography.md +0 -135
- package/.claude/skills/design-system-kits/SKILL.md +0 -102
- package/.claude/skills/design-system-kits/references/code-convention.md +0 -118
- package/.claude/skills/design-system-kits/references/components/avatar.md +0 -45
- package/.claude/skills/design-system-kits/references/components/badge.md +0 -27
- package/.claude/skills/design-system-kits/references/components/button.md +0 -65
- package/.claude/skills/design-system-kits/references/components/carousel.md +0 -51
- package/.claude/skills/design-system-kits/references/components/checkbox.md +0 -39
- package/.claude/skills/design-system-kits/references/components/chip.md +0 -54
- package/.claude/skills/design-system-kits/references/components/collapse.md +0 -63
- package/.claude/skills/design-system-kits/references/components/date-picker.md +0 -36
- package/.claude/skills/design-system-kits/references/components/divider.md +0 -21
- package/.claude/skills/design-system-kits/references/components/icon.md +0 -382
- package/.claude/skills/design-system-kits/references/components/image.md +0 -62
- package/.claude/skills/design-system-kits/references/components/information.md +0 -61
- package/.claude/skills/design-system-kits/references/components/input-dropdown.md +0 -92
- package/.claude/skills/design-system-kits/references/components/input-money.md +0 -128
- package/.claude/skills/design-system-kits/references/components/input-otp.md +0 -85
- package/.claude/skills/design-system-kits/references/components/input-phone-number.md +0 -96
- package/.claude/skills/design-system-kits/references/components/input-search.md +0 -127
- package/.claude/skills/design-system-kits/references/components/input-text-area.md +0 -100
- package/.claude/skills/design-system-kits/references/components/input.md +0 -126
- package/.claude/skills/design-system-kits/references/components/loader.md +0 -41
- package/.claude/skills/design-system-kits/references/components/pagination.md +0 -47
- package/.claude/skills/design-system-kits/references/components/popup-notify.md +0 -69
- package/.claude/skills/design-system-kits/references/components/popup-promotion.md +0 -35
- package/.claude/skills/design-system-kits/references/components/progress-info.md +0 -55
- package/.claude/skills/design-system-kits/references/components/radio.md +0 -42
- package/.claude/skills/design-system-kits/references/components/rating.md +0 -36
- package/.claude/skills/design-system-kits/references/components/skeleton.md +0 -25
- package/.claude/skills/design-system-kits/references/components/slider.md +0 -53
- package/.claude/skills/design-system-kits/references/components/snackbar.md +0 -52
- package/.claude/skills/design-system-kits/references/components/stepper.md +0 -46
- package/.claude/skills/design-system-kits/references/components/steps.md +0 -57
- package/.claude/skills/design-system-kits/references/components/suggest-action.md +0 -44
- package/.claude/skills/design-system-kits/references/components/swipe.md +0 -44
- package/.claude/skills/design-system-kits/references/components/switch.md +0 -43
- package/.claude/skills/design-system-kits/references/components/tab-view.md +0 -56
- package/.claude/skills/design-system-kits/references/components/tag.md +0 -50
- package/.claude/skills/design-system-kits/references/components/text.md +0 -56
- package/.claude/skills/design-system-kits/references/components/toast.md +0 -51
- package/.claude/skills/design-system-kits/references/components/tooltip.md +0 -95
- package/.claude/skills/design-system-kits/references/components/uploader.md +0 -48
- package/.claude/skills/design-system-kits/references/design-spec-structure.md +0 -356
- package/.claude/skills/design-system-kits/references/design-spec-to-code.md +0 -596
- package/.claude/skills/design-system-kits/references/navigation/bottom-tab.md +0 -155
- package/.claude/skills/design-system-kits/references/navigation/bottomsheet.md +0 -94
- package/.claude/skills/design-system-kits/references/navigation/modal.md +0 -125
- package/.claude/skills/design-system-kits/references/navigation/navigation-options.md +0 -430
- package/.claude/skills/design-system-kits/references/navigation/navigator.md +0 -177
- package/.claude/skills/design-system-kits/references/navigation/setup.md +0 -94
- package/.claude/skills/design-system-kits/references/navigation/stack.md +0 -152
- package/.claude/skills/design-system-kits/references/screen-layout-rule.md +0 -125
- package/.claude/skills/design-system-kits/references/tokens/colors.md +0 -183
- package/.claude/skills/design-system-kits/references/tokens/spacing-radius.md +0 -45
- package/.claude/skills/design-system-kits/references/tokens/theme.md +0 -97
- package/.claude/skills/design-system-kits/references/tokens/typography.md +0 -105
- package/.claude/skills/vibe-design/SKILL.md +0 -306
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
# Navigation Options Reference
|
|
2
|
-
|
|
3
|
-
Configure screen headers — title, background, right buttons, back behavior, and more.
|
|
4
|
-
|
|
5
|
-
## React Native — setOptions
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
const screenRef = useRef<ScreenRef>(null);
|
|
9
|
-
|
|
10
|
-
// Set options dynamically
|
|
11
|
-
screenRef.current?.setOptions({
|
|
12
|
-
headerTitle: 'Screen Title',
|
|
13
|
-
hiddenBack: false,
|
|
14
|
-
onPressLeftHeader: () => navigation.goBack(),
|
|
15
|
-
onBackHandler: goBack => {
|
|
16
|
-
// Custom back logic
|
|
17
|
-
goBack();
|
|
18
|
-
},
|
|
19
|
-
preventBack: {
|
|
20
|
-
title: 'Leave?',
|
|
21
|
-
description: 'Changes will be lost',
|
|
22
|
-
primary: { title: 'Leave', onPress: () => {} },
|
|
23
|
-
secondary: { title: 'Stay', onPress: () => {} },
|
|
24
|
-
},
|
|
25
|
-
headerRight: {
|
|
26
|
-
useShortcut: true,
|
|
27
|
-
useMore: false,
|
|
28
|
-
useCloseIcon: false,
|
|
29
|
-
tools: [{
|
|
30
|
-
title: { vi: 'Cài đặt', en: 'Settings' },
|
|
31
|
-
items: [{
|
|
32
|
-
icon: '24_settings',
|
|
33
|
-
name: { vi: 'Cài đặt', en: 'Settings' },
|
|
34
|
-
key: 'settings',
|
|
35
|
-
onPress: () => openSettings(),
|
|
36
|
-
}],
|
|
37
|
-
}],
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Show/update search header dynamically via ref
|
|
42
|
-
screenRef.current?.setSearchHeader({
|
|
43
|
-
placeholder: 'Search...',
|
|
44
|
-
onChangeText: setQuery,
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### ScreenRef Methods
|
|
49
|
-
|
|
50
|
-
| Method | Signature | Description |
|
|
51
|
-
|--------|-----------|-------------|
|
|
52
|
-
| `setOptions` | `(params: NavigationOptions) => void` | Update header options dynamically |
|
|
53
|
-
| `setSearchHeader` | `(params: SearchHeaderProps) => void` | Show/update the search header |
|
|
54
|
-
|
|
55
|
-
### NavigationOptions Props
|
|
56
|
-
|
|
57
|
-
| Prop | Type | Default | Description |
|
|
58
|
-
|------|------|---------|-------------|
|
|
59
|
-
| `headerTitle` | `string \| HeaderTitleProps` | — | Header title (string or custom type) |
|
|
60
|
-
| `hiddenBack` | `boolean` | `false` | Hide back button |
|
|
61
|
-
| `onPressLeftHeader` | `() => void` | — | Custom left button handler |
|
|
62
|
-
| `onBackHandler` | `(goBack: () => void) => void` | — | Intercept back navigation |
|
|
63
|
-
| `preventBack` | `PopupNotifyProps` | — | Show confirmation dialog on back |
|
|
64
|
-
| `headerRight` | `HeaderRightToolkit \| OnBoarding` | — | Right header configuration |
|
|
65
|
-
|
|
66
|
-
Also extends `StackNavigationOptions` from `@react-navigation/stack` (supports `headerStyle`, `headerTintColor`, `headerTransparent`, etc.)
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## Header Title Types
|
|
71
|
-
|
|
72
|
-
### Default (string)
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
screenRef.current?.setOptions({ headerTitle: 'My Screen' });
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### User Title
|
|
79
|
-
|
|
80
|
-
Shows avatar, name, subtitle, verification icons.
|
|
81
|
-
|
|
82
|
-
```tsx
|
|
83
|
-
screenRef.current?.setOptions({
|
|
84
|
-
headerTitle: {
|
|
85
|
-
type: 'user',
|
|
86
|
-
data: {
|
|
87
|
-
title: 'John Doe',
|
|
88
|
-
subTitle: 'Online',
|
|
89
|
-
image: 'https://avatar.url', // string or string[]
|
|
90
|
-
dotColor: '#4CAF50', // status indicator
|
|
91
|
-
icons: ['https://verified.icon'], // verification badges
|
|
92
|
-
tintColor: theme.colors.text.default,
|
|
93
|
-
onPress: () => openProfile(),
|
|
94
|
-
isLoading: false, // show skeleton
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
| Prop | Type | Description |
|
|
101
|
-
|------|------|-------------|
|
|
102
|
-
| `title` | `string` | User name (required) |
|
|
103
|
-
| `subTitle` | `string` | Subtitle text |
|
|
104
|
-
| `image` | `string \| string[]` | Avatar URL(s) |
|
|
105
|
-
| `dotColor` | `string` | Status dot color |
|
|
106
|
-
| `icons` | `string[]` | Verification badge URLs |
|
|
107
|
-
| `tintColor` | `string` | Text tint color |
|
|
108
|
-
| `onPress` | `() => void` | Tap handler |
|
|
109
|
-
| `isLoading` | `boolean` | Show skeleton placeholder |
|
|
110
|
-
| `verify` | `boolean` | Deprecated — use `icons` instead |
|
|
111
|
-
|
|
112
|
-
### Location Title
|
|
113
|
-
|
|
114
|
-
Shows location name with dropdown chevron.
|
|
115
|
-
|
|
116
|
-
```tsx
|
|
117
|
-
screenRef.current?.setOptions({
|
|
118
|
-
headerTitle: {
|
|
119
|
-
type: 'location',
|
|
120
|
-
data: {
|
|
121
|
-
location: 'Ho Chi Minh City',
|
|
122
|
-
description: 'Current location',
|
|
123
|
-
tintColor: theme.colors.text.default,
|
|
124
|
-
onPress: () => openLocationPicker(),
|
|
125
|
-
isLoading: false,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Journey Title
|
|
132
|
-
|
|
133
|
-
Shows start/end points with directional icon.
|
|
134
|
-
|
|
135
|
-
```tsx
|
|
136
|
-
screenRef.current?.setOptions({
|
|
137
|
-
headerTitle: {
|
|
138
|
-
type: 'journey',
|
|
139
|
-
data: {
|
|
140
|
-
start: 'District 1',
|
|
141
|
-
end: 'District 7',
|
|
142
|
-
description: '12 km',
|
|
143
|
-
icon: '16_arrow_right',
|
|
144
|
-
iconColor: theme.colors.primary,
|
|
145
|
-
tintColor: theme.colors.text.default,
|
|
146
|
-
onPress: () => editJourney(),
|
|
147
|
-
isLoading: false,
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Header Right
|
|
156
|
-
|
|
157
|
-
### Toolkit (default)
|
|
158
|
-
|
|
159
|
-
Shows help center + home/close buttons. Optionally adds shortcut pin and more menu.
|
|
160
|
-
|
|
161
|
-
```tsx
|
|
162
|
-
headerRight: {
|
|
163
|
-
useShortcut: true, // show pin/star or more icon
|
|
164
|
-
useMore: false, // force show more icon (overrides tool count)
|
|
165
|
-
useCloseIcon: false, // use X icon instead of home
|
|
166
|
-
preventClose: { ... }, // confirm before close (PopupNotifyProps)
|
|
167
|
-
tools: [
|
|
168
|
-
{
|
|
169
|
-
title: { vi: 'Nhóm', en: 'Group' },
|
|
170
|
-
items: [
|
|
171
|
-
{
|
|
172
|
-
icon: '24_share',
|
|
173
|
-
name: { vi: 'Chia sẻ', en: 'Share' },
|
|
174
|
-
key: 'share',
|
|
175
|
-
showBadge: false,
|
|
176
|
-
onPress: () => shareScreen(),
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
**Tool menu behavior:**
|
|
185
|
-
- 0 tools → shows only help + close
|
|
186
|
-
- 1 tool → shows single tool icon directly
|
|
187
|
-
- 2+ tools → shows `...` more menu
|
|
188
|
-
- `useMore: true` → forces `...` icon regardless of tool count
|
|
189
|
-
|
|
190
|
-
### OnBoarding
|
|
191
|
-
|
|
192
|
-
Shows a skip/action button text in the header right.
|
|
193
|
-
|
|
194
|
-
```tsx
|
|
195
|
-
headerRight: {
|
|
196
|
-
useOnBoarding: true,
|
|
197
|
-
buttonOnBoarding: 'Skip', // custom button label (default: translated 'skip')
|
|
198
|
-
onPress: () => skipOnboarding(),
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
| Prop | Type | Description |
|
|
203
|
-
|------|------|-------------|
|
|
204
|
-
| `useOnBoarding` | `boolean` | Enable onboarding mode |
|
|
205
|
-
| `onPress` | `() => void` | Button press handler |
|
|
206
|
-
| `buttonOnBoarding` | `string` | Custom button label (defaults to translated 'skip') |
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## Header Background
|
|
211
|
-
|
|
212
|
-
Configured via `Screen` component props, not `setOptions`.
|
|
213
|
-
|
|
214
|
-
```tsx
|
|
215
|
-
<Screen
|
|
216
|
-
ref={screenRef}
|
|
217
|
-
navigation={navigation}
|
|
218
|
-
headerType="default" // 'default' | 'extended' | 'none'
|
|
219
|
-
useShadowHeader={true} // shadow below header
|
|
220
|
-
headerBackground="https://bg.png" // custom background image
|
|
221
|
-
animatedHeader={{ // header collapses on scroll
|
|
222
|
-
headerTintColor: '#FFFFFF',
|
|
223
|
-
headerTitle: 'Animated Title',
|
|
224
|
-
component: (props) => <CustomHeader {...props} />,
|
|
225
|
-
}}
|
|
226
|
-
/>
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Header Types
|
|
230
|
-
|
|
231
|
-
| Type | Description |
|
|
232
|
-
|------|-------------|
|
|
233
|
-
| `'default'` | Standard header with title + back |
|
|
234
|
-
| `'extended'` | Taller header, supports search and collapse animation |
|
|
235
|
-
| `'none'` | No header |
|
|
236
|
-
|
|
237
|
-
### Search Header
|
|
238
|
-
|
|
239
|
-
Integrate search bar into the header.
|
|
240
|
-
|
|
241
|
-
```tsx
|
|
242
|
-
<Screen
|
|
243
|
-
headerType="extended"
|
|
244
|
-
inputSearchProps={{
|
|
245
|
-
placeholder: 'Search...',
|
|
246
|
-
onChangeText: setQuery,
|
|
247
|
-
headerRightWidth: 74,
|
|
248
|
-
leftPosition: 48,
|
|
249
|
-
hiddenBack: false,
|
|
250
|
-
buttonText: 'Cancel', // cancel button label (default: 'Huỷ')
|
|
251
|
-
onPressButtonText: () => clearSearch(), // cancel button handler
|
|
252
|
-
renderButtons: () => <FilterButton />,
|
|
253
|
-
}}
|
|
254
|
-
inputSearchRef={searchRef}
|
|
255
|
-
/>
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### SearchHeaderProps
|
|
259
|
-
|
|
260
|
-
| Prop | Type | Default | Description |
|
|
261
|
-
|------|------|---------|-------------|
|
|
262
|
-
| `placeholder` | `string` | — | Search input placeholder |
|
|
263
|
-
| `onChangeText` | `(text: string) => void` | — | Text change handler |
|
|
264
|
-
| `headerRightWidth` | `0 \| 74 \| 110 \| number` | `74` | Right header area width |
|
|
265
|
-
| `leftPosition` | `12 \| 48 \| number` | — | Left position offset |
|
|
266
|
-
| `hiddenBack` | `boolean` | — | Hide back button |
|
|
267
|
-
| `buttonText` | `string` | `'Huỷ'` | Cancel button label |
|
|
268
|
-
| `onPressButtonText` | `() => void` | — | Cancel button press handler |
|
|
269
|
-
| `renderButtons` | `() => ReactNode` | — | Custom buttons next to search |
|
|
270
|
-
|
|
271
|
-
---
|
|
272
|
-
|
|
273
|
-
## Design Spec `header` → React Native Code Mapping
|
|
274
|
-
|
|
275
|
-
When generating code from a design spec JSON, the `header.props` must be split across **two code targets**. Putting a prop in the wrong target produces broken headers.
|
|
276
|
-
|
|
277
|
-
### Target 1: `<Screen>` component props (JSX)
|
|
278
|
-
|
|
279
|
-
These control visual appearance and go directly on the Screen component.
|
|
280
|
-
|
|
281
|
-
| Spec `header.props` field | Screen prop | Example |
|
|
282
|
-
|---------------------------|------------|---------|
|
|
283
|
-
| `headerType` | `headerType` | `headerType="extended"` |
|
|
284
|
-
| `headerBackground` | `headerBackground` | `headerBackground="https://bg.png"` |
|
|
285
|
-
| `useShadowHeader` | `useShadowHeader` | `useShadowHeader={true}` |
|
|
286
|
-
| `layoutOffset` | `layoutOffset` | `layoutOffset={-56}` |
|
|
287
|
-
| `headerRightWidth` | `headerRightWidth` | `headerRightWidth={110}` |
|
|
288
|
-
|
|
289
|
-
### Target 2: `screenRef.current?.setOptions()` (imperative, in useEffect)
|
|
290
|
-
|
|
291
|
-
These control content/behavior and must be set via ref.
|
|
292
|
-
|
|
293
|
-
| Spec `header.props` field | setOptions prop | Transform |
|
|
294
|
-
|---------------------------|----------------|-----------|
|
|
295
|
-
| `useBack` | `hiddenBack` | **Invert**: `useBack: true` → `hiddenBack: false` |
|
|
296
|
-
| `headerTitle` | `headerTitle` | Pass object as-is: `{ type, data }` |
|
|
297
|
-
| `headerRight` | `headerRight` | Pass object as-is |
|
|
298
|
-
|
|
299
|
-
### Complete Spec → Code Example
|
|
300
|
-
|
|
301
|
-
**Spec:**
|
|
302
|
-
|
|
303
|
-
```json
|
|
304
|
-
{
|
|
305
|
-
"header": {
|
|
306
|
-
"type": "Header",
|
|
307
|
-
"props": {
|
|
308
|
-
"useBack": true,
|
|
309
|
-
"headerType": "extended",
|
|
310
|
-
"headerTitle": {
|
|
311
|
-
"type": "user",
|
|
312
|
-
"data": { "title": "{name}", "subTitle": "{phone}", "image": "{avatar}" }
|
|
313
|
-
},
|
|
314
|
-
"headerRight": {
|
|
315
|
-
"useShortcut": false,
|
|
316
|
-
"useMore": false,
|
|
317
|
-
"useCloseIcon": false,
|
|
318
|
-
"tools": [
|
|
319
|
-
{
|
|
320
|
-
"title": { "vi": "Tiện ích", "en": "Tools" },
|
|
321
|
-
"items": [
|
|
322
|
-
{ "icon": "24_help_center", "name": { "vi": "Trợ giúp", "en": "Help" }, "key": "help" },
|
|
323
|
-
{ "icon": "24_home", "name": { "vi": "Trang chủ", "en": "Home" }, "key": "home" }
|
|
324
|
-
]
|
|
325
|
-
}
|
|
326
|
-
]
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
**Generated code:**
|
|
334
|
-
|
|
335
|
-
```tsx
|
|
336
|
-
const screenRef = useRef<ScreenRef>(null);
|
|
337
|
-
|
|
338
|
-
// Target 2: setOptions in useEffect
|
|
339
|
-
useEffect(() => {
|
|
340
|
-
screenRef.current?.setOptions({
|
|
341
|
-
hiddenBack: false, // useBack: true → inverted
|
|
342
|
-
headerTitle: {
|
|
343
|
-
type: 'user',
|
|
344
|
-
data: { title: name, subTitle: phone, image: avatar },
|
|
345
|
-
},
|
|
346
|
-
headerRight: {
|
|
347
|
-
useShortcut: false,
|
|
348
|
-
useMore: false,
|
|
349
|
-
useCloseIcon: false,
|
|
350
|
-
tools: [
|
|
351
|
-
{
|
|
352
|
-
title: { vi: 'Tiện ích', en: 'Tools' },
|
|
353
|
-
items: [
|
|
354
|
-
{ icon: '24_help_center', name: { vi: 'Trợ giúp', en: 'Help' }, key: 'help' },
|
|
355
|
-
{ icon: '24_home', name: { vi: 'Trang chủ', en: 'Home' }, key: 'home' },
|
|
356
|
-
],
|
|
357
|
-
},
|
|
358
|
-
],
|
|
359
|
-
},
|
|
360
|
-
});
|
|
361
|
-
}, []);
|
|
362
|
-
|
|
363
|
-
// Target 1: Screen props in JSX
|
|
364
|
-
<Screen
|
|
365
|
-
ref={screenRef}
|
|
366
|
-
navigation={navigation}
|
|
367
|
-
headerType="extended" // from spec headerType
|
|
368
|
-
scrollable
|
|
369
|
-
>
|
|
370
|
-
{/* body */}
|
|
371
|
-
</Screen>
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
---
|
|
375
|
-
|
|
376
|
-
## Compose — setOptions
|
|
377
|
-
|
|
378
|
-
```kotlin
|
|
379
|
-
val navigation = LocalNavigation.current
|
|
380
|
-
|
|
381
|
-
LaunchedEffect(Unit) {
|
|
382
|
-
navigation.setOptions(
|
|
383
|
-
headerTitle = HeaderTitle.Default("Screen Title"),
|
|
384
|
-
headerType = HeaderType.Default(),
|
|
385
|
-
headerRight = HeaderRight.Toolkit(),
|
|
386
|
-
hiddenBack = false,
|
|
387
|
-
scrollData = ScrollData(scrollState = lazyListState),
|
|
388
|
-
backgroundColor = null,
|
|
389
|
-
tintColor = null,
|
|
390
|
-
footerComponent = { FooterContent() },
|
|
391
|
-
floatingButtonProps = FloatingButtonProps(
|
|
392
|
-
icon = "ic_plus",
|
|
393
|
-
label = "Add",
|
|
394
|
-
onClick = { },
|
|
395
|
-
),
|
|
396
|
-
onBackHandler = { },
|
|
397
|
-
)
|
|
398
|
-
}
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
### setOptions Parameters
|
|
402
|
-
|
|
403
|
-
| Param | Type | Description |
|
|
404
|
-
|-------|------|-------------|
|
|
405
|
-
| `headerTitle` | `HeaderTitle` | `HeaderTitle.Default("Title")` |
|
|
406
|
-
| `headerType` | `HeaderType` | See header types below |
|
|
407
|
-
| `headerRight` | `HeaderRight` | `HeaderRight.Toolkit()` |
|
|
408
|
-
| `hiddenBack` | `Boolean` | Hide back button |
|
|
409
|
-
| `scrollData` | `ScrollData` | Scroll state for header collapse |
|
|
410
|
-
| `backgroundColor` | `Color?` | Custom background color |
|
|
411
|
-
| `tintColor` | `Color?` | Header tint color |
|
|
412
|
-
| `footerComponent` | `@Composable () -> Unit` | Footer content |
|
|
413
|
-
| `floatingButtonProps` | `FloatingButtonProps?` | Floating action button |
|
|
414
|
-
| `onBackHandler` | `(() -> Unit)?` | Custom back handler |
|
|
415
|
-
|
|
416
|
-
### Compose Header Types
|
|
417
|
-
|
|
418
|
-
| Type | Description |
|
|
419
|
-
|------|-------------|
|
|
420
|
-
| `HeaderType.Default()` | Standard header with title + back |
|
|
421
|
-
| `HeaderType.Extended()` | Larger header (supports search) |
|
|
422
|
-
| `HeaderType.Animated()` | Collapses on scroll |
|
|
423
|
-
| `HeaderType.None` | No header |
|
|
424
|
-
|
|
425
|
-
### ScrollData
|
|
426
|
-
|
|
427
|
-
```kotlin
|
|
428
|
-
ScrollData(scrollable = true) // basic scrollable
|
|
429
|
-
ScrollData(scrollState = lazyListState) // triggers header collapse
|
|
430
|
-
```
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
# Navigator API
|
|
2
|
-
|
|
3
|
-
The `Navigator` class handles all screen transitions. Obtained from `ApplicationContext` (RN) or `LocalNavigator` (Compose).
|
|
4
|
-
|
|
5
|
-
## React Native
|
|
6
|
-
|
|
7
|
-
Access via `ApplicationContext`:
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
import { ApplicationContext } from '@momo-kits/foundation';
|
|
11
|
-
|
|
12
|
-
const { navigator } = useContext(ApplicationContext);
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### push (horizontal slide)
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
navigator.push({ screen: DetailScreen, itemId: 123 });
|
|
19
|
-
// With options:
|
|
20
|
-
navigator.push({
|
|
21
|
-
screen: DetailScreen,
|
|
22
|
-
options: { headerTitle: 'Detail' },
|
|
23
|
-
itemId: 123,
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### pop
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
navigator.pop(); // pop 1 screen
|
|
31
|
-
navigator.pop(2); // pop 2 screens
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### popToTop
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
navigator.popToTop(); // pop all screens to root
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### present (vertical slide — full-screen modal)
|
|
41
|
-
|
|
42
|
-
```tsx
|
|
43
|
-
navigator.present({ screen: FullScreenModal });
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### replace (replace current screen)
|
|
47
|
-
|
|
48
|
-
```tsx
|
|
49
|
-
navigator.replace({ screen: NewScreen, options: { headerTitle: 'New' } });
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### reset (reset navigation stack)
|
|
53
|
-
|
|
54
|
-
```tsx
|
|
55
|
-
navigator.reset({ screen: HomeScreen });
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### showModal (overlay dialog)
|
|
59
|
-
|
|
60
|
-
```tsx
|
|
61
|
-
navigator.showModal(
|
|
62
|
-
{
|
|
63
|
-
screen: PopupContent,
|
|
64
|
-
barrierDismissible: true,
|
|
65
|
-
onDismiss: () => {},
|
|
66
|
-
modalStyle: { backgroundColor: 'transparent' },
|
|
67
|
-
},
|
|
68
|
-
(error) => console.log(error), // optional onError
|
|
69
|
-
);
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
See `modal.md` for `ModalParams` details.
|
|
73
|
-
|
|
74
|
-
### showBottomSheet
|
|
75
|
-
|
|
76
|
-
```tsx
|
|
77
|
-
navigator.showBottomSheet(
|
|
78
|
-
{
|
|
79
|
-
screen: SheetContent,
|
|
80
|
-
options: { title: 'Sheet Title' },
|
|
81
|
-
surface: true,
|
|
82
|
-
draggable: true,
|
|
83
|
-
},
|
|
84
|
-
(error) => console.log(error), // optional onError
|
|
85
|
-
);
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
See `bottomsheet.md` for `BottomSheetParams` details.
|
|
89
|
-
|
|
90
|
-
### navigate (bottom tab only)
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
navigator.navigate('Home'); // switch to tab by route name
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### setDismissData / setCurrentContext
|
|
97
|
-
|
|
98
|
-
```tsx
|
|
99
|
-
navigator.setDismissData(data); // store data for dismiss callback
|
|
100
|
-
navigator.setCurrentContext({ // set app context for kit features
|
|
101
|
-
code: 'mini_app_code',
|
|
102
|
-
name: { vi: 'Tên', en: 'Name' },
|
|
103
|
-
description: { vi: 'Mô tả', en: 'Description' },
|
|
104
|
-
icon: 'ic_app',
|
|
105
|
-
});
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Type Reference
|
|
109
|
-
|
|
110
|
-
```tsx
|
|
111
|
-
type ScreenParams = {
|
|
112
|
-
screen: React.ComponentType<NavigationScreenProps>; // required — component, not string
|
|
113
|
-
options?: NavigationOptions;
|
|
114
|
-
[key: string]: any; // additional params passed as props
|
|
115
|
-
};
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Navigator vs Navigation
|
|
119
|
-
|
|
120
|
-
| Class | Scope | Access | Methods |
|
|
121
|
-
|-------|-------|--------|---------|
|
|
122
|
-
| `Navigator` | Global | `ApplicationContext.navigator` | `push`, `pop`, `present`, `replace`, `reset`, `showModal`, `showBottomSheet`, `popToTop`, `navigate` |
|
|
123
|
-
| `Navigation` | Per-screen | Injected as `navigation` prop | `setOptions(NavigationOptions)` |
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Compose
|
|
128
|
-
|
|
129
|
-
```kotlin
|
|
130
|
-
import vn.momo.kits.navigation.LocalNavigator
|
|
131
|
-
|
|
132
|
-
val navigator = LocalNavigator.current
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Push (horizontal slide)
|
|
136
|
-
|
|
137
|
-
```kotlin
|
|
138
|
-
navigator.push(
|
|
139
|
-
content = { DetailScreen(item) },
|
|
140
|
-
options = NavigationOptions(
|
|
141
|
-
headerTitle = HeaderTitle.Default("Detail"),
|
|
142
|
-
backgroundColor = Colors.black_02,
|
|
143
|
-
)
|
|
144
|
-
)
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Pop
|
|
148
|
-
|
|
149
|
-
```kotlin
|
|
150
|
-
navigator.pop() // pop 1 screen
|
|
151
|
-
navigator.pop(count = 2) // pop 2 screens
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Present (vertical slide — full-screen modal)
|
|
155
|
-
|
|
156
|
-
```kotlin
|
|
157
|
-
navigator.present(content = { FullScreenModal() })
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Replace (replace current screen)
|
|
161
|
-
|
|
162
|
-
```kotlin
|
|
163
|
-
navigator.replace(content = { NewScreen() })
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Reset (reset navigation stack)
|
|
167
|
-
|
|
168
|
-
```kotlin
|
|
169
|
-
navigator.reset(content = { HomeScreen() })
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Modal, BottomSheet, SnackBar
|
|
173
|
-
|
|
174
|
-
See dedicated reference files:
|
|
175
|
-
- `modal.md` — `navigator.showModal()`
|
|
176
|
-
- `bottomsheet.md` — `navigator.showBottomSheet()`
|
|
177
|
-
- `snackbar.md` (in components) — `navigator.showSnackBar()`
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Navigation Setup
|
|
2
|
-
|
|
3
|
-
## React Native — NavigationContainer
|
|
4
|
-
|
|
5
|
-
The `NavigationContainer` from `@momo-kits/foundation` is the root entry point that sets up the navigation stack, theme, and context providers.
|
|
6
|
-
|
|
7
|
-
### NavigationContainerProps
|
|
8
|
-
|
|
9
|
-
| Prop | Type | Default | Description |
|
|
10
|
-
|------|------|---------|-------------|
|
|
11
|
-
| `screen` | `React.ComponentType<NavigationScreenProps>` | required | Root screen component |
|
|
12
|
-
| `maxApi` | `any` | required | MaxApi instance for native bridge |
|
|
13
|
-
| `localize` | `LocalizeProps` | required | Localization: `{ getCurrentLanguage, getAssets, translate, translateData, addTranslations }` |
|
|
14
|
-
| `theme` | `Theme` | `defaultTheme` | Theme object (light/dark colors, font) |
|
|
15
|
-
| `options` | `NavigationOptions` | — | Default navigation options for root screen |
|
|
16
|
-
| `initialParams` | `any` | — | Initial params passed to the root screen |
|
|
17
|
-
| `features` | `FeatureFlags` | — | Feature flags (see below) |
|
|
18
|
-
|
|
19
|
-
### FeatureFlags
|
|
20
|
-
|
|
21
|
-
| Flag | Type | Description |
|
|
22
|
-
|------|------|-------------|
|
|
23
|
-
| `enableFoundationList` | `boolean` | Enable FoundationList component |
|
|
24
|
-
| `enableBottomTabAnimation` | `boolean` | Enable bottom tab animations |
|
|
25
|
-
| `enableHapticBottomTab` | `boolean` | Enable haptic feedback on tab press |
|
|
26
|
-
| `enableHapticDialog` | `boolean` | Enable haptic feedback on dialog show |
|
|
27
|
-
| `showBaseLineDebug` | `boolean` | Show baseline debug overlay |
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Compose — ComposeAppContainer (App Root)
|
|
31
|
-
|
|
32
|
-
Prefer `ComposeAppContainer` (from parent project — auto KitConfig, Language, IMaxApi via Koin). Fallback to `NavigationContainer`.
|
|
33
|
-
|
|
34
|
-
```kotlin
|
|
35
|
-
// ComposeAppContainer — import from parent project, e.g. vn.momo.compose.container.ComposeAppContainer
|
|
36
|
-
ComposeAppContainer(
|
|
37
|
-
initialScreen = { HomeScreen() },
|
|
38
|
-
options = NavigationOptions(headerTitle = HeaderTitle.Default("My App")),
|
|
39
|
-
initialTheme = defaultTheme,
|
|
40
|
-
applicationContext = MiniAppContext(...),
|
|
41
|
-
)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Fallback — `NavigationContainer`:
|
|
45
|
-
|
|
46
|
-
```kotlin
|
|
47
|
-
NavigationContainer(
|
|
48
|
-
initialScreen = { HomeScreen() },
|
|
49
|
-
initialTheme = defaultTheme,
|
|
50
|
-
)
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Screen-level Navigation
|
|
54
|
-
|
|
55
|
-
Inside NavigationContainer scope:
|
|
56
|
-
|
|
57
|
-
```kotlin
|
|
58
|
-
val navigation = LocalNavigation.current
|
|
59
|
-
val navigator = LocalNavigator.current
|
|
60
|
-
|
|
61
|
-
navigation.setOptions(...) // header, scroll, footer, FAB
|
|
62
|
-
navigator.push { DetailScreen() }
|
|
63
|
-
navigator.pop()
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Best Practices
|
|
67
|
-
|
|
68
|
-
1. One container per Fragment — don't nest containers
|
|
69
|
-
2. Prefer `ComposeAppContainer` over `NavigationContainer`
|
|
70
|
-
3. Use `LaunchedEffect(Unit)` for `setOptions` — set options when screen loads
|
|
71
|
-
4. Connect scroll state early — `ScrollData(scrollState = lazyListState)` triggers header collapse
|
|
72
|
-
5. No padding in `footerComponent` — container provides standard padding
|
|
73
|
-
|
|
74
|
-
## CompositionLocal Providers
|
|
75
|
-
|
|
76
|
-
| Provider | Access | Purpose |
|
|
77
|
-
|----------|--------|---------|
|
|
78
|
-
| `AppTheme` | `AppTheme.current` | Current theme (light/dark) |
|
|
79
|
-
| `AppStatusBar` | `AppStatusBar.current` | Status bar height (Dp) |
|
|
80
|
-
| `AppNavigationBar` | `AppNavigationBar.current` | Nav bar height (Dp) |
|
|
81
|
-
| `ApplicationContext` | `ApplicationContext.current` | MiniApp context |
|
|
82
|
-
| `LocalNavigator` | `LocalNavigator.current` | Navigator instance |
|
|
83
|
-
| `LocalNavigation` | `LocalNavigation.current` | Screen-level navigation |
|
|
84
|
-
|
|
85
|
-
## Custom Modifiers
|
|
86
|
-
|
|
87
|
-
```kotlin
|
|
88
|
-
import vn.momo.kits.modifier.*
|
|
89
|
-
|
|
90
|
-
Modifier.conditional(condition) { background(Colors.pink_03) }
|
|
91
|
-
Modifier.activeOpacityClickable(activeOpacity = 0.8f) { onClick() }
|
|
92
|
-
Modifier.shadow(color = Colors.black_20.copy(alpha = 0.1f), blurRadius = 16f)
|
|
93
|
-
Modifier.setAutomationId("my_component")
|
|
94
|
-
```
|