*Weird scrolling issue when using `AndroidView` in...
# compose
j
Weird scrolling issue when using
AndroidView
in
sheetContent
of a
BottomSheetScaffold
Please see the example code and video showing the bug in the thread.
1
If I put any
AndroidView
in the bottom sheet of a
BottomSheetScaffold
it will scroll up and down when sliding the bottom sheet: It is easier to see it in the attached video than to explain it with words. This is the code to reproduce (compose version is 1.0.0-beta02):
Copy code
class MainActivity : ComponentActivity() {
    @OptIn(ExperimentalMaterialApi::class)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MyApplicationTheme {
                BottomSheetScaffold(sheetContent = {
                    Surface(
                        color = MaterialTheme.colors.background
                    ) {
                        Column(
                            modifier = Modifier
                                .fillMaxSize()
                                .background(Color.Blue)
                        ) {
                            Greeting("Bottom")
                            AndroidView(factory = { TextView(it) }) {
                                it.text = "Hello AndroidView"
                            }
                        }
                    }
                }) {
                    Surface(color = MaterialTheme.colors.background) {
                        Greeting("Top")
                    }
                }
            }
        }
    }
}
j
yeah, might be related: I’ll add info to that bug ( https://issuetracker.google.com/issues/182387688 ), thanks
👍 1
m
Hi, this is a known issue in beta02. As a workaround, you can try disabling clipChildren on the parent of the 
View
 : 
AndroidView(factory = {...}) { (it.parent as ViewGroup).clipChildren = false }
c
@Mihai Popa I tried this workaround and it didn't work. Any other ideas?
m
I added one more workaround at bug 182387688, please let me know if this one works!
🙌 1
c