Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('Picker', () => {
expect(driver.isOpen()).toBeTruthy();
driver.cancel();
expect(driver.isOpen()).toBeFalsy();
expect(onDismiss).toHaveBeenCalledTimes(2); // TODO: this should be 1
expect(onDismiss).toHaveBeenCalledTimes(1);
});

// TODO: this test is not passing yet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ const ExpandableOverlay = (props: ExpandableOverlayProps, ref: any) => {
onPress?.(props);
}, [onPress, customValue]);

const closeExpandable = useCallback(() => {
const dismissOverlay = useCallback(() => {
setExpandableVisible(false);
focusAccessibility();
}, [focusAccessibility]);

const closeExpandable = useCallback(() => {
dismissOverlay();
useDialog ? dialogProps?.onDismiss?.() : modalProps?.onDismiss?.();
}, [useDialog, dialogProps?.onDismiss, modalProps?.onDismiss, focusAccessibility]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dismissOverlay, dialogProps?.onDismiss, modalProps?.onDismiss]);

const toggleExpandable = useCallback(() => (visible ? closeExpandable() : openExpandable()),
[visible, openExpandable, closeExpandable]);
Expand All @@ -105,7 +110,7 @@ const ExpandableOverlay = (props: ExpandableOverlayProps, ref: any) => {
overlayBackgroundColor={Colors.$backgroundDefault}
{...modalProps}
visible={visible}
onDismiss={closeExpandable}
onDismiss={dismissOverlay}
onRequestClose={closeExpandable}
onBackgroundPress={closeExpandable}
>
Expand Down
Loading