sonner-native
Version:
An opinionated toast component for React Native. A port of @emilkowalski's sonner.
16 lines (14 loc) • 353 B
text/typescript
import { CLOSE_BUTTON_HIT_AREA } from './constants';
/**
* Checks if a press event occurred near the close button area.
* The x coordinate is relative to the gesture handler view.
*/
export const isPressNearCloseButton = ({
x,
viewWidth,
}: {
x: number;
viewWidth: number;
}): boolean => {
return x > viewWidth - CLOSE_BUTTON_HIT_AREA;
};