react-native-gesture-handler
Version:
Declarative API exposing native platform touch and gesture system to React Native
21 lines (17 loc) • 576 B
text/typescript
import type { ButtonEvent } from '../../v3/types';
export const ButtonEventName = {
Press: 'gh:buttonPress',
PressIn: 'gh:buttonPressIn',
PressOut: 'gh:buttonPressOut',
LongPress: 'gh:buttonLongPress',
InteractionFinished: 'gh:buttonInteractionFinished',
} as const;
export type ButtonEventTypeName =
(typeof ButtonEventName)[keyof typeof ButtonEventName];
export function dispatchButtonEvent(
view: HTMLElement | null | undefined,
name: ButtonEventTypeName,
event: ButtonEvent
): void {
view?.dispatchEvent(new CustomEvent(name, { detail: event }));
}