androidx/constraintlayout

Motion layout compose OnSwipe doesn't work with a horizontal pager with tabs setup

Abdulrahman-N opened this issue · 3 comments

When creating a motion scene with a transition onSwipe on a horizontal pager
and if a child of the pager has a vertical scroll modifier and gets scrolled the onSwipe transition won't get triggered and participate in the scrolling.

video: https://streamable.com/5q31m4

yes. Motion layout only reacts to its direct children

I feel like this is a very common use case. Is there any workarounds or a way to fix this?

I am not sure exactly what you want. Build a skeleton and I will try and code a work around.
My understanding so far:

  • MotionLayout
    • TopAreaWidget1
    • TopAreaWidget2
    • Pager
      • ScrollPane1
      • panel2

You want the ML to react to ScrollPane1.
What happens when you switch to panel2 ?

If panel2 is not a ScrollPane:

  • then what is that to look like.
  • What is the scrollPosition of a non ScrollPane
  • MotionLayout will be changing the size of pager what happens to panel2

Given the design questions consider:

  • Pager
    • MotionLayout
      • TopAreaWidget1
      • TopAreaWidget2
      • ScrollPane1
    • panel2