Skip to content

Commit

Permalink
Merge pull request #113 from gunnartorfis/fix-close-press
Browse files Browse the repository at this point in the history
fix: close button press didn't trigger dismiss
  • Loading branch information
gunnartorfis authored Sep 20, 2024
2 parents 78f029b + d83a529 commit 20d3e6c
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { CircleCheck, CircleX, Info, TriangleAlert, X } from './icons';
import { isToastAction, type ToastProps, type ToastRef } from './types';
import { useAppStateListener } from './use-app-state';
import { useDefaultStyles } from './use-default-styles';
import { RectButton } from 'react-native-gesture-handler';

export const Toast = React.forwardRef<ToastRef, ToastProps>(
(
Expand Down Expand Up @@ -428,27 +427,25 @@ export const Toast = React.forwardRef<ToastRef, ToastProps>(
</View>
</View>
{closeButton && dismissible ? (
<RectButton disallowInterruption>
<Pressable
onPress={() => onDismiss?.(id)}
hitSlop={10}
style={[closeButtonStyleCtx, styles?.closeButton]}
<Pressable
onPress={() => onDismiss?.(id)}
hitSlop={10}
style={[closeButtonStyleCtx, styles?.closeButton]}
className={cn(
classNamesCtx?.closeButton,
classNames?.closeButton
)}
>
<X
size={20}
color={defaultStyles.closeButtonColor}
style={[closeButtonIconStyleCtx, styles?.closeButtonIcon]}
className={cn(
classNamesCtx?.closeButton,
classNames?.closeButton
classNamesCtx?.closeButtonIcon,
classNames?.closeButtonIcon
)}
>
<X
size={20}
color={defaultStyles.closeButtonColor}
style={[closeButtonIconStyleCtx, styles?.closeButtonIcon]}
className={cn(
classNamesCtx?.closeButtonIcon,
classNames?.closeButtonIcon
)}
/>
</Pressable>
</RectButton>
/>
</Pressable>
) : null}
</View>
</Animated.View>
Expand Down

0 comments on commit 20d3e6c

Please sign in to comment.