Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/nav/AppNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ export const createAppNavigator = (args: {|
'account-details': { screen: AccountDetailsScreen },
'group-details': { screen: GroupDetailsScreen },
auth: { screen: AuthScreen },
chat: { screen: ChatScreen },
chat: { screen: ChatScreen,
navigationOptions:{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you arrive at the choice to configure the particular routes chat and search? 🙂 Did you find a reason not to apply the changes to all routes on AppNavigator, e.g., with defaultNavigationOptions?

I think this is a place where consistency would be helpful; a user might get confused if they find they can sometimes use the gesture and sometimes not, in similar situations. For that reason, I think using defaultNavigationOptions would be a good idea.

The doc I linked to in #4036 says that we should be careful to avoid situations where two things are set up to respond to the same gesture, with one of them being this new back-navigation handling. Did you find a situation like that? If so, it might be helpful to "opt out" of the back-nav gesture for that particular screen (if we can't easily just get rid of the pre-existing gesture handling) by, e.g., setting gestureEnabled: false on that screen—rather than "opting in" to the feature for just one or two screens.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you arrive at the choice to configure the particular routes chat and search?

I considered the issue #4036 is being refer to giving user an alternative and a familiar way to navigate back from the message(chat) screen (swipping left to right).

I considered to apply the same thing on the search route to make goback action( by swipping left to right ) consistent for all the options( all message, starred, mention, search) in upperTabNavigator.

I think using defaultNavigationOptions would be a good idea.

Yes, I agree to this point.
Should I consider applying it as defaultNavigationOptions ?

The doc I linked to in #4036 says that we should be careful to avoid situations where two things are set up to respond to the same gesture, with one of them being this new back-navigation handling. Did you find a situation like that?

No, I could not find any situation like that. On Android no gestures are registered for the action swipe from left to right.

Also I have read in docs that states gestures are enabled by default in IOS and not on Android, so a platform specific code can be written to use gestures in defaultNavigationOptions.

Can this be considered as a point of consistency for users on different platforms(IOS and Android) ?.

Copy link
Contributor

@chrisbobbe chrisbobbe Jan 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I consider applying it as defaultNavigationOptions ?

Yes, let's try that.

Also I have read in docs that states gestures are enabled by default in IOS and not on Android, so a platform specific code can be written to use gestures in defaultNavigationOptions.

Yes, let's use Platform.select to apply the new settings to Android only. The new settings may coincide with the default settings on iOS, but navigation is one of the areas where iOS and Android have important differences in how they want navigation to be handled, so I think it makes sense for our code to treat the two platforms separately here.

gestureEnabled:true,
gestureDirection:'horizontal',
gestureResponseDistance:{
horizontal:20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you arrive at the number 20 for gestureResponseDistance.horizontal? 🙂 The doc says it defaults to 25. If we're not keeping the default, let's write down the reason in a code comment.

}
} },
dev: { screen: DevAuthScreen },
'emoji-picker': { screen: EmojiPickerScreen },
loading: { screen: LoadingScreen },
Expand All @@ -74,7 +81,14 @@ export const createAppNavigator = (args: {|
'message-reactions': { screen: MessageReactionList },
password: { screen: PasswordAuthScreen },
realm: { screen: RealmScreen },
search: { screen: SearchMessagesScreen },
search: { screen: SearchMessagesScreen,
navigationOptions:{
gestureEnabled:true,
gestureDirection:'horizontal',
gestureResponseDistance:{
horizontal:20
}
} },
users: { screen: UsersScreen },
language: { screen: LanguageScreen },
lightbox: { screen: LightboxScreen },
Expand Down