Hey all, looking for some best practices/opinions/insights:
We’ve built a Compose component library and created Android View wrappers for easier interop. For example,
TextButton : AbstractComposeView
internally calls
@Composable fun TextButton
. We use a custom
setIsEnabled()
instead of the traditional
View#setEnabled
that updates the Compose state which makes Espresso testing a bit tricky.
We’re considering overriding
View#setEnabled
and calling
super.setEnabled()
in addition to updating the Compose state, to sync Compose and view layers, but are concerned about conflicts with rendering since
View#setEnabled
does cause layout invalidation.
1. Is it advisable/ok to override
View#setEnabled
for Views that extend
AbstractComposeView
?
2. Any other suggestions for syncing Compose and view layers while keeping Espresso testing straightforward?
Thanks!