Fix component not showing in Compose #1403
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 afterActionComponentDialogFragment
was created.What I did is:
AdyenComponentView
to add the component view only on next layout.windowEnterAnimation
forActionComponentDialogFragment
.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
COAND-825