What is the difference between enterAnim & popEnterAnim & exitAnim & popExitAnim?

前端 未结 2 622
生来不讨喜
生来不讨喜 2021-01-01 09:21

What is the difference between animation tags in latest Navigation Architecture Component? I got confused with enterAnim & popEnterAnim. Simila

相关标签:
2条回答
  • 2021-01-01 09:55

    The Animate transitions between destinations documentation details the four types of animations:

    • Entering a destination
    • Exiting a destination
    • Entering a destination via a pop action
    • Exiting a destination via a pop action

    "Entering" refers to the destination that is coming onto the screen, while "exiting" refers to the destination leaving the screen.

    Therefore when you navigate from destination A to destination B, the entering destination B will have the enterAnim applied to it and the exiting destination A will have the exitAnim applied to it.

    When the user hits the system Back button, going from B back to A, the reverse happens: the entering destination A will have the popEnterAnim applied to it and the exiting destination B will have the popExitAnim applied to it.

    0 讨论(0)
  • 2021-01-01 10:15

    Pop is related to the back stack, I use back stack for helping understanding

    e.g.

    A is showing on screen now, we are going to put B on screen, then A will Exit(Anim/transaction) from screen, B will Enter to screen.

    Now what’s going to happen if you tap back key/up button? Yes, the reverse happens. Which means B is going to be replaced by A.

    • B is popped off the back stack and Exit from screen (Pop Exit)
    • A is entered to the view from the back stack (Pop Enter)
    0 讨论(0)
提交回复
热议问题