https://kotlinlang.org logo
#compose
Title
# compose
a

allan.conda

01/14/2021, 1:37 PM
One of my AndroidViews are re-inflating on alpha10 on every recompose. I’m curious what causes a reinflate for an AndroidView. Can anyone help shed light on this? The documentation says it should only run exactly once.
j

jim

01/14/2021, 1:48 PM
Did the same code behave differently on alpha09? If you made code changes, are you using the
key
function anywhere in your app? If you did not make code changes, can you provide a minimal repro so we can investigate further?
🙏 1
a

allan.conda

01/14/2021, 1:57 PM
We skipped alpha09 and I’m coming from alpha08, and it was working well on alpha08. I didn’t find any direct
key()
usage in our app though. I had to make code changes since there were renamed APIs. Since this is happening only on some AndroidViews, I’m guessing making a minimal repro is going to be a challenge. I’m assuming this isn’t suppose to happen. I’ll try reproducing it in a sample project.
For anyone encountering the issue I did a workaround for now by initializing the View outside a
viewBlock
with
remember
, and it seems to work.
Copy code
val view = remember { inflate(...) }
AndroidView(viewBlock = { inflatedView })
j

jim

01/16/2021, 10:34 PM
Can you please file a bug and link it in this thread?