@momo-kits/native-kits 0.89.1-rc.1 → 0.89.3

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.
@@ -32,6 +32,7 @@ import vn.momo.kits.components.Icon
32
32
  import vn.momo.kits.components.Image
33
33
  import vn.momo.kits.components.Options
34
34
  import vn.momo.kits.components.Text
35
+ import vn.momo.kits.const.AppStatusBar
35
36
  import vn.momo.kits.const.AppTheme
36
37
  import vn.momo.kits.const.Colors
37
38
  import vn.momo.kits.const.Spacing
@@ -47,10 +48,9 @@ fun HeaderImage(
47
48
  headerType: HeaderType = HeaderType.DEFAULT,
48
49
  headerBackground: String?,
49
50
  ) {
50
- val systemBarsPadding = WindowInsets.systemBars.asPaddingValues()
51
51
  when (headerType) {
52
52
  HeaderType.DEFAULT -> {
53
- val height = systemBarsPadding.calculateTopPadding() + 52.dp
53
+ val height = AppStatusBar.current + 52.dp
54
54
  Image(
55
55
  source = headerBackground ?: "",
56
56
  modifier = Modifier.fillMaxWidth().height(height),
@@ -86,7 +86,6 @@ fun Header(
86
86
  headerRight: @Composable (() -> Unit)? = null,
87
87
  goBack: (() -> Unit) = { },
88
88
  ) {
89
- val systemBarsPadding = WindowInsets.systemBars.asPaddingValues()
90
89
  var tintIconColor = Colors.black_01
91
90
  var backgroundButton = Colors.black_20.copy(alpha = 0.4f)
92
91
  if (headerType == HeaderType.SURFACE) {
@@ -96,7 +95,7 @@ fun Header(
96
95
 
97
96
  if (headerType != HeaderType.NONE) {
98
97
  BoxWithConstraints(
99
- Modifier.height(systemBarsPadding.calculateTopPadding() + 52.dp)
98
+ Modifier.height(AppStatusBar.current + 52.dp)
100
99
  .background(backgroundColor)
101
100
  .fillMaxWidth()
102
101
  .bottomBorder(
@@ -4,8 +4,11 @@ import androidx.compose.foundation.background
4
4
  import androidx.compose.foundation.clickable
5
5
  import androidx.compose.foundation.interaction.MutableInteractionSource
6
6
  import androidx.compose.foundation.layout.Box
7
+ import androidx.compose.foundation.layout.WindowInsets
8
+ import androidx.compose.foundation.layout.asPaddingValues
7
9
  import androidx.compose.foundation.layout.fillMaxSize
8
10
  import androidx.compose.foundation.layout.padding
11
+ import androidx.compose.foundation.layout.systemBars
9
12
  import androidx.compose.material.ExperimentalMaterialApi
10
13
  import androidx.compose.runtime.Composable
11
14
  import androidx.compose.runtime.CompositionLocalProvider
@@ -14,6 +17,7 @@ import androidx.compose.runtime.staticCompositionLocalOf
14
17
  import androidx.compose.ui.Alignment
15
18
  import androidx.compose.ui.Modifier
16
19
  import androidx.compose.ui.graphics.Color
20
+ import androidx.compose.ui.unit.Dp
17
21
  import androidx.compose.ui.unit.dp
18
22
  import cafe.adriel.voyager.core.screen.Screen
19
23
  import cafe.adriel.voyager.navigator.LocalNavigator
@@ -21,6 +25,7 @@ import cafe.adriel.voyager.navigator.bottomSheet.BottomSheetNavigator
21
25
  import cafe.adriel.voyager.navigator.bottomSheet.LocalBottomSheetNavigator
22
26
  import cafe.adriel.voyager.navigator.currentOrThrow
23
27
  import cafe.adriel.voyager.transitions.SlideTransition
28
+ import vn.momo.kits.const.AppStatusBar
24
29
  import vn.momo.kits.const.AppTheme
25
30
  import vn.momo.kits.const.Spacing
26
31
  import vn.momo.kits.const.Theme
@@ -87,10 +92,12 @@ class Navigator(
87
92
  @Composable
88
93
  fun ApplicationContainer(
89
94
  theme: Theme = defaultTheme,
95
+ statusBarHeight: Dp = WindowInsets.systemBars.asPaddingValues().calculateTopPadding(),
90
96
  content: @Composable () -> Unit,
91
97
  ) {
92
98
  CompositionLocalProvider(
93
99
  AppTheme provides theme,
100
+ AppStatusBar provides statusBarHeight,
94
101
  ) {
95
102
  BottomSheetNavigator(sheetBackgroundColor = Color.Transparent, sheetElevation = 0.dp) {
96
103
  cafe.adriel.voyager.navigator.Navigator(MainScreen {
@@ -46,6 +46,7 @@ fun Screen(
46
46
  title: String = "Stack",
47
47
  titlePosition: TitlePosition = TitlePosition.LEFT,
48
48
  goBack: (() -> Unit) = { },
49
+ scrollable: Boolean = true,
49
50
  footer: @Composable (() -> Unit)? = null,
50
51
  headerRight: @Composable (() -> Unit)? = null,
51
52
  content: @Composable () -> Unit,
@@ -80,8 +81,9 @@ fun Screen(
80
81
  )
81
82
 
82
83
  Column(
83
- Modifier.weight(1f).padding(bottom = avoidKeyboard)
84
- .verticalScroll(rememberScrollState()),
84
+ modifier = if (scrollable) Modifier.weight(1f).padding(bottom = avoidKeyboard)
85
+ .verticalScroll(rememberScrollState()) else
86
+ Modifier.padding(bottom = avoidKeyboard),
85
87
  verticalArrangement = verticalArrangement,
86
88
  horizontalAlignment = horizontalAlignment
87
89
  ) {
@@ -2,6 +2,7 @@ package vn.momo.kits.const
2
2
 
3
3
  import androidx.compose.runtime.staticCompositionLocalOf
4
4
  import androidx.compose.ui.graphics.Color
5
+ import androidx.compose.ui.unit.dp
5
6
 
6
7
  data class Background(
7
8
  val default: Color,
@@ -166,4 +167,7 @@ val darkTheme = Theme(
166
167
  )
167
168
 
168
169
 
169
- val AppTheme = staticCompositionLocalOf { defaultTheme }
170
+ val AppTheme = staticCompositionLocalOf { defaultTheme }
171
+ val AppStatusBar = staticCompositionLocalOf {
172
+ 0.dp
173
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.89.1-rc.1",
3
+ "version": "0.89.3",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},
@@ -1,2 +0,0 @@
1
- package vn.momo.kits.utils
2
-