Skip to content

Commit

Permalink
chore(navigation): block gesture closing of modal (#941)
Browse files Browse the repository at this point in the history
To maintain existing Hyperview modal behavior, disable gesture (swipe)
closing of modals. React-navigation uses a `true` default for iOS and
`false` for Android.

Future tasks will consider overriding this default.

| Before | After |
| -- | -- |
|
![before](https://github.com/user-attachments/assets/f2fdd5b3-aa31-4f3d-a112-4bb85712cfc4)
|
![after](https://github.com/user-attachments/assets/c6d269f8-519e-4f08-9a96-594bf825f73a)
|



Asana: https://app.asana.com/0/1204008699308084/1208218286764693/f
  • Loading branch information
hgray-instawork authored Sep 12, 2024
1 parent a46b848 commit a87b2b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/components/hv-navigator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
TabScreenOptions,
} from './types';
import React, { PureComponent } from 'react';
import { Platform } from 'react-native';
import { createCustomStackNavigator } from 'hyperview/src/core/components/navigator-stack';
import { createCustomTabNavigator } from 'hyperview/src/core/components/navigator-tab';
import { getFirstChildTag } from 'hyperview/src/services/dom/helpers';
Expand Down Expand Up @@ -142,6 +143,7 @@ export default class HvNavigator extends PureComponent<Props> {
);
}
if (type === NavigatorService.NAVIGATOR_TYPE.STACK) {
const gestureEnabled = Platform.OS === 'ios' ? !isModal : false;
return (
<Stack.Screen
key={id}
Expand All @@ -154,6 +156,7 @@ export default class HvNavigator extends PureComponent<Props> {
cardStyleInterpolator: isModal
? NavigatorService.CardStyleInterpolators.forVerticalIOS
: undefined,
gestureEnabled,
presentation: isModal
? NavigatorService.ID_MODAL
: NavigatorService.ID_CARD,
Expand Down

0 comments on commit a87b2b3

Please sign in to comment.