inaturalist / iNaturalistReactNative

Cross-platform version of the iNat mobile app
MIT License
58 stars 18 forks source link

Explore scroll state resets when you leave #1774

Closed kueda closed 2 weeks ago

kueda commented 1 month ago

Describe the bug When you're browsing observations in Explore and you go to ObsDetails, when you return the list of observations is scrolled back to the top.

To Reproduce Steps to reproduce the behavior:

  1. Go to Explore
  2. Enter Observations view, grid or list layout
  3. Scroll down a few rows
  4. Tap the observation in the upper left to get to ObsDetails
  5. On ObsDetails tap the back button to return to Explore
  6. The observation you just viewed is no longer in the upper left position; the list is scrolled to the very top

Expected behavior Explore should remember your scroll position.

Context (please complete the following information):

Additional context This probably has to do with the way we stow Explore state when leaving so we can restore it later... but ideally Explore should just not reset its state when it does this. Maybe it should when you push another instance of Explore on the navigation state, but not right when you leave. Another symptom here is that when you tap an observation, there's a flash where Explore resets to species view before navigating away. That shouldn't happen either.

Reported by Tony.

albullington commented 1 month ago

Noting that this seems to be happening for RootExplore but not for Explore. I can replicate when tapping on RootExplore from the tab bar. I can't replicate when navigating to TaxonDetails -> Explore -> any observation -> Explore -- in this case, the Explore scroll is preserved.

kueda commented 1 month ago

Another symptom:

  1. Go to Explore; Species view should load
  2. Switch to Observations view
  3. View an observation
  4. Start swiping from the left side of the screen as if you wanted to back but hold it half way; Explore is in Species view until you release, then it resets.

IMG_1519