Insert composable from another fun into main ConstraintLayout
Solution 1:
You need to pass Modifier
parameter into your MyOneComposable
:
@Composable
fun MyOneComposable(
modifier: Modifier,
) {
Button(onClick = { /*....*/ }, modifier = modifier) {
Text(text = "My one composable button")
}
}
So you can apply ref modifier from ConstraintLayout
:
MyOneComposable(Modifier.constraintAs(view2) { ... })