digidem / comapeo-mobile

The next version of Mapeo mobile
GNU General Public License v3.0
5 stars 1 forks source link

feat: show linked track in observation #839

Closed ErikSin closed 2 weeks ago

ErikSin commented 2 weeks ago

Closes #820.

Also updated some styling to be more consistent with design specs, and to allow the parent to control the padding styles.

image

ErikSin commented 2 weeks ago

but if you go to the track from the observation, the back button takes you back to the observation, which is as I would expect. If you go to the track in the observation list, and then go to the observation and hit back, you go back to the track, which is as I would expect. If you go to the observation from the observation list, to the track, to the observation and hit back, you go back to the observation list. Which is not what I would expect.

Yeah, its kind of a weird quirk of react-navigation. If the navigation stack is [observationList, observation, track], and then from track the user navigates to observation, react navigation will check the stack first and see if observation is in the stack, it is is, it will just go back to that point in the stack instead of adding observation on top of the stack (ie, the stack will become [observationList, observation] instead of [observationList, observation, track, observation]. That explains why the back button then takes the user back to the observationList instead of the track screen. Its actually quite a nice feature to make sure that the user does not get stuck in really deep navigation holes that would require them to see the same screen several time when they are trying to go back.

Funnily enough React Nav actually took out this behaviour in their latest release...

Anyways I circumvented this behaviour by using navigation.push instead of navigation.navigate. Now the user can endlessly go between tracks and observations and the navigation will be maintained.