Skip to content

Commit 7866573

Browse files
committed
react-native: Call both onClose and closeButtonProps.onPress in BannerBase handleClosePress to ensure close button invokes consumer handler when onClose is provided (fixes ignored closeButtonProps.onPress in Toast/Toaster).
1 parent 5eb5853 commit 7866573

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • packages/design-system-react-native/src/components/BannerBase

packages/design-system-react-native/src/components/BannerBase/BannerBase.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ export const BannerBase: React.FC<BannerBaseProps> = ({
5555
const handleClosePress =
5656
onClose || closeButtonPropsOnPress
5757
? (event: GestureResponderEvent) => {
58-
if (onClose) {
59-
onClose();
60-
return;
61-
}
58+
// Invoke both handlers when provided to allow parent onClose
59+
// and consumer-provided closeButtonProps.onPress to run.
60+
onClose?.();
6261
closeButtonPropsOnPress?.(event);
6362
}
6463
: undefined;

0 commit comments

Comments
 (0)