@momo-kits/native-kits 0.160.1-searchinput.2-debug → 0.160.1-test.1-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/.claude/settings.local.json +15 -0
- package/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +4 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +14 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +16 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +8 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +14 -1
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +11 -7
- package/gradle.properties +1 -1
- package/local.properties +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(yarn react-native:*)",
|
|
5
|
+
"Read(//Users/phuc/.claude/skills/ai-skill-generator/**)",
|
|
6
|
+
"Bash(python3 scripts/install_skill.py --update)",
|
|
7
|
+
"Bash(cd /Users/phuc/momo-kits/.claude/skills/design-system-kits && mkdir -p .claude/skills/design-system-kits && mv SKILL.md README.md references .claude/skills/design-system-kits/)",
|
|
8
|
+
"Bash(mv .claude/skills/design-system-kits/* . && rmdir .claude/skills/design-system-kits && rmdir .claude/skills)",
|
|
9
|
+
"WebFetch(domain:via.placeholder.com)",
|
|
10
|
+
"WebFetch(domain:image.tmdb.org)",
|
|
11
|
+
"WebFetch(domain:placehold.co)",
|
|
12
|
+
"WebFetch(domain:dummyimage.com)"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -70,13 +70,14 @@ actual fun getScreenHeight(): Dp {
|
|
|
70
70
|
return getScreenDimensions().height.dp + if (getOSVersion() >= 35) 0.dp else AppStatusBar.current + AppNavigationBar.current
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
actual fun getOSVersion():
|
|
73
|
+
actual fun getOSVersion(): OSVersion = OSVersion.Android(sdk = Build.VERSION.SDK_INT)
|
|
74
74
|
|
|
75
75
|
@Composable
|
|
76
76
|
actual fun LottieAnimation(
|
|
77
77
|
path: String,
|
|
78
78
|
tintColor: Color?,
|
|
79
79
|
bgColor: Color?,
|
|
80
|
+
placedAsOverlay: Boolean,
|
|
80
81
|
modifier: Modifier
|
|
81
82
|
) {
|
|
82
83
|
val json = readJson(path)
|
|
@@ -59,8 +59,9 @@ import vn.momo.kits.modifier.DeprecatedModifier
|
|
|
59
59
|
import vn.momo.kits.modifier.conditional
|
|
60
60
|
import vn.momo.kits.modifier.shadow
|
|
61
61
|
import vn.momo.kits.navigation.component.SnackBar
|
|
62
|
-
import vn.momo.kits.platform.
|
|
62
|
+
import vn.momo.kits.platform.supportsImePadding
|
|
63
63
|
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
64
|
+
import vn.momo.kits.utils.getNavigationBarHeight
|
|
64
65
|
|
|
65
66
|
enum class HeaderType {
|
|
66
67
|
DEFAULT,
|
|
@@ -102,7 +103,7 @@ fun Screen(
|
|
|
102
103
|
val keyboardController = LocalSoftwareKeyboardController.current
|
|
103
104
|
|
|
104
105
|
val isKeyboardVisible = isKeyboardVisible()
|
|
105
|
-
val indicator =
|
|
106
|
+
val indicator = getNavigationBarHeight()
|
|
106
107
|
val bottomPadding = if (isKeyboardVisible) 0.dp else indicator
|
|
107
108
|
|
|
108
109
|
val headerHeight = if (animatedHeader !== null)
|
|
@@ -134,7 +135,7 @@ fun Screen(
|
|
|
134
135
|
Box(
|
|
135
136
|
Modifier.fillMaxSize()
|
|
136
137
|
.background(backgroundColor ?: AppTheme.current.colors.background.default)
|
|
137
|
-
.conditional(useAvoidKeyboard &&
|
|
138
|
+
.conditional(useAvoidKeyboard && supportsImePadding()) {
|
|
138
139
|
imePadding()
|
|
139
140
|
}.then(DeprecatedModifier())
|
|
140
141
|
) {
|
|
@@ -105,8 +105,6 @@ data class InputSearchProps(
|
|
|
105
105
|
val iconModifier: Modifier = Modifier,
|
|
106
106
|
val onClearPress: () -> Unit = {},
|
|
107
107
|
val leftPosition: Dp? = null,
|
|
108
|
-
val placeholderCustomRender: (@Composable () -> Unit)? = null,
|
|
109
|
-
val searchIcon: (@Composable () -> Unit)? = null
|
|
110
108
|
)
|
|
111
109
|
|
|
112
110
|
@Composable
|
|
@@ -147,13 +145,12 @@ fun InputSearch(
|
|
|
147
145
|
)
|
|
148
146
|
}
|
|
149
147
|
|
|
150
|
-
Row(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
.
|
|
155
|
-
|
|
156
|
-
}
|
|
148
|
+
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier
|
|
149
|
+
.fillMaxWidth()
|
|
150
|
+
.height(36.dp)
|
|
151
|
+
.conditional(IsShowBaseLineDebug) {
|
|
152
|
+
border(1.dp, Colors.blue_03)
|
|
153
|
+
}
|
|
157
154
|
) {
|
|
158
155
|
BasicTextField(
|
|
159
156
|
enabled = !inputSearchProps.disabled,
|
|
@@ -187,14 +184,13 @@ fun InputSearch(
|
|
|
187
184
|
horizontalArrangement = Arrangement.Start,
|
|
188
185
|
verticalAlignment = Alignment.CenterVertically
|
|
189
186
|
) {
|
|
190
|
-
|
|
191
187
|
Row(
|
|
192
188
|
modifier = Modifier.padding(
|
|
193
189
|
horizontal = Spacing.M
|
|
194
190
|
),
|
|
195
191
|
verticalAlignment = Alignment.CenterVertically
|
|
196
192
|
) {
|
|
197
|
-
|
|
193
|
+
Icon(
|
|
198
194
|
source = "navigation_search",
|
|
199
195
|
modifier = Modifier.padding(end = Spacing.XS),
|
|
200
196
|
size = 24.dp,
|
|
@@ -202,14 +198,13 @@ fun InputSearch(
|
|
|
202
198
|
)
|
|
203
199
|
Box(Modifier.weight(1f)) {
|
|
204
200
|
if (inputSearchProps.text.value.isEmpty()) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
)
|
|
201
|
+
Text(
|
|
202
|
+
text = inputSearchProps.placeholder,
|
|
203
|
+
style = placeHolderStyle,
|
|
204
|
+
maxLines = 1,
|
|
205
|
+
color = placeholderColor,
|
|
206
|
+
overflow = TextOverflow.Ellipsis
|
|
207
|
+
)
|
|
213
208
|
}
|
|
214
209
|
innerTextField()
|
|
215
210
|
}
|
|
@@ -49,7 +49,7 @@ fun NavigationContainer(
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
val startDestination = DynamicScreenRegistry.register(initialScreenName, initialScreen, options)
|
|
52
|
+
val startDestination = remember { DynamicScreenRegistry.register(initialScreenName, initialScreen, options) }
|
|
53
53
|
|
|
54
54
|
ProvideNavigationEventDispatcherOwner {
|
|
55
55
|
CompositionLocalProvider(
|
|
@@ -28,6 +28,13 @@ class Navigator(
|
|
|
28
28
|
) {
|
|
29
29
|
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
|
|
30
30
|
|
|
31
|
+
internal var currentScreenId: Int = -1
|
|
32
|
+
private set
|
|
33
|
+
|
|
34
|
+
internal fun setCurrentScreenId(id: Int) {
|
|
35
|
+
currentScreenId = id
|
|
36
|
+
}
|
|
37
|
+
|
|
31
38
|
fun push(screenName: String, content: @Composable () -> Unit, options: NavigationOptions? = null) {
|
|
32
39
|
val route = DynamicScreenRegistry.register(screenName, content, options)
|
|
33
40
|
navController.navigate(DynamicScreenRoute(route.id))
|
|
@@ -122,7 +129,9 @@ class Navigator(
|
|
|
122
129
|
barrierDismissible: Boolean = true,
|
|
123
130
|
onDismiss: (() -> Unit)? = null
|
|
124
131
|
){
|
|
125
|
-
|
|
132
|
+
// AI-GENERATED START: use per-Navigator currentScreenId; fall back to global registry if not yet set
|
|
133
|
+
val id = currentScreenId.takeIf { it != -1 } ?: DynamicScreenRegistry.getLatestScreen()?.id ?: -1
|
|
134
|
+
// AI-GENERATED END: use per-Navigator currentScreenId; fall back to global registry if not yet set
|
|
126
135
|
OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.MODAL, false, barrierDismissible, onDismiss)
|
|
127
136
|
}
|
|
128
137
|
|
|
@@ -133,12 +142,16 @@ class Navigator(
|
|
|
133
142
|
onDismiss: (() -> Unit)? = null,
|
|
134
143
|
bottomSheetHeader: BottomHeader? = null
|
|
135
144
|
){
|
|
136
|
-
|
|
145
|
+
// AI-GENERATED START: use per-Navigator currentScreenId; fall back to global registry if not yet set
|
|
146
|
+
val id = currentScreenId.takeIf { it != -1 } ?: DynamicScreenRegistry.getLatestScreen()?.id ?: -1
|
|
147
|
+
// AI-GENERATED END: use per-Navigator currentScreenId; fall back to global registry if not yet set
|
|
137
148
|
OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.BOTTOM_SHEET, isSurface, barrierDismissible, onDismiss, bottomSheetHeader)
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
fun showSnackBar(snackBar: SnackBar, onDismiss: (() -> Unit)? = null) {
|
|
141
|
-
|
|
152
|
+
// AI-GENERATED START: use per-Navigator currentScreenId; fall back to global registry if not yet set
|
|
153
|
+
val id = currentScreenId.takeIf { it != -1 } ?: DynamicScreenRegistry.getLatestScreen()?.id ?: -1
|
|
154
|
+
// AI-GENERATED END: use per-Navigator currentScreenId; fall back to global registry if not yet set
|
|
142
155
|
scope.launch {
|
|
143
156
|
OverplayComponentRegistry.registerOverplay(
|
|
144
157
|
id = id,
|
|
@@ -62,7 +62,7 @@ import vn.momo.kits.navigation.component.HeaderRight
|
|
|
62
62
|
import vn.momo.kits.navigation.component.HeaderType
|
|
63
63
|
import vn.momo.kits.navigation.component.InputSearchType
|
|
64
64
|
import vn.momo.kits.platform.BackHandler
|
|
65
|
-
import vn.momo.kits.platform.
|
|
65
|
+
import vn.momo.kits.platform.supportsImePadding
|
|
66
66
|
import vn.momo.kits.navigation.tracking.ScreenTracker
|
|
67
67
|
import vn.momo.kits.navigation.tracking.ScreenTrackingState
|
|
68
68
|
import kotlinx.coroutines.delay
|
|
@@ -90,6 +90,12 @@ internal fun StackScreen(
|
|
|
90
90
|
val density = LocalDensity.current
|
|
91
91
|
val navigation = remember { Navigation(id = id, bottomTabIndex = bottomTabIndex, initOptions = navigationOptions) }
|
|
92
92
|
|
|
93
|
+
if (bottomTabIndex == -1) {
|
|
94
|
+
LaunchedEffect(id) {
|
|
95
|
+
navigator.setCurrentScreenId(id)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
93
99
|
val options by navigation.currentOptions
|
|
94
100
|
|
|
95
101
|
// Auto tracking state
|
|
@@ -166,7 +172,7 @@ internal fun StackScreen(
|
|
|
166
172
|
.conditional(options.keyboardOptions.keyboardShouldPersistTaps) {
|
|
167
173
|
hideKeyboardOnTap()
|
|
168
174
|
}
|
|
169
|
-
.conditional(options.keyboardOptions.useAvoidKeyboard &&
|
|
175
|
+
.conditional(options.keyboardOptions.useAvoidKeyboard && supportsImePadding()) {
|
|
170
176
|
imePadding()
|
|
171
177
|
}
|
|
172
178
|
) {
|
|
@@ -30,13 +30,26 @@ expect fun ProvideNavigationEventDispatcherOwner(content: @Composable () -> Unit
|
|
|
30
30
|
@Composable
|
|
31
31
|
expect fun getScreenHeight(): Dp
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
sealed interface OSVersion {
|
|
34
|
+
val value: Int
|
|
35
|
+
data class Android(val sdk: Int) : OSVersion { override val value: Int get() = sdk }
|
|
36
|
+
data class IOS(val major: Int) : OSVersion { override val value: Int get() = major }
|
|
37
|
+
|
|
38
|
+
operator fun compareTo(other: Int): Int = value.compareTo(other)
|
|
39
|
+
}
|
|
40
|
+
expect fun getOSVersion(): OSVersion
|
|
41
|
+
|
|
42
|
+
fun supportsImePadding(): Boolean = when (val v = getOSVersion()) {
|
|
43
|
+
is OSVersion.Android -> v.sdk > 29
|
|
44
|
+
is OSVersion.IOS -> true
|
|
45
|
+
}
|
|
34
46
|
|
|
35
47
|
@Composable
|
|
36
48
|
expect fun LottieAnimation(
|
|
37
49
|
path: String,
|
|
38
50
|
tintColor: Color? = null,
|
|
39
51
|
bgColor: Color? = null,
|
|
52
|
+
placedAsOverlay: Boolean = false,
|
|
40
53
|
modifier: Modifier = Modifier
|
|
41
54
|
)
|
|
42
55
|
|
|
@@ -12,17 +12,19 @@ import androidx.compose.runtime.getValue
|
|
|
12
12
|
import androidx.compose.runtime.mutableStateOf
|
|
13
13
|
import androidx.compose.runtime.remember
|
|
14
14
|
import androidx.compose.runtime.setValue
|
|
15
|
+
import androidx.compose.ui.ExperimentalComposeUiApi
|
|
15
16
|
import androidx.compose.ui.InternalComposeUiApi
|
|
16
17
|
import androidx.compose.ui.Modifier
|
|
17
18
|
import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
|
|
18
19
|
import androidx.compose.ui.graphics.Color
|
|
19
20
|
import androidx.compose.ui.graphics.NativePaint
|
|
20
21
|
import androidx.compose.ui.graphics.toArgb
|
|
21
|
-
import androidx.compose.ui.interop.UIKitView
|
|
22
22
|
import androidx.compose.ui.semantics.SemanticsPropertyKey
|
|
23
23
|
import androidx.compose.ui.semantics.semantics
|
|
24
24
|
import androidx.compose.ui.unit.Dp
|
|
25
25
|
import androidx.compose.ui.unit.dp
|
|
26
|
+
import androidx.compose.ui.viewinterop.UIKitInteropProperties
|
|
27
|
+
import androidx.compose.ui.viewinterop.UIKitView
|
|
26
28
|
import cocoapods.lottie_ios.CompatibleAnimation
|
|
27
29
|
import cocoapods.lottie_ios.CompatibleAnimationKeypath
|
|
28
30
|
import cocoapods.lottie_ios.CompatibleAnimationView
|
|
@@ -85,16 +87,17 @@ actual fun getScreenHeight(): Dp {
|
|
|
85
87
|
return getScreenDimensions().height.dp
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
actual fun getOSVersion():
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
actual fun getOSVersion(): OSVersion = OSVersion.IOS(
|
|
91
|
+
major = UIDevice.currentDevice.systemVersion.substringBefore(".").toIntOrNull() ?: 0
|
|
92
|
+
)
|
|
91
93
|
|
|
92
|
-
@OptIn(ExperimentalForeignApi::class)
|
|
94
|
+
@OptIn(ExperimentalForeignApi::class, ExperimentalComposeUiApi::class)
|
|
93
95
|
@Composable
|
|
94
96
|
actual fun LottieAnimation(
|
|
95
97
|
path: String,
|
|
96
98
|
tintColor: Color?,
|
|
97
99
|
bgColor: Color?,
|
|
100
|
+
placedAsOverlay: Boolean,
|
|
98
101
|
modifier: Modifier
|
|
99
102
|
) {
|
|
100
103
|
var animation by remember { mutableStateOf<CompatibleAnimation?>(null) }
|
|
@@ -112,11 +115,12 @@ actual fun LottieAnimation(
|
|
|
112
115
|
Box(modifier) {
|
|
113
116
|
UIKitView(
|
|
114
117
|
modifier = Modifier.fillMaxSize(),
|
|
118
|
+
properties = UIKitInteropProperties(placedAsOverlay = placedAsOverlay),
|
|
115
119
|
factory = {
|
|
116
120
|
CompatibleAnimationView(value).apply {
|
|
117
121
|
translatesAutoresizingMaskIntoConstraints = true
|
|
118
122
|
|
|
119
|
-
setBackgroundColor(bgColor?.toUIColor() ?: UIColor.
|
|
123
|
+
setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
|
|
120
124
|
|
|
121
125
|
setLoopAnimationCount(-1.0)
|
|
122
126
|
setAnimationSpeed(1.0)
|
|
@@ -137,7 +141,7 @@ actual fun LottieAnimation(
|
|
|
137
141
|
},
|
|
138
142
|
|
|
139
143
|
update = { view ->
|
|
140
|
-
view.setBackgroundColor(bgColor?.toUIColor() ?: UIColor.
|
|
144
|
+
view.setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
|
|
141
145
|
|
|
142
146
|
if (tintColor != null) {
|
|
143
147
|
val uiColor = tintColor.toUIColor()
|
package/gradle.properties
CHANGED
package/local.properties
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Thu Oct 02 17:53:13 ICT 2025
|
|
8
|
+
sdk.dir=/Users/phuc/Library/Android/sdk
|