Skip to content

Double tap on Narrow narrows twice. #2682

@roberthoenig

Description

@roberthoenig

Issue

ezgif com-video-to-gif
It's not visible, but I rapidly tapped twice on the same topic.
This was recorded on an iOS device. I experience the same behavior in an Android emulator.
There is a issue for this: react-navigation/rfcs#16
The developers seem unsure whether this is a bug or a feature, but they point to some ways to resolve this manually.

Possible solution

File: src/nav/navReducers.js
39: const switchNarrow = (state: NavigationState, action: SwitchNarrowAction): NavigationState => {
40:   if (state.isTransitioning === false) {
41:     return AppNavigator.router.getStateForAction(navigateToChat(action.narrow), state) || state;
42:   }
43:   return state;
44: }

This drops any transitions dispatched while the app is transitioning. This does its job, but I think an ideal solution would avoid narrowing to a view the app is already in alltogether.
Such a solution would require smt like this:

File: src/nav/navActions.js
11: export const navigateToChat = (narrow: Narrow): NavigateAction =>
12:     NavigationActions.navigate({ key: narrow, routeName: 'chat', params: { narrow } }); 

This makes the app throw when navigating to a chat narrow that has the same key as the narrow the app is in. (Currently, it just navigates twice.) We might want to do this for every narrow, and/or implement a check somewhere to not execute a narrow to the same view. I'm not sure what the philosophical right way to do this is.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions