@momo-kits/native-kits 0.162.27-debug → 0.162.28-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.27-debug"
43
+ version = "0.162.28-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.16-debug'
3
+ spec.version = '0.163.1-beta.10'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -1,6 +1,6 @@
1
1
  package vn.momo.kits.layout
2
2
 
3
- import androidx.compose.foundation.layout.Box
3
+ import androidx.compose.foundation.layout.Column
4
4
  import androidx.compose.foundation.layout.height
5
5
  import androidx.compose.foundation.layout.width
6
6
  import androidx.compose.runtime.Composable
@@ -32,5 +32,7 @@ internal fun Item(
32
32
  m = m.width(grid.sizeForSpan(widthSpan))
33
33
  if (heightSpan > 0) m = m.height(grid.sizeForSpan(heightSpan))
34
34
  }
35
- Box(modifier = m) { content() }
35
+ // A Column (not a Box) so multiple children flow VERTICALLY instead of stacking
36
+ // on top of each other — matches the React Item's flex-column content.
37
+ Column(modifier = m) { content() }
36
38
  }
@@ -28,6 +28,7 @@ import androidx.compose.runtime.remember
28
28
  import androidx.compose.runtime.rememberCoroutineScope
29
29
  import androidx.compose.ui.Alignment
30
30
  import androidx.compose.ui.Modifier
31
+ import androidx.compose.ui.graphics.Brush
31
32
  import androidx.compose.ui.graphics.Color
32
33
  import androidx.compose.ui.input.pointer.pointerInput
33
34
  import androidx.compose.ui.platform.LocalDensity
@@ -57,6 +58,9 @@ internal fun BottomSheet(
57
58
  header: BottomHeader,
58
59
  isSurface: Boolean = false,
59
60
  barrierDismissible: Boolean = true,
61
+ draggable: Boolean = true,
62
+ useBottomInset: Boolean = true,
63
+ footerComponent: (@Composable () -> Unit)? = null,
60
64
  onDismiss: (() -> Unit)?
61
65
  ) {
62
66
  val screenHeightDp = getScreenHeight()
@@ -161,30 +165,35 @@ internal fun BottomSheet(
161
165
  .noFeedbackClickable { },
162
166
  contentAlignment = Alignment.BottomCenter
163
167
  ) {
164
- Column(Modifier.padding(bottom = AppNavigationBar.current)) {
168
+ val bottomInset = if (useBottomInset) {
169
+ (AppNavigationBar.current - keyboardSizeState().value).coerceAtLeast(0.dp)
170
+ } else 0.dp
171
+ Column(Modifier.padding(bottom = bottomInset)) {
165
172
  Box(
166
173
  modifier = Modifier
167
174
  .height(72.dp)
168
175
  .fillMaxWidth()
169
- .pointerInput(Unit) {
170
- detectDragGestures(
171
- onDrag = { change, dragAmount ->
172
- change.consume()
173
- coroutineScope.launch {
174
- val newOffset = (sheetOffset.value + dragAmount.y).coerceAtLeast(0f)
175
- sheetOffset.snapTo(newOffset)
176
- }
177
- },
178
- onDragEnd = {
179
- coroutineScope.launch {
180
- if (sheetOffset.value > sheetCloseOffset) {
181
- closeEvent()
182
- } else {
183
- sheetOffset.animateTo(0f)
176
+ .conditional(draggable) {
177
+ pointerInput(Unit) {
178
+ detectDragGestures(
179
+ onDrag = { change, dragAmount ->
180
+ change.consume()
181
+ coroutineScope.launch {
182
+ val newOffset = (sheetOffset.value + dragAmount.y).coerceAtLeast(0f)
183
+ sheetOffset.snapTo(newOffset)
184
+ }
185
+ },
186
+ onDragEnd = {
187
+ coroutineScope.launch {
188
+ if (sheetOffset.value > sheetCloseOffset) {
189
+ closeEvent()
190
+ } else {
191
+ sheetOffset.animateTo(0f)
192
+ }
184
193
  }
185
194
  }
186
- }
187
- )
195
+ )
196
+ }
188
197
  }
189
198
  ) {
190
199
  Column(
@@ -235,12 +244,50 @@ internal fun BottomSheet(
235
244
  }
236
245
  }
237
246
  Divider()
238
- content()
247
+ if (footerComponent != null) {
248
+ Box(Modifier.weight(1f, fill = false)) {
249
+ content()
250
+ }
251
+ BottomSheetFooter(footerComponent)
252
+ } else {
253
+ content()
254
+ }
239
255
  }
240
256
  }
241
257
  }
242
258
  }
243
259
 
260
+ @Composable
261
+ private fun BottomSheetFooter(footerComponent: @Composable () -> Unit) {
262
+ val shadowBrush = remember {
263
+ Brush.verticalGradient(
264
+ colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.05f))
265
+ )
266
+ }
267
+
268
+ Box {
269
+ Box(
270
+ Modifier
271
+ .fillMaxWidth()
272
+ .background(AppTheme.current.colors.background.surface)
273
+ .conditional(IsShowBaseLineDebug) {
274
+ border(1.dp, Colors.blue_03)
275
+ }
276
+ .padding(vertical = Spacing.S)
277
+ ) {
278
+ footerComponent()
279
+ }
280
+
281
+ Box(
282
+ modifier = Modifier
283
+ .fillMaxWidth()
284
+ .height(6.dp)
285
+ .offset(x = 0.dp, y = (-6).dp)
286
+ .background(shadowBrush)
287
+ )
288
+ }
289
+ }
290
+
244
291
  sealed class BottomHeader {
245
292
  data class Title(
246
293
  val data: String = "Bottom Sheet Title",
@@ -139,10 +139,13 @@ class Navigator(
139
139
  isSurface: Boolean = false,
140
140
  barrierDismissible: Boolean = true,
141
141
  onDismiss: (() -> Unit)? = null,
142
- bottomSheetHeader: BottomHeader? = null
142
+ bottomSheetHeader: BottomHeader? = null,
143
+ draggable: Boolean = true,
144
+ useBottomInset: Boolean = true,
145
+ footerComponent: (@Composable () -> Unit)? = null
143
146
  ){
144
147
  val id = currentScreen()?.id ?: -1
145
- OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.BOTTOM_SHEET, isSurface, barrierDismissible, onDismiss, bottomSheetHeader)
148
+ OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.BOTTOM_SHEET, isSurface, barrierDismissible, onDismiss, bottomSheetHeader, draggable, useBottomInset, footerComponent)
146
149
  }
147
150
 
148
151
  fun showSnackBar(snackBar: SnackBar, onDismiss: (() -> Unit)? = null) {
@@ -257,6 +260,9 @@ sealed class OverplayComponentParams {
257
260
  val onDismiss: (() -> Unit)? = null,
258
261
  val barrierDismissible: Boolean = true,
259
262
  val bottomSheetHeader: BottomHeader? = null,
263
+ val draggable: Boolean = true,
264
+ val useBottomInset: Boolean = true,
265
+ val footerComponent: (@Composable () -> Unit)? = null,
260
266
  ) : OverplayComponentParams()
261
267
 
262
268
  class SnackBar : OverplayComponentParams()
@@ -288,10 +294,13 @@ object OverplayComponentRegistry {
288
294
  barrierDismissible: Boolean = true,
289
295
  onDismiss: (() -> Unit)?,
290
296
  bottomSheetHeader: BottomHeader? = null,
297
+ draggable: Boolean = true,
298
+ useBottomInset: Boolean = true,
299
+ footerComponent: (@Composable () -> Unit)? = null,
291
300
  ){
292
301
  val params = when(type){
293
302
  OverplayComponentType.MODAL -> OverplayComponentParams.Modal(onDismiss, barrierDismissible)
294
- OverplayComponentType.BOTTOM_SHEET -> OverplayComponentParams.BottomSheet(isSurface, onDismiss, barrierDismissible, bottomSheetHeader)
303
+ OverplayComponentType.BOTTOM_SHEET -> OverplayComponentParams.BottomSheet(isSurface, onDismiss, barrierDismissible, bottomSheetHeader, draggable, useBottomInset, footerComponent)
295
304
  OverplayComponentType.SNACK_BAR -> OverplayComponentParams.SnackBar()
296
305
  }
297
306
 
@@ -333,6 +342,9 @@ object OverplayComponentRegistry {
333
342
  header = params.bottomSheetHeader ?: Title(),
334
343
  isSurface = params.isSurface,
335
344
  barrierDismissible = params.barrierDismissible,
345
+ draggable = params.draggable,
346
+ useBottomInset = params.useBottomInset,
347
+ footerComponent = params.footerComponent,
336
348
  onDismiss = params.onDismiss
337
349
  )
338
350
  }
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.27
21
+ version=0.162.28
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.27-debug",
3
+ "version": "0.162.28-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},