Decompose: Navigation does not work on chrome ios

Only occurs on chrome for mobile ios devices. After debugging, it appears the issue is that routerState.activeChild.instance does not update after child is created.

//This code does not get executed.

Crossfade(
            target = routerState.activeChild.instance, 
            attrs = {
                style {
                    width(100.percent)
                    height(100.percent)
                    position(Position.Relative)
                    left(0.px)
                    top(0.px)
                }
            }
        ) { child ->
            when (child) {
                is Nav.Child.Splash -> Splash(component)
                is Nav.Child.Inbox -> ChatUI(component)
                is Nav.Child.Home -> Home(component)
                is Nav.Child.HomePage -> HomePage(component)
        }
    }
`

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 32 (18 by maintainers)

Most upvoted comments

I will release a new version today.

Hopefully by the end of the week.

@amuna I have checked the second issue - basically, you should implement getConfiguration function properly. This is required for DefaultWebHistoryController so it could recreated configurations for each path. Please see an example.

Something as follows, just an example for those two configurations, but you need all of them:

        webHistoryController?.attach(
            router = router,
            getPath = { "/${it.route}" },
            getConfiguration = {
                when (it) {
                    "/Signup" -> Config.Signup()
                    "/SignUp" -> Config.HomePage()
                    else -> error("Unknown route: $it")
                }
            }
        )

Please also mind some limitations and a corner case (not affecting this particular case, but still good to be aware of).

I will send one shortly.