@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.
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.162.14-debug"
43
+ version = "0.162.15-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.163.1-beta.1'
3
+ spec.version = '0.162.1-beta.4'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -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(bottomTabIndex = bottomTabIndex, id = id)
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 0.dp)
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(bottomTabIndex: Int, id: Int) {
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 (bottomTabIndex != -1) return@Box
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
- if (shouldShowBottomTab) {
130
- Column {
131
- BottomTabBar(
132
- items = items,
133
- floatingButton = floatingButton,
134
- navController = navController,
135
- onTabSelected = {
136
- val currentRoute = navController.currentBackStackEntry?.destination?.route
137
- val targetRoute = "option$it"
138
- if (currentRoute != targetRoute) {
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
- Spacer(modifier = Modifier.fillMaxWidth().height(AppNavigationBar.current + Spacing.S).background(AppTheme.current.colors.background.surface))
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
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.162.14
21
+ version=0.162.15
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.162.14-debug",
3
+ "version": "0.162.15-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},