@momo-kits/native-kits 0.164.1-beta.17-debug → 0.164.1-beta.18-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.164.1-beta.17-debug"
43
+ version = "0.164.1-beta.18-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.164.1-beta.17-debug'
3
+ spec.version = '0.164.1-beta.18-debug'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -10,3 +10,7 @@ import androidx.compose.runtime.remember
10
10
  // Revisit if androidx.activity >= 1.12 is adopted; this then becomes a copy of the iOS actual.
11
11
  @Composable
12
12
  actual fun rememberBackGestureProgress(): State<Float?> = remember { mutableStateOf(null) }
13
+
14
+ // No host-owned edge recogniser on Android: the system back gesture drives NavHost directly, so
15
+ // there is nothing to hand over.
16
+ actual fun reportFloatingArrowBack(shouldUse: Boolean) = Unit
@@ -8,12 +8,14 @@ import androidx.compose.animation.scaleOut
8
8
  import androidx.compose.foundation.background
9
9
  import androidx.compose.foundation.layout.*
10
10
  import androidx.compose.runtime.Composable
11
+ import androidx.compose.runtime.DisposableEffect
11
12
  import androidx.compose.runtime.LaunchedEffect
12
13
  import androidx.compose.ui.Alignment
13
14
  import androidx.compose.ui.Modifier
14
15
  import androidx.compose.ui.unit.dp
15
16
  import androidx.navigation.compose.NavHost
16
17
  import androidx.navigation.compose.composable
18
+ import androidx.navigation.compose.currentBackStackEntryAsState
17
19
  import androidx.navigation.compose.rememberNavController
18
20
  import vn.momo.kits.const.AppNavigationBar
19
21
  import vn.momo.kits.const.AppTheme
@@ -24,6 +26,7 @@ import vn.momo.kits.navigation.LocalNavigator
24
26
  import vn.momo.kits.navigation.NavigationOptions
25
27
  import vn.momo.kits.navigation.StackScreen
26
28
  import vn.momo.kits.navigation.component.HeaderType
29
+ import vn.momo.kits.platform.reportFloatingArrowBack
27
30
 
28
31
  private var bottomTabOptionItems : MutableList<NavigationOptions?> = mutableListOf()
29
32
  internal fun setBottomTabOption(index: Int, options: NavigationOptions){
@@ -59,6 +62,22 @@ fun BottomTab(
59
62
  )
60
63
  }
61
64
 
65
+ /**
66
+ * Matches the React Native side. On the first tab the host replays its drag into NavHost and
67
+ * the stack transition seeks as usual. On any other tab it must not: every tab lives inside
68
+ * this one stack card, so seeking it would take them all instead of returning to the first
69
+ * tab, which is what `onBackHandler` below does. Hand that case to the host's floating-arrow
70
+ * interaction rather than leaving the swipe to do the wrong thing.
71
+ */
72
+ val currentRoute = navController.currentBackStackEntryAsState().value?.destination?.route
73
+ val isFirstTab = currentRoute == null || currentRoute == "option0"
74
+
75
+ DisposableEffect(isFirstTab) {
76
+ reportFloatingArrowBack(!isFirstTab)
77
+ // the flag lives on the host and would otherwise outlive the tabs that asked for it
78
+ onDispose { reportFloatingArrowBack(false) }
79
+ }
80
+
62
81
  Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.BottomCenter) {
63
82
  Box(modifier = Modifier
64
83
  .fillMaxSize()
@@ -13,3 +13,12 @@ import androidx.compose.runtime.State
13
13
  */
14
14
  @Composable
15
15
  expect fun rememberBackGestureProgress(): State<Float?>
16
+
17
+ /**
18
+ * Reports whether the host should run its floating-arrow back instead of the seeked stack
19
+ * transition. Set while a bottom tab other than the first one is showing.
20
+ *
21
+ * Android is a no-op: its NavHost pops through `androidx.activity`'s dispatcher and there is no
22
+ * host interaction to hand the gesture to.
23
+ */
24
+ expect fun reportFloatingArrowBack(shouldUse: Boolean)
@@ -38,6 +38,18 @@ object HostBackGestureBridge {
38
38
  val hasEnabledHandlers: Boolean
39
39
  get() = attachedInputs.lastOrNull()?.hasEnabledHandlers == true
40
40
 
41
+ /**
42
+ * Whether the host should run its floating-arrow interaction instead of replaying the drag
43
+ * here. Set while a bottom tab other than the first one is showing: every tab lives inside a
44
+ * single stack card, so seeking that card would take all of them with it rather than
45
+ * returning to the first tab. Read it when the recogniser begins — the kit keeps it current.
46
+ *
47
+ * Mirrors `MiniAppModule.setShouldUseFloatingArrowBack` on the React Native side, so both
48
+ * stacks hand the same case to the same host interaction.
49
+ */
50
+ var shouldUseFloatingArrowBack: Boolean = false
51
+ internal set
52
+
41
53
  /** Begins a drag. Pairs with exactly one [completed] or [cancelled]. */
42
54
  fun started() {
43
55
  val input = attachedInputs.lastOrNull() ?: return
@@ -8,6 +8,7 @@ import androidx.compose.runtime.remember
8
8
  import androidx.compose.ui.InternalComposeUiApi
9
9
  import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
10
10
  import androidx.navigationevent.NavigationEventTransitionState
11
+ import vn.momo.kits.navigation.HostBackGestureBridge
11
12
 
12
13
  // NavigationEventDispatcher.transitionState is a passive observer: UIKitNavigationEventInput
13
14
  // publishes every edge-pan event to it without any handler consuming the gesture. Its `progress`
@@ -33,3 +34,9 @@ actual fun rememberBackGestureProgress(): State<Float?> {
33
34
 
34
35
  return progress
35
36
  }
37
+
38
+ // The host pulls this when its recogniser begins, so a plain assignment is enough -- no dispatch,
39
+ // no observer. Kept next to the progress observer since both are the same host contract.
40
+ actual fun reportFloatingArrowBack(shouldUse: Boolean) {
41
+ HostBackGestureBridge.shouldUseFloatingArrowBack = shouldUse
42
+ }
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.164.1-beta.17
21
+ version=0.164.1-beta.18
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.164.1-beta.17'
3
+ s.version = '0.164.1-beta.18'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.164.1-beta.17'
3
+ s.version = '0.164.1-beta.18'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.164.1-beta.17-debug",
3
+ "version": "0.164.1-beta.18-debug",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},
7
7
  "license": "MoMo"
8
- }
8
+ }