smaranjitghose / DocLense

An open-source document scanner!
https://doclense.vercel.app/
Creative Commons Zero v1.0 Universal
147 stars 130 forks source link

Infinite stacking of screens. #220

Closed abstrxtInfinity closed 3 years ago

abstrxtInfinity commented 3 years ago

I have noticed a major issue in the application and that is the infinite stacking of pages. In my opinion it might be because of using push() instead of pushReplacement(), I would like to work on this issue. GSSOC'21 participant.

Saransh-cpp commented 3 years ago

This was fixed in #116 , we cannot simply add pushReplecement instead of push as the home screen will be replaced and we don't want that.

For ex -

  1. You are on the home screen.
  2. You go to the main drawer and select starred docs screen.
  3. If the starred docs screen is push replaced then the home screen lying below is gone.
  4. Now if the user tries to click the back button to go back to the home screen, it won't work, rather, pressing the back button will close the app.

Reasons we are using popUntil -

  1. There are other screens like the multi_select_delete screen where we don't want to pushReplace on clicking the home button rather we want to bring back the user to the root page that is home and clear all the other screens lying in the stack.
  2. This is even helpful in the main drawer where the user can stack as many screens as he wants but once he clicks the home button, all the screens are cleared and the user is brought back to the root home page.

You can drop below any other ideas you have but right now I think popUntil should be preferred over pushReplacement:)

abstrxtInfinity commented 3 years ago

Thanks for explaining, I will therefore close this issue.