This complains about `align`, but it works fine if...
# compose
c
This complains about
align
, but it works fine if I just drop this image code into a Box. How can I make a reusable bottomAlignedImage composable like this?
Copy code
@Composable
fun bottomAlignedImage(){
    Image(
            modifier = Modifier.fillMaxWidth().align(Alignment.BottomCenter),
            painter = painterResource(id = R.drawable.myImage),
            contentDescription = null
)}
n
you need to pass a modifier :
Copy code
fun bottomAlignedImage(modifier: Modifier = Modifier) {
Image(modifier = modifier...)
->
Copy code
bottomAlignedImage(Modifier.align(Alignement.BottomCenter)
Which is probably not what you planned (hence the name 😄 )
or make it so :
Copy code
@Composable
fun BoxScope.bottomAlignedImage(){
💯 2
☝️ 6
c
Thanks TIL