aoriani
02/18/2022, 7:34 PMArjun Achatz
02/18/2022, 11:28 PMAdam Powell
02/19/2022, 1:47 AMAndroidView
composable does not recreate the view. There may be something else going on there.aoriani
02/23/2022, 5:00 AMupdate
param which says "The callback to be invoked after the layout is inflated.", so I thought it was an adequate place to set the preview surface. Reading the docs for AndroidView
a bit further I found "The update
block can be run multiple times (on the UI thread as well) due to recomposition, and it is the right place to set View
properties depending on state". Then I realized what was my mistake, and I moved everything to factory
.
I guess the doc for update
should be changed to something like the callback to update the view when there is a recomposition
. Should I create a PR to update the docs?Adam Powell
02/23/2022, 3:46 PMupdate
block will be run if:
1. the view is initially created by the supplied factory
2. a new update
is provided through recomposition (e.g. recomposed with a new/different lambda capture)
3. snapshot state accessed by update
was invalidatedAdam Powell
02/23/2022, 3:49 PMupdate
after one of the above conditions has been met and before any upcoming frame performs layout and drawingaoriani
02/25/2022, 12:33 AM