@momo-kits/native-kits 0.113.3-beta.4 → 0.113.3-beta.5

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.
@@ -33,7 +33,7 @@ fun AnimationSearchInput(
33
33
  ) {
34
34
  Box(
35
35
  modifier = Modifier
36
- .height(52.dp)
36
+ .height(HEADER_HEIGHT.dp)
37
37
  .padding(vertical = Spacing.S)
38
38
  .zIndex(1f)
39
39
  ) {
@@ -85,13 +85,13 @@ fun Header(
85
85
 
86
86
  if (headerType != HeaderType.NONE) {
87
87
  BoxWithConstraints(
88
- Modifier.height(statusBarHeight + 52.dp)
88
+ Modifier.height(statusBarHeight + HEADER_HEIGHT.dp)
89
89
  .fillMaxWidth()
90
90
  .zIndex(10f),
91
91
  contentAlignment = Alignment.BottomCenter
92
92
  ) {
93
93
  Row(
94
- modifier = Modifier.height(52.dp)
94
+ modifier = Modifier.height(HEADER_HEIGHT.dp)
95
95
  .fillMaxWidth()
96
96
  .padding(horizontal = Spacing.M),
97
97
  verticalAlignment = Alignment.CenterVertically,
@@ -140,7 +140,7 @@ fun Header(
140
140
 
141
141
  // Title
142
142
  Row(
143
- modifier = Modifier.height(52.dp)
143
+ modifier = Modifier.height(HEADER_HEIGHT.dp)
144
144
  .fillMaxWidth()
145
145
  .padding(horizontal = Spacing.M),
146
146
  verticalAlignment = Alignment.CenterVertically,
@@ -153,10 +153,15 @@ fun Header(
153
153
  } else {
154
154
  Box(
155
155
  Modifier.weight(1f).graphicsLayer {
156
- alpha = if (searchAnimationEnable) 1f - (opacity) else 1f
156
+ alpha = if (useAnimationSearch) {
157
+ 1f - (opacity)
158
+ } else {
159
+ if (animatedHeader !== null) opacity else 1f
160
+ }
157
161
  },
158
162
  contentAlignment = if (titlePosition == TitlePosition.LEFT) Alignment.TopStart else Alignment.Center
159
163
  ) {
164
+
160
165
  HeaderTitle(
161
166
  title = title,
162
167
  color = tintIconColor,
@@ -38,7 +38,7 @@ fun HeaderBackground(
38
38
  val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
39
39
 
40
40
  val opacityAni by animateFloatAsState(
41
- targetValue = (1 - (scrollState / 52f)).coerceIn(0f, 1f),
41
+ targetValue = (1 - (scrollState / HEADER_HEIGHT*1f)).coerceIn(0f, 1f),
42
42
  )
43
43
 
44
44
  val backgroundColor by animateColorAsState(
@@ -24,7 +24,7 @@ fun HeaderDefault(
24
24
  opacityAni: Float,
25
25
  statusBarHeight: Dp,
26
26
  ) {
27
- val height = statusBarHeight + 52.dp
27
+ val height = statusBarHeight + HEADER_HEIGHT.dp
28
28
  Box(
29
29
  modifier = Modifier.fillMaxWidth().height(height)
30
30
  .background(AppTheme.current.colors.background.surface)
@@ -1,18 +1,10 @@
1
1
  package vn.momo.kits.application
2
2
 
3
- import androidx.compose.animation.animateColorAsState
4
- import androidx.compose.animation.core.animateFloatAsState
5
3
  import androidx.compose.foundation.background
6
4
  import androidx.compose.foundation.layout.Box
7
5
  import androidx.compose.foundation.layout.fillMaxWidth
8
6
  import androidx.compose.foundation.layout.height
9
- import androidx.compose.foundation.layout.offset
10
- import androidx.compose.foundation.layout.padding
11
- import androidx.compose.foundation.layout.width
12
- import androidx.compose.foundation.shape.RoundedCornerShape
13
7
  import androidx.compose.runtime.Composable
14
- import androidx.compose.runtime.getValue
15
- import androidx.compose.ui.Alignment
16
8
  import androidx.compose.ui.Modifier
17
9
  import androidx.compose.ui.draw.alpha
18
10
  import androidx.compose.ui.geometry.Offset
@@ -22,16 +14,9 @@ import androidx.compose.ui.layout.ContentScale
22
14
  import androidx.compose.ui.platform.LocalDensity
23
15
  import androidx.compose.ui.unit.Dp
24
16
  import androidx.compose.ui.unit.dp
25
- import androidx.compose.ui.zIndex
26
17
  import vn.momo.kits.components.Image
27
- import vn.momo.kits.components.InputSearch
28
- import vn.momo.kits.components.InputSearchProps
29
18
  import vn.momo.kits.components.Options
30
19
  import vn.momo.kits.const.AppTheme
31
- import vn.momo.kits.const.Colors
32
- import vn.momo.kits.const.Radius
33
- import vn.momo.kits.const.Spacing
34
- import vn.momo.kits.platform.getScreenDimensions
35
20
  import vn.momo.kits.utils.bottomBorder
36
21
 
37
22
  @Composable
@@ -78,7 +63,7 @@ fun HeaderExtended(
78
63
  modifier = Modifier
79
64
  .fillMaxWidth()
80
65
  .alpha(1f - opacityAni)
81
- .height(statusBarHeight + 52.dp)
66
+ .height(statusBarHeight + HEADER_HEIGHT.dp)
82
67
  .background(
83
68
  AppTheme.current.colors.background.surface
84
69
  )
@@ -47,6 +47,8 @@ enum class HeaderType {
47
47
  NONE
48
48
  }
49
49
 
50
+ const val HEADER_HEIGHT = 52
51
+
50
52
  @Composable
51
53
  fun Screen(
52
54
  backgroundColor: Color? = null,
@@ -85,7 +87,7 @@ fun Screen(
85
87
  val bottomPadding = min(indicator, 21.dp)
86
88
 
87
89
  val opacity by animateFloatAsState(
88
- targetValue = ((scrollState.value / 52f)).coerceIn(0f, 1f),
90
+ targetValue = ((scrollState.value / HEADER_HEIGHT*1f)).coerceIn(0f, 1f),
89
91
  )
90
92
 
91
93
  val headerAnimated =
@@ -123,6 +125,7 @@ fun Screen(
123
125
  headerRightWidth = headerRightWidth,
124
126
  goBack = goBack,
125
127
  opacity = opacity,
128
+ animatedHeader = animatedHeader,
126
129
  inputSearchProps = inputSearchProps,
127
130
  scrollState = scrollState.value,
128
131
  useAnimationSearch = useAnimationSearch,
@@ -130,7 +133,7 @@ fun Screen(
130
133
 
131
134
  Column(
132
135
  modifier = Modifier.fillMaxSize()
133
- .padding(top = if (headerType !== HeaderType.NONE) statusBarHeight + 52.dp else 0.dp)
136
+ .padding(top = if (animatedHeader === null && headerType !== HeaderType.NONE) statusBarHeight + HEADER_HEIGHT.dp else 0.dp)
134
137
  .pointerInput(Unit) {
135
138
  detectTapGestures(onTap = {
136
139
  keyboardController?.hide()
@@ -138,6 +141,7 @@ fun Screen(
138
141
  }
139
142
  .zIndex(1f),
140
143
  ) {
144
+
141
145
  Column(
142
146
  modifier = Modifier
143
147
  .conditional(scrollable) { weight(1f) }
@@ -153,11 +157,11 @@ fun Screen(
153
157
  headerAnimated()
154
158
  Column {
155
159
  if (animatedHeader !== null) {
156
- Spacer(modifier = Modifier.padding(top = statusBarHeight + 52.dp + layoutOffset))
160
+ Spacer(modifier = Modifier.padding(top = statusBarHeight + HEADER_HEIGHT.dp + layoutOffset))
157
161
  }
158
162
 
159
163
  if (useAnimationSearch && inputSearchProps != null && headerType == HeaderType.EXTENDED) {
160
- Spacer(modifier = Modifier.padding(top = statusBarHeight))
164
+ Spacer(modifier = Modifier.padding(top = (HEADER_HEIGHT.dp + Spacing.M)))
161
165
  }
162
166
  content()
163
167
  }
@@ -42,18 +42,18 @@ fun useHeaderSearchAnimation(
42
42
  )
43
43
 
44
44
  val animatedTranslateX by animateFloatAsState(
45
- targetValue = (scrollState / 52f).coerceIn(0f, 1f) * (leftPosition.value - 12) + 12,
45
+ targetValue = (scrollState / HEADER_HEIGHT*1f).coerceIn(0f, 1f) * (leftPosition.value - 12) + 12,
46
46
  )
47
47
 
48
48
  val animatedWidth by animateFloatAsState(
49
- targetValue = (scrollState / 52f).coerceIn(
49
+ targetValue = (scrollState / HEADER_HEIGHT*1f).coerceIn(
50
50
  0f,
51
51
  1f
52
52
  ) * ((searchWidth - leftPosition.value - headerRightWidth.value + 12) - searchWidth) + searchWidth,
53
53
  )
54
54
 
55
55
  val animatedTranslateY by animateFloatAsState(
56
- targetValue = (1 - (scrollState / 52f).coerceIn(0f, 1f)) * 52
56
+ targetValue = (1 - (scrollState / HEADER_HEIGHT* 1f).coerceIn(0f, 1f)) * HEADER_HEIGHT
57
57
  )
58
58
  return HeaderAnimations(
59
59
  opacity = opacityAni,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.113.3-beta.4",
3
+ "version": "0.113.3-beta.5",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},