5

Edit: Also happens when I swap ConstraintLayout for a Box using alignment as well...

Seems like AnimatedVisibility doesn't play well with ConstraintLayout in JP Compose at the moment.

        AnimatedVisibility(
          visible = entryListState.firstVisibleItemIndex > 3,
          enter = fadeIn() + expandIn(expandFrom = Alignment.Center),
          exit = fadeOut() + shrinkOut(shrinkTowards = Alignment.Center)
        ) {
          ExtendedFloatingActionButton(
            modifier = Modifier.constrainAs(scrollToTop) {
              start.linkTo(parent.start)
              bottom.linkTo(parent.bottom)
            },
            text = { Text(text = "TOP") },
            onClick = { scope.launch { entryListState.animateScrollToItem(0) } }
          )
        }

The ( TOP ) fab should appear in the bottom left corner, but instead I get incorrect placement

When I remove the AnimatedVisibility wrapper, everything works fine. :( I know I can work around this, but I'm curious if there's something I'm doing incorrectly with the configuration of the AnimatedVisibility composable?

Carter Hudson
  • 1,176
  • 1
  • 11
  • 23

1 Answers1

12

Turns out I was thinking about AnimatedVisibility all wrong. It's just another Composable. I needed to lift the FAB's modifiers re: positioning to the AnimatedVisibilty's modifiers.

Carter Hudson
  • 1,176
  • 1
  • 11
  • 23