Sunil Kumar
06/27/2023, 5:09 AMArkadii Ivanov
06/27/2023, 8:35 AMAndrew Steinmetz
06/27/2023, 6:14 PMSunil Kumar
06/28/2023, 3:24 AMAndrew Steinmetz
06/28/2023, 3:41 AMAndrew Steinmetz
06/28/2023, 3:46 AMSunil Kumar
06/28/2023, 4:12 AMSunil Kumar
06/28/2023, 4:17 AMSunil Kumar
06/28/2023, 6:29 AMArkadii Ivanov
06/28/2023, 7:10 AMSunil Kumar
06/28/2023, 7:17 AMSunil Kumar
06/28/2023, 7:51 AMArkadii Ivanov
06/28/2023, 8:17 AMisFullscreen
flag to each child configuration and RootComponent.Child sealed class. This will allow displaying the bottom bar when needed, and having the same component on the stack as fullscreen and not fullscreen.Arkadii Ivanov
06/28/2023, 8:18 AMSunil Kumar
06/28/2023, 9:41 AMisFullscreen
flag in each config and sealed child classes and put all components in root component with separate platform implementation of Rootcomponent and usign that flag to show or hide botton bar, then how we will be handling the components which have nested navigations like home?
I have this flow currently:-
RootComponent -> BottomNavComponent & StoryComponent
BottomNavComponent -> Home, Search, Reels, History and Profile components each with nested navigation,
So now how i will manage these components with nested navigation.
Which components i will have to separate out according to platform, So that workaround will be applied in js only?Arkadii Ivanov
06/28/2023, 9:51 AMcommonMain
using isFullscreen
flag.
2. You implement your root component in JS and non-JS targets separately (two implementations), and use isFullscreen
flag only in JS.
If you go with isFullscreen
, then your root component will look something like this.
interface RootComponent {
val stack: Value<ChildStack<*, Child>>
sealed class Child {
abstract val isFullscreen: Boolean
class Story(val component: StoryComponent, override val isFullscreen: Boolean) : Child()
class Home(val component: HomeComponent, override val isFullscreen: Boolean) : Child()
class Search(val component: SearchComponent, override val isFullscreen: Boolean) : Child()
// ...
}
}
If you go platform specific, then you have the above root component in jsMain
, and the following in nonJsMain
.
interface RootComponent {
val stack: Value<ChildStack<*, Child>>
sealed class Child {
class Story(val component: StoryComponent) : Child()
class BottomNav(val component: BottomNavComponent) : Child()
// ...
}
}
interface BottomNavComponent {
sealed class Child {
class Home(val component: HomeComponent) : Child()
class Search(val component: HomeComponent) : Child()
// ...
}
}
Both RootComponent
and BottomNavComponent
are platform specific, and the rest (Home
, Search
, etc.) are in commonMain
.
Does it make sense?Sunil Kumar
06/28/2023, 9:58 AMArkadii Ivanov
06/28/2023, 10:01 AMArkadii Ivanov
06/28/2023, 10:01 AMcommonMain
first. Then see how it works. Then you can always move it to jsMain
and implement for nonJsMain
separately.Sunil Kumar
06/28/2023, 10:13 AMArkadii Ivanov
06/28/2023, 1:53 PMSunil Kumar
06/29/2023, 3:28 AMSunil Kumar
06/29/2023, 10:12 AMexpect class RootComponentImpl @OptIn(ExperimentalDecomposeApi::class) constructor(
componentContext: ComponentContext,
deepLink: DeepLink = DeepLink.None,
webHistoryController: WebHistoryController? = null,
) : RootComponent
ANd have there actual implementations in respective platform modules.
For all other platform its working fine, But in jsMain build i am getting following error:
java.lang.IllegalStateException: IdSignature clash: core.component/DeepLink.None|null[0]; Existed declaration CLASS OBJECT name:None modality:FINAL visibility:public superTypes:[core.component.DeepLink] clashed with new CLASS OBJECT name:None modality:FINAL visibility:public superTypes:[core.component.DeepLink]
at org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsUniqIdClashTracker.commit(JsDeclarationTable.kt:27)
at org.jetbrains.kotlin.backend.common.serialization.GlobalDeclarationTable.computeSignatureByDeclaration(DeclarationTable.kt:48)
at org.jetbrains.kotlin.backend.common.serialization.DeclarationTable.computeSignatureByDeclaration(DeclarationTable.kt:83)
at org.jetbrains.kotlin.backend.common.serialization.DeclarationTable.signatureByDeclaration(DeclarationTable.kt:92)
at org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer.protoIdSignature(IrFileSerializer.kt:290)
at org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer.serializeIrSymbol(IrFileSerializer.kt:353)
at org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer.serializeSimpleType(IrFileSerializer.kt:390)
at org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer.serializeIrTypeData(IrFileSerializer.kt:427)
at org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer.serializeIrType(IrFileSerializer.kt:494)
at org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer.serializeExpression(IrFileSerializer.kt:1006)
Any idea about this?Sunil Kumar
06/29/2023, 10:13 AMArkadii Ivanov
06/29/2023, 10:58 AMSunil Kumar
06/29/2023, 10:59 AMsealed interface DeepLink {
object None : DeepLink
class Web(val path: String) : DeepLink
}
Sunil Kumar
06/29/2023, 11:03 AMArkadii Ivanov
06/29/2023, 11:07 AMArkadii Ivanov
06/29/2023, 11:08 AMSunil Kumar
06/29/2023, 11:11 AMArkadii Ivanov
06/29/2023, 11:13 AMArkadii Ivanov
06/29/2023, 11:13 AMSunil Kumar
06/29/2023, 11:15 AMSunil Kumar
06/29/2023, 11:15 AMI assume you don't need to access root from commonMain
this one i didnt got?Arkadii Ivanov
06/29/2023, 11:17 AMRootComonentImpl
. One in jsMain
, and another one in a kinda nonJsMain
source set.Sunil Kumar
06/29/2023, 11:18 AMI assume you don't need to access root from commonMain
Do you mean root content ?Arkadii Ivanov
06/29/2023, 11:19 AMSunil Kumar
06/29/2023, 11:22 AM