@momo-kits/native-kits 0.164.1-beta.18-debug → 0.164.1-beta.19-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.18-debug"
43
+ version = "0.164.1-beta.19-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.18-debug'
3
+ spec.version = '0.164.1-beta.19-debug'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -11,6 +11,4 @@ import androidx.compose.runtime.remember
11
11
  @Composable
12
12
  actual fun rememberBackGestureProgress(): State<Float?> = remember { mutableStateOf(null) }
13
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
14
  actual fun reportFloatingArrowBack(shouldUse: Boolean) = Unit
@@ -31,6 +31,11 @@ class Navigator(
31
31
  ) {
32
32
  private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
33
33
 
34
+ // Set by BottomTab while a tab other than the first is showing. currentScreen() reads the root
35
+ // back stack, so it never sees the nested tab NavHost — without this every back path except the
36
+ // header button pops the whole BottomTab screen instead of returning to the first tab.
37
+ internal var tabBackHandler: (() -> Unit)? = null
38
+
34
39
  private fun currentScreen(): DynamicScreen? {
35
40
  val entry = navController.currentBackStackEntry ?: return null
36
41
  val id = runCatching { entry.toRoute<DynamicScreenRoute>().id }.getOrNull()
@@ -52,6 +57,10 @@ class Navigator(
52
57
  }
53
58
 
54
59
  fun onBackSafe(callBack: (() -> Unit)? = null) {
60
+ tabBackHandler?.let {
61
+ it()
62
+ return
63
+ }
55
64
  val currentScreen = currentScreen()
56
65
  val options = currentScreen?.options
57
66
  if (options?.onBackHandler != null) {
@@ -62,20 +62,22 @@ fun BottomTab(
62
62
  )
63
63
  }
64
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
- */
65
+ // Tab 0 keeps the seeked transition; other tabs go to the host's floating arrow, since
66
+ // seeking this one card would take every tab with it. Matches RN.
72
67
  val currentRoute = navController.currentBackStackEntryAsState().value?.destination?.route
73
68
  val isFirstTab = currentRoute == null || currentRoute == "option0"
74
69
 
75
70
  DisposableEffect(isFirstTab) {
76
71
  reportFloatingArrowBack(!isFirstTab)
77
- // the flag lives on the host and would otherwise outlive the tabs that asked for it
78
- onDispose { reportFloatingArrowBack(false) }
72
+ // onBackSafe reads the root back stack, so it cannot see this nested NavHost on its own
73
+ navigator.tabBackHandler = if (isFirstTab) null else ({
74
+ navController.popBackStack(navController.graph.startDestinationRoute!!, false)
75
+ })
76
+ // both live outside this composition and would otherwise outlive these tabs
77
+ onDispose {
78
+ reportFloatingArrowBack(false)
79
+ navigator.tabBackHandler = null
80
+ }
79
81
  }
80
82
 
81
83
  Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.BottomCenter) {
@@ -14,11 +14,5 @@ import androidx.compose.runtime.State
14
14
  @Composable
15
15
  expect fun rememberBackGestureProgress(): State<Float?>
16
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
- */
17
+ /** Android is a no-op: no host-owned recogniser to hand the gesture to. */
24
18
  expect fun reportFloatingArrowBack(shouldUse: Boolean)
@@ -39,13 +39,9 @@ object HostBackGestureBridge {
39
39
  get() = attachedInputs.lastOrNull()?.hasEnabledHandlers == true
40
40
 
41
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.
42
+ * Set while a bottom tab other than the first is showing: every tab lives in one stack card,
43
+ * so seeking it would take them all instead of returning to the first tab. Host pulls this
44
+ * when its recogniser begins. Mirrors `MiniAppModule.setShouldUseFloatingArrowBack` on RN.
49
45
  */
50
46
  var shouldUseFloatingArrowBack: Boolean = false
51
47
  internal set
@@ -35,8 +35,6 @@ actual fun rememberBackGestureProgress(): State<Float?> {
35
35
  return progress
36
36
  }
37
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
38
  actual fun reportFloatingArrowBack(shouldUse: Boolean) {
41
39
  HostBackGestureBridge.shouldUseFloatingArrowBack = shouldUse
42
40
  }
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.18
21
+ version=0.164.1-beta.19
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.18'
3
+ s.version = '0.164.1-beta.19'
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.18'
3
+ s.version = '0.164.1-beta.19'
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.164.1-beta.18-debug",
3
+ "version": "0.164.1-beta.19-debug",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},