FinTecSystems / xs2a-android

[Client] Native Android SDK for Tink Germany XS2A API.
https://tink.com/de/fts
Other
6 stars 4 forks source link

Compose Exception: disallowed infinity maximum height #2

Closed sebastianmarschall closed 1 year ago

sebastianmarschall commented 2 years ago

I get following exception when trying to add the XS2AWizard to my compose view:

java.lang.IllegalStateException: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There are could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.

SDK version: 3.4.2 Compose Version: 1.1.1

sebastianmarschall commented 2 years ago

Just noticed: same is the case when integrating as Fragment

maik-mursall commented 2 years ago

Hey, sorry for the late reply :b

I will look into this issue soon, could you please provide some extra info? Like the modifier and/or parent you used would be helpful :)

sebastianmarschall commented 2 years ago

hi @maik-mursall, thanks for your response. i tried it like suggested in the README:

setContent {
            val xS2AWizardConfig = XS2AWizardConfig(
                sessionKey = "your-session-key",
                onFinish = ::onFinish,
                onAbort = ::onAbort,
                theme = XS2AThemeLight,
            )

            XS2AWizard(xS2AWizardConfig = xS2AWizardConfig)
        }
maik-mursall commented 2 years ago

Hey again, i managed to reproduce this issue and i think you could just set the maximum-/height for the wizard.

Like so:

XS2AWizard(
    modifier = Modifier.heightIn(
        max = LocalConfiguration.current.screenHeightDp.dp // Set the maximum height to the screen height
    ),
    xS2AWizardConfig = xS2AWizardConfig
)

Or like so:

XS2AWizard(
    modifier = Modifier.height(
        LocalConfiguration.current.screenHeightDp.dp // Set the height to the screen height
    ),
    xS2AWizardConfig = xS2AWizardConfig
)

Please let me know if this helps :)

sebastianmarschall commented 2 years ago

Hi @maik-mursall,

yes that helped, thanks.

But:

`

`

Where the Fragment only consists of the XS2AWizard composable.

Thanks again :)

maik-mursall commented 2 years ago

Hey @sebastianmarschall, you're absolutely right, i will look into implementing a fix inside the SDK.

I will keep you updated :)

maik-mursall commented 2 years ago

Hi again @sebastianmarschall, Unfortunately I'm certain that I cannot fix this issue on the SDK side, this unfortunately is a problem on the host-app.

As a further suggestion it would make more sense to set the maximum height of the parent anyway. You can do that in your layout file or I even recommend the usage of ConstraintLayouts for your use case. :)

Or in the case of Jetpack Compose to not set the maximum height of the wizard component and set the max height of the parent. This should be easily achieved with Modifier.fillMaxHeight().

Please let me know if you have further questions :).

maik-mursall commented 1 year ago

I will close this Issue now due to inactivity.

Please reopen it if you have any further problems.