@momo-kits/native-kits 0.161.2-nocompotie.999-debug → 0.161.2-scrolltop.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/compose/build.gradle.kts
CHANGED
|
@@ -55,6 +55,8 @@ import androidx.compose.ui.unit.dp
|
|
|
55
55
|
import kotlinx.coroutines.flow.collect
|
|
56
56
|
import kotlinx.coroutines.flow.combine
|
|
57
57
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
|
58
|
+
import kotlinx.coroutines.launch
|
|
59
|
+
import androidx.compose.runtime.rememberCoroutineScope
|
|
58
60
|
import vn.momo.kits.const.Spacing
|
|
59
61
|
import vn.momo.kits.modifier.conditional
|
|
60
62
|
import vn.momo.kits.platform.getPlatformName
|
|
@@ -96,10 +98,12 @@ fun LazyColumnWithBouncing(
|
|
|
96
98
|
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
|
|
97
99
|
userScrollEnabled: Boolean = true,
|
|
98
100
|
pullRefreshState: PullToRefreshCustomState? = null,
|
|
101
|
+
scrollToTopOnStatusBarTap: Boolean = true,
|
|
99
102
|
content: LazyListScope.() -> Unit,
|
|
100
103
|
) {
|
|
101
104
|
val height = remember { mutableIntStateOf(0) }
|
|
102
105
|
val maxConstraint = remember { mutableIntStateOf(0) }
|
|
106
|
+
val scope = rememberCoroutineScope()
|
|
103
107
|
|
|
104
108
|
LaunchedEffect(Unit) {
|
|
105
109
|
val addOn = 1
|
|
@@ -119,6 +123,8 @@ fun LazyColumnWithBouncing(
|
|
|
119
123
|
}.collect()
|
|
120
124
|
}
|
|
121
125
|
|
|
126
|
+
|
|
127
|
+
|
|
122
128
|
val measureLayout =
|
|
123
129
|
remember<MeasureScope.(Measurable, Constraints) -> MeasureResult>(maxConstraint) {
|
|
124
130
|
{ m, c ->
|
|
@@ -1,33 +1,47 @@
|
|
|
1
1
|
package vn.momo.kits.navigation
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
|
-
import androidx.compose.runtime.
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import platform.
|
|
8
|
-
import platform.
|
|
4
|
+
import androidx.compose.runtime.remember
|
|
5
|
+
import androidx.compose.ui.viewinterop.UIKitView
|
|
6
|
+
import kotlinx.cinterop.ExperimentalForeignApi
|
|
7
|
+
import platform.CoreGraphics.CGPointMake
|
|
8
|
+
import platform.CoreGraphics.CGRectMake
|
|
9
|
+
import platform.CoreGraphics.CGSizeMake
|
|
10
|
+
import platform.UIKit.UIColor
|
|
11
|
+
import platform.UIKit.UIScrollView
|
|
12
|
+
import platform.UIKit.UIScrollViewDelegateProtocol
|
|
13
|
+
import platform.darwin.NSObject
|
|
14
|
+
import vn.momo.kits.platform.getScreenDimensions
|
|
9
15
|
|
|
10
|
-
private const val STATUS_BAR_TAPPED_NOTIFICATION = "statusBarSelected"
|
|
11
16
|
|
|
17
|
+
class ScrollToTopDelegate(private val callback: (() -> Unit)?) : NSObject(), UIScrollViewDelegateProtocol {
|
|
18
|
+
override fun scrollViewShouldScrollToTop(scrollView: UIScrollView): Boolean {
|
|
19
|
+
println("scrollViewShouldScrollToTop aaaaaaaaaaaa")
|
|
20
|
+
callback?.invoke()
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@OptIn(ExperimentalForeignApi::class)
|
|
12
26
|
@Composable
|
|
13
27
|
internal actual fun RegisterScrollToTop(callback: (() -> Unit)?) {
|
|
14
|
-
val
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
val width = getScreenDimensions().width
|
|
29
|
+
val scrollToTopDelegate = remember(callback) { ScrollToTopDelegate { callback?.invoke() } }
|
|
30
|
+
UIKitView(
|
|
31
|
+
factory = {
|
|
32
|
+
val scrollView = UIScrollView()
|
|
33
|
+
scrollView.setFrame(CGRectMake(0.0, 0.0, width.toDouble(), 2.0))
|
|
34
|
+
scrollView.setContentOffset(CGPointMake(0.0, 2.0))
|
|
35
|
+
scrollView.setContentSize(CGSizeMake(0.0, 3.0))
|
|
36
|
+
scrollView.backgroundColor = UIColor.redColor
|
|
37
|
+
scrollView.setScrollsToTop(true)
|
|
38
|
+
scrollView.setDelegate(
|
|
39
|
+
delegate = scrollToTopDelegate
|
|
40
|
+
)
|
|
41
|
+
scrollView
|
|
42
|
+
},
|
|
43
|
+
update = {
|
|
44
|
+
it.setDelegate(delegate = scrollToTopDelegate)
|
|
31
45
|
}
|
|
32
|
-
|
|
46
|
+
)
|
|
33
47
|
}
|
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.161.2-
|
|
21
|
+
version=0.161.2-scrolltop.1
|
|
22
22
|
|
|
23
23
|
repo=GitLab
|
|
24
24
|
url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
|