From a87b2b3f4bb8c369d01f0985ab4a0ad6dc9095a2 Mon Sep 17 00:00:00 2001 From: Hardin Gray Date: Thu, 12 Sep 2024 11:55:14 -0400 Subject: [PATCH] chore(navigation): block gesture closing of modal (#941) 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 --- src/core/components/hv-navigator/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/components/hv-navigator/index.tsx b/src/core/components/hv-navigator/index.tsx index 142356bb8..059434ced 100644 --- a/src/core/components/hv-navigator/index.tsx +++ b/src/core/components/hv-navigator/index.tsx @@ -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'; @@ -142,6 +143,7 @@ export default class HvNavigator extends PureComponent { ); } if (type === NavigatorService.NAVIGATOR_TYPE.STACK) { + const gestureEnabled = Platform.OS === 'ios' ? !isModal : false; return ( { cardStyleInterpolator: isModal ? NavigatorService.CardStyleInterpolators.forVerticalIOS : undefined, + gestureEnabled, presentation: isModal ? NavigatorService.ID_MODAL : NavigatorService.ID_CARD,