Skip to content

Commit

Permalink
fix: close button press didn't trigger dismiss
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnartorfis committed Sep 19, 2024
1 parent 78f029b commit d83a529
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 d83a529

Please sign in to comment.