Prevent AndroidView being composed more than once in ItemScreen
This commit is contained in:
parent
841b56e7e5
commit
45dc199ea2
@ -79,6 +79,7 @@ class ItemScreen(
|
|||||||
|
|
||||||
val snackbarHostState = remember { SnackbarHostState() }
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
var isScrollable by remember { mutableStateOf(true) }
|
var isScrollable by remember { mutableStateOf(true) }
|
||||||
|
var refreshAndroidView by remember { mutableStateOf(true) }
|
||||||
|
|
||||||
// https://developer.android.com/develop/ui/compose/touch-input/pointer-input/scroll#parent-compose-child-view
|
// https://developer.android.com/develop/ui/compose/touch-input/pointer-input/scroll#parent-compose-child-view
|
||||||
val bottomBarHeight = 64.dp
|
val bottomBarHeight = 64.dp
|
||||||
@ -198,6 +199,7 @@ class ItemScreen(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
update = { nestedScrollView ->
|
update = { nestedScrollView ->
|
||||||
|
if (refreshAndroidView) {
|
||||||
val relativeLayout =
|
val relativeLayout =
|
||||||
(nestedScrollView.children.toList()[0] as RelativeLayout)
|
(nestedScrollView.children.toList()[0] as RelativeLayout)
|
||||||
val webView = relativeLayout.children.toList()[1] as ItemWebView
|
val webView = relativeLayout.children.toList()[1] as ItemWebView
|
||||||
@ -208,6 +210,9 @@ class ItemScreen(
|
|||||||
backgroundColor = backgroundColor,
|
backgroundColor = backgroundColor,
|
||||||
onBackgroundColor = onBackgroundColor
|
onBackgroundColor = onBackgroundColor
|
||||||
)
|
)
|
||||||
|
|
||||||
|
refreshAndroidView = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user