-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AdyenComponent Composable disappears on recomposition #1399
Comments
Hi @ronaldvanduren, thank you for reaching out and for the detailed explanation. We are currently investigating and will issue a fix as soon as we find the cause. What you could do is to set the Here is the modified code for your case: @Composable
private fun PaymentMethods(
........
pagerState: PagerState,
viewState: ....
onCreditCardInputChanged: (CardComponentState) -> Unit
) {
......
HorizontalPager(
state = pagerState,
beyondBoundsPageCount = 1 // Any value should work here, based on the amount of payment methods
) { currentPage ->
viewState.paymentMethods.elementAt(currentPage).let { paymentMethod ->
when (paymentMethod) {
is PaymentMethod.Twint -> TwintContent()
is PaymentMethod.CreditCard -> CreditCardContent(cardComponent)
}
}
}
} For the case of using only two payment methods, setting @Composable
private fun PaymentMethods(
........
pagerState: PagerState,
viewState: ....
onCreditCardInputChanged: (CardComponentState) -> Unit
) {
......
HorizontalPager(
state = pagerState,
contentPadding = PaddingValues(horizontal = 32.dp) // Adds padding around the whole content
) { currentPage ->
viewState.paymentMethods.elementAt(currentPage).let { paymentMethod ->
when (paymentMethod) {
is PaymentMethod.Twint -> TwintContent()
is PaymentMethod.CreditCard -> CreditCardContent(cardComponent)
}
}
}
} I know that if you have more payment methods, using the Could you please try that and let us know if it works for you? |
Thanks for the reply! Unfortunately, setting The same behaviour is observed when setting the I do see however that the AdyenComponentView is inflated and that the CardView is attached, it's just that the CardView is not properly inflated (it seems). |
Hi @ronaldvanduren, the fix for this bug has been merged and will be available in our next release. Thanks again for reporting it! |
Hi @ronaldvanduren, we just released 5.1.0 which includes a fix for this issue, let us know if you still face any problems with it. |
Sorry for the late reply, it's a different sprint for us and this task was pushed back to the backlog. However, I checked today and the issue is resolved 🎉! |
Describe the bug
After migrating to 5.0.1 I notice that the
AdyenComponent
is not shown after the initial composition of the screen (using Compose). It works fine if theAdyenComponent
is added and not removed from the view. But if theAdyenComponent
is removed and added again, the second time it's not shown. Also, if it's used inside aHorizontalPager
it's not shown at all.In 4.13.3 I implemented the
CardView
in Compose without this issue, the view remains always visible.This works(v4.13.3)
This doesn't work (v5.01)
This does work (v5.01)
Expected behavior
Whenever the
AdyenComponent
is added dynamically to the view tree (e.g. viaHorizontalPager
), then theAdyenComponent
should be visible.Smartphone:
The text was updated successfully, but these errors were encountered: