From dea1d4524dc70ad0f44807cc1f49841faa1b3d42 Mon Sep 17 00:00:00 2001 From: robin Date: Thu, 27 Jul 2023 15:45:51 +0800 Subject: [PATCH] fix: actionsheet unlock focus if disable overlay Modal - add optional prop useRNModalOnAndroid Actionsheet - if disableOverlay, pass useRNModalOnAndroid=false to Modal --- src/components/composites/Actionsheet/Actionsheet.tsx | 1 + src/components/composites/Modal/Modal.tsx | 3 ++- src/components/composites/Modal/types.ts | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/composites/Actionsheet/Actionsheet.tsx b/src/components/composites/Actionsheet/Actionsheet.tsx index edc06715a..f30390bd9 100644 --- a/src/components/composites/Actionsheet/Actionsheet.tsx +++ b/src/components/composites/Actionsheet/Actionsheet.tsx @@ -31,6 +31,7 @@ const Actionsheet = ( {...resolvedProps} overlayVisible={disableOverlay ? false : true} closeOnOverlayClick={disableOverlay ? false : true} + useRNModalOnAndroid={disableOverlay ? false : true} ref={ref} _overlay={{ style: overlayStyle }} > diff --git a/src/components/composites/Modal/Modal.tsx b/src/components/composites/Modal/Modal.tsx index 7c67156e7..b86d28fce 100644 --- a/src/components/composites/Modal/Modal.tsx +++ b/src/components/composites/Modal/Modal.tsx @@ -39,6 +39,7 @@ const Modal = ( _slide, _overlay, useRNModal, + useRNModalOnAndroid = true, ...resolvedProps } = usePropsResolution('Modal', rest); @@ -84,7 +85,7 @@ const Modal = ( onRequestClose={handleClose} isKeyboardDismissable={isKeyboardDismissable} animationPreset={animationPreset} - useRNModalOnAndroid + useRNModalOnAndroid={useRNModalOnAndroid} useRNModal={useRNModal} {..._overlay} > diff --git a/src/components/composites/Modal/types.ts b/src/components/composites/Modal/types.ts index fa1bab28a..a5ca8736f 100644 --- a/src/components/composites/Modal/types.ts +++ b/src/components/composites/Modal/types.ts @@ -86,6 +86,12 @@ export interface InterfaceModalProps extends InterfaceBoxProps { * @default false */ useRNModal?: boolean; + /** + * If true, renders react-native native modal (android only) + * We use RN modal on android if needed as it supports shifting accessiblity focus to the opened view. IOS automatically shifts focus if an absolutely placed view appears in front. + * @default true + */ + useRNModalOnAndroid?: boolean; } export type IModalComponentType = ((