Skip to content

Commit dfad7b6

Browse files
committed
[Paywalls V2] Extend paywall content below sticky footer
1 parent a6ae83d commit dfad7b6

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/LoadedPaywallComponents.kt

+27-11
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,26 @@
33
package com.revenuecat.purchases.ui.revenuecatui.components
44

55
import android.content.res.Configuration
6+
import androidx.compose.foundation.layout.Box
67
import androidx.compose.foundation.layout.Column
8+
import androidx.compose.foundation.layout.Spacer
79
import androidx.compose.foundation.layout.fillMaxSize
810
import androidx.compose.foundation.layout.fillMaxWidth
11+
import androidx.compose.foundation.layout.height
912
import androidx.compose.foundation.rememberScrollState
1013
import androidx.compose.foundation.verticalScroll
1114
import androidx.compose.runtime.Composable
15+
import androidx.compose.runtime.getValue
16+
import androidx.compose.runtime.mutableIntStateOf
17+
import androidx.compose.runtime.remember
18+
import androidx.compose.runtime.setValue
19+
import androidx.compose.ui.Alignment
1220
import androidx.compose.ui.Modifier
1321
import androidx.compose.ui.graphics.Color
1422
import androidx.compose.ui.graphics.toArgb
23+
import androidx.compose.ui.layout.onSizeChanged
1524
import androidx.compose.ui.platform.LocalConfiguration
25+
import androidx.compose.ui.platform.LocalDensity
1626
import androidx.compose.ui.tooling.preview.Preview
1727
import com.revenuecat.purchases.Offering
1828
import com.revenuecat.purchases.paywalls.components.StackComponent
@@ -64,23 +74,29 @@ internal fun LoadedPaywallComponents(
6474
val footerComponentStyle = state.stickyFooter
6575
val background = rememberBackgroundStyle(state.background)
6676

67-
Column(modifier = modifier.background(background)) {
68-
ComponentView(
69-
style = style,
70-
state = state,
71-
onClick = clickHandler,
72-
modifier = Modifier
73-
.fillMaxWidth()
74-
.weight(1f)
75-
.verticalScroll(rememberScrollState()),
76-
)
77+
Box(modifier = modifier.background(background)) {
78+
var footerHeight by remember { mutableIntStateOf(0) }
79+
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
80+
ComponentView(
81+
style = style,
82+
state = state,
83+
onClick = clickHandler,
84+
modifier = Modifier
85+
.fillMaxWidth(),
86+
)
87+
val footerHeightDp = with(LocalDensity.current) { footerHeight.toDp() }
88+
Spacer(modifier = Modifier.height(footerHeightDp))
89+
}
90+
7791
footerComponentStyle?.let {
7892
ComponentView(
7993
style = it,
8094
state = state,
8195
onClick = clickHandler,
8296
modifier = Modifier
83-
.fillMaxWidth(),
97+
.fillMaxWidth()
98+
.align(Alignment.BottomCenter)
99+
.onSizeChanged { size -> footerHeight = size.height },
84100
)
85101
}
86102
}

0 commit comments

Comments
 (0)