@momo-kits/native-kits 0.162.14-debug → 0.162.15-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/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +4 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +11 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +14 -24
- package/gradle.properties +1 -1
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -16,6 +16,10 @@ class Navigation(
|
|
|
16
16
|
val currentOptions: State<NavigationOptions> get() = _options
|
|
17
17
|
val options: NavigationOptions get() = _options.value
|
|
18
18
|
|
|
19
|
+
private val _isBottomTabRoot = mutableStateOf(false)
|
|
20
|
+
internal val isBottomTabRoot: Boolean get() = _isBottomTabRoot.value
|
|
21
|
+
internal fun markAsBottomTabRoot() { _isBottomTabRoot.value = true }
|
|
22
|
+
|
|
19
23
|
fun setOptions(
|
|
20
24
|
onBackHandler: (() -> Unit)? = null,
|
|
21
25
|
hiddenBack: Boolean? = null,
|
|
@@ -96,6 +96,8 @@ internal fun StackScreen(
|
|
|
96
96
|
val navigation = remember { Navigation(id = id, bottomTabIndex = bottomTabIndex, initOptions = navigationOptions, registry = screenRegistry) }
|
|
97
97
|
|
|
98
98
|
val options by navigation.currentOptions
|
|
99
|
+
val isBottomTabChild = bottomTabIndex != -1
|
|
100
|
+
val isBottomTabRoot = navigation.isBottomTabRoot
|
|
99
101
|
|
|
100
102
|
// Auto tracking state
|
|
101
103
|
val trackingState = remember {
|
|
@@ -193,7 +195,7 @@ internal fun StackScreen(
|
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
Column(Modifier.zIndex(2f).fillMaxSize()) {
|
|
196
|
-
MainContent(content = content)
|
|
198
|
+
MainContent(content = content, isBottomTab = isBottomTabRoot)
|
|
197
199
|
FooterContent()
|
|
198
200
|
}
|
|
199
201
|
|
|
@@ -201,7 +203,7 @@ internal fun StackScreen(
|
|
|
201
203
|
FloatingContent()
|
|
202
204
|
}
|
|
203
205
|
|
|
204
|
-
OverplayView(
|
|
206
|
+
OverplayView(isBottomTabChild = isBottomTabChild, id = id)
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
}
|
|
@@ -213,10 +215,11 @@ internal fun FloatingContent() {
|
|
|
213
215
|
val density = LocalDensity.current
|
|
214
216
|
val footerHeightPx = LocalFooterHeightPx.current
|
|
215
217
|
val scrollState = LocalScrollState.current
|
|
218
|
+
val navigationBar = AppNavigationBar.current
|
|
216
219
|
|
|
217
220
|
val fabProps = options.floatingButtonProps ?: return
|
|
218
221
|
val bottomPadding = fabProps.bottom
|
|
219
|
-
?: (Spacing.M + if (options.footerComponent != null) with(density) { footerHeightPx.intValue.toDp() } else
|
|
222
|
+
?: (Spacing.M + if (options.footerComponent != null) with(density) { footerHeightPx.intValue.toDp() } else navigationBar)
|
|
220
223
|
|
|
221
224
|
FloatingButton(
|
|
222
225
|
scrollPosition = fabProps.scrollState?.value ?: scrollState.value,
|
|
@@ -232,11 +235,12 @@ internal fun FloatingContent() {
|
|
|
232
235
|
}
|
|
233
236
|
|
|
234
237
|
@Composable
|
|
235
|
-
internal fun ColumnScope.MainContent(content: @Composable () -> Unit) {
|
|
238
|
+
internal fun ColumnScope.MainContent(content: @Composable () -> Unit, isBottomTab: Boolean) {
|
|
236
239
|
val options = LocalOptions.current
|
|
237
240
|
val inputSearchType = getInputSearchType(options)
|
|
238
241
|
val density = LocalDensity.current
|
|
239
242
|
val scrollState = LocalScrollState.current
|
|
243
|
+
val navigationBar = AppNavigationBar.current
|
|
240
244
|
|
|
241
245
|
Spacer(
|
|
242
246
|
Modifier.height(
|
|
@@ -260,6 +264,7 @@ internal fun ColumnScope.MainContent(content: @Composable () -> Unit) {
|
|
|
260
264
|
.conditional(options.scrollData.scrollable && options.scrollData.scrollState is ScrollState) {
|
|
261
265
|
verticalScroll(scrollState)
|
|
262
266
|
}
|
|
267
|
+
.padding(bottom = if (options.footerComponent != null || isBottomTab) 0.dp else navigationBar)
|
|
263
268
|
) {
|
|
264
269
|
ScreenContent(content = content)
|
|
265
270
|
}
|
|
@@ -303,12 +308,12 @@ internal fun keyboardSizeState(): State<Dp> {
|
|
|
303
308
|
}
|
|
304
309
|
|
|
305
310
|
@Composable
|
|
306
|
-
internal fun OverplayView(
|
|
311
|
+
internal fun OverplayView(isBottomTabChild: Boolean, id: Int) {
|
|
307
312
|
val overplayType = OverplayComponentRegistry.getOverplayType()
|
|
308
313
|
|
|
309
314
|
if (overplayType != null) {
|
|
310
315
|
Box(Modifier.zIndex(if (overplayType == OverplayComponentType.SNACK_BAR) 3f else 7f).fillMaxSize()) {
|
|
311
|
-
if (
|
|
316
|
+
if (isBottomTabChild) return@Box
|
|
312
317
|
if (OverplayComponentRegistry.currentRootId() != id) return@Box
|
|
313
318
|
OverplayComponentRegistry.OverlayComponent()
|
|
314
319
|
}
|
|
@@ -44,8 +44,6 @@ fun BottomTab(
|
|
|
44
44
|
val navigation = LocalNavigation.current
|
|
45
45
|
val navigator = LocalNavigator.current
|
|
46
46
|
val navController = rememberNavController()
|
|
47
|
-
val keyboardBottomPadding = WindowInsets.ime.asPaddingValues().calculateBottomPadding()
|
|
48
|
-
val shouldShowBottomTab = keyboardBottomPadding == 0.dp
|
|
49
47
|
|
|
50
48
|
bottomTabOptionItems = items.mapIndexed { index, item ->
|
|
51
49
|
item.options ?: NavigationOptions()
|
|
@@ -53,6 +51,7 @@ fun BottomTab(
|
|
|
53
51
|
|
|
54
52
|
|
|
55
53
|
LaunchedEffect(Unit){
|
|
54
|
+
navigation.markAsBottomTabRoot()
|
|
56
55
|
navigation.setOptions(
|
|
57
56
|
headerType = HeaderType.None
|
|
58
57
|
)
|
|
@@ -61,13 +60,6 @@ fun BottomTab(
|
|
|
61
60
|
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.BottomCenter) {
|
|
62
61
|
Box(modifier = Modifier
|
|
63
62
|
.fillMaxSize()
|
|
64
|
-
.padding(
|
|
65
|
-
bottom = if (shouldShowBottomTab) {
|
|
66
|
-
BOTTOM_TAB_BAR_HEIGHT.dp + AppNavigationBar.current
|
|
67
|
-
} else {
|
|
68
|
-
0.dp
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
63
|
) {
|
|
72
64
|
NavHost(
|
|
73
65
|
navController = navController,
|
|
@@ -126,22 +118,20 @@ fun BottomTab(
|
|
|
126
118
|
}
|
|
127
119
|
}
|
|
128
120
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
navController.navigate(targetRoute)
|
|
140
|
-
}
|
|
121
|
+
Column {
|
|
122
|
+
BottomTabBar(
|
|
123
|
+
items = items,
|
|
124
|
+
floatingButton = floatingButton,
|
|
125
|
+
navController = navController,
|
|
126
|
+
onTabSelected = {
|
|
127
|
+
val currentRoute = navController.currentBackStackEntry?.destination?.route
|
|
128
|
+
val targetRoute = "option$it"
|
|
129
|
+
if (currentRoute != targetRoute) {
|
|
130
|
+
navController.navigate(targetRoute)
|
|
141
131
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
Spacer(modifier = Modifier.fillMaxWidth().height(AppNavigationBar.current + Spacing.S).background(AppTheme.current.colors.background.surface))
|
|
145
135
|
}
|
|
146
136
|
}
|
|
147
137
|
}
|
package/gradle.properties
CHANGED