Skip to content
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

Fix component not showing in Compose #1403

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

araratthehero
Copy link
Contributor

@araratthehero araratthehero commented Nov 30, 2023

Description

Components would not be re-drawn, when used in Compose lazy lists.
It looks like on recomposition Compose only lays out the android views once and does not show any changes made on layout calls afterwards.

To find a solution which would hack Compose to draw the android views would not be error-proof, since in future Compose releases they might change the way they draw android views. The option to duplicate the lazy lists and modify the logic would not work either, since it would require maintenance work every time there is a new Compose release.

Going back to why we added component views in doOnNextLayout() is because of the broken animation when navigating to an external activity to open a URL right after ActionComponentDialogFragment was created.
image

What I did is:

  • Reverted back the changes made in AdyenComponentView to add the component view only on next layout.
  • Disabled the windowEnterAnimation for ActionComponentDialogFragment.

The results do not look different from one another and the animation does not look broken either.
Screen recording before changes:
https://github.com/Adyen/adyen-android/assets/8832594/0a015d3d-8b86-49a2-9f44-4307b55bebfa

Screen recording after changes:
https://github.com/Adyen/adyen-android/assets/8832594/67bccd37-27d0-463b-93f1-bdad5489bdb3

Checklist

  • Changes are tested manually
  • Link to related issues
  • Add relevant labels to PR

COAND-825

@araratthehero araratthehero added the Fix [PRs only] Indicates a bug fix label Nov 30, 2023
@araratthehero araratthehero force-pushed the fix/component_not_showing_in_compose_pager branch 2 times, most recently from 12de4c4 to 10d8dc7 Compare December 1, 2023 09:39
@araratthehero araratthehero marked this pull request as ready for review December 4, 2023 13:55
@araratthehero araratthehero requested a review from a team as a code owner December 4, 2023 13:55
@araratthehero araratthehero force-pushed the fix/component_not_showing_in_compose_pager branch from 10d8dc7 to de2c802 Compare December 4, 2023 14:00
…nent view only on next layout. Those changes would cause Compose to not re-draw the components when used in lazy lists. Instead, disabled the `windowEnterAnimation` for ActionComponentDialogFragment, which caused the dialog to jump before navigating to an external browser activity.

COAND-825
@araratthehero araratthehero force-pushed the fix/component_not_showing_in_compose_pager branch from de2c802 to 71ae855 Compare December 5, 2023 14:35
@araratthehero araratthehero linked an issue Dec 5, 2023 that may be closed by this pull request
@araratthehero araratthehero merged commit 5d8dc98 into develop Dec 6, 2023
5 checks passed
@araratthehero araratthehero deleted the fix/component_not_showing_in_compose_pager branch December 6, 2023 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix [PRs only] Indicates a bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AdyenComponent Composable disappears on recomposition
2 participants