GT2/Ejectable/node_modules/react-native-gesture-handler/lib/module/handlers/gestureHandlers.js.map

1 line
23 KiB
Plaintext

{"version":3,"sources":["gestureHandlers.ts"],"names":["React","createHandler","PlatformConstants","baseProps","TapGestureHandler","name","allowedProps","config","FlingGestureHandler","ForceTouchFallback","Component","componentDidMount","console","warn","render","props","children","ForceTouchGestureHandler","forceTouchAvailable","LongPressGestureHandler","validatePanGestureHandlerProps","minDeltaX","activeOffsetX","Error","maxDeltaX","failOffsetX","minDeltaY","activeOffsetY","maxDeltaY","failOffsetY","Array","isArray","transformPanGestureHandlerProps","res","undefined","activeOffsetXStart","activeOffsetXEnd","failOffsetXStart","failOffsetXEnd","minOffsetX","activeOffsetYStart","activeOffsetYEnd","failOffsetYStart","failOffsetYEnd","minOffsetY","managePanProps","__DEV__","PanGestureHandler","transformProps","customNativeProps","PinchGestureHandler","RotationGestureHandler"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;AAkEA,OAAO,MAAMC,SAAS,GAAG,CACvB,IADuB,EAEvB,SAFuB,EAGvB,aAHuB,EAIvB,SAJuB,EAKvB,sBALuB,EAMvB,yBANuB,EAOvB,SAPuB,EAQvB,SARuB,EASvB,UATuB,EAUvB,aAVuB,EAWvB,aAXuB,EAYvB,SAZuB,EAavB,gBAbuB,EAcvB,sBAduB,CAAlB;AAoCP;AACA,OAAO,MAAMC,iBAAiB,GAAGH,aAAa,CAG5C;AACAI,EAAAA,IAAI,EAAE,mBADN;AAEAC,EAAAA,YAAY,EAAE,CACZ,GAAGH,SADS,EAEZ,eAFY,EAGZ,YAHY,EAIZ,cAJY,EAKZ,WALY,EAMZ,WANY,EAOZ,SAPY,EAQZ,aARY,CAFd;AAYAI,EAAAA,MAAM,EAAE;AAZR,CAH4C,CAAvC;AAgCP;AACA,OAAO,MAAMC,mBAAmB,GAA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ACD;;AAED,SAASY,cAAT,CAAwB9B,KAAxB,EAAuD;AACrD,MAAI+B,OAAJ,EAAa;AACX1B,IAAAA,8BAA8B,CAACL,KAAD,CAA9B;AACD;;AACD,SAAOiB,+BAA+B,CAACjB,KAAD,CAAtC;AACD;;AA0CD;AACA,OAAO,MAAMgC,iBAAiB,GAAG9C,aAAa,CAG5C;AACAI,EAAAA,IAAI,EAAE,mBADN;AAEAC,EAAAA,YAAY,EAAE,CACZ,GAAGH,SADS,EAEZ,eAFY,EAGZ,eAHY,EAIZ,aAJY,EAKZ,aALY,EAMZ,SANY,EAOZ,aAPY,EAQZ,cARY,EASZ,cATY,EAUZ,aAVY,EAWZ,aAXY,EAYZ,YAZY,EAaZ,gCAbY,CAFd;AAiBAI,EAAAA,MAAM,EAAE,EAjBR;AAkBAyC,EAAAA,cAAc,EAAEH,cAlBhB;AAmBAI,EAAAA,iBAAiB,EAAE,CACjB,oBADiB,EAEjB,kBAFiB,EAGjB,oBAHiB,EAIjB,kBAJiB,EAKjB,kBALiB,EAMjB,gBANiB,EAOjB,kBAPiB,EAQjB,gBARiB;AAnBnB,CAH4C,CAAvC;AA6CP;AACA,OAAO,MAAMC,mBAAmB,GAAGjD,aAAa,CAG9C;AACAI,EAAAA,IAAI,EAAE,qBADN;AAEAC,EAAAA,YAAY,EAAEH,SAFd;AAGAI,EAAAA,MAAM,EAAE;AAHR,CAH8C,CAAzC;AAoBP;AACA,OAAO,MAAM4C,sBAAsB,GAAGlD,aAAa,CAGjD;AACAI,EAAAA,IAAI,EAAE,wBADN;AAEAC,EAAAA,YAAY,EAAEH,SAFd;AAGAI,EAAAA,MAAM,EAAE;AAHR,CAHiD,CAA5C","sourcesContent":["// Previous types exported gesture handlers as classes which creates an interface and variable, both named the same as class.\n// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof\n// e.g. React.createRef<TapGestureHandler> -> React.createRef<typeof TapGestureHandler>.\n// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.\nimport * as React from 'react';\n\nimport createHandler from './createHandler';\nimport PlatformConstants from '../PlatformConstants';\nimport { State } from '../State';\nimport { ValueOf } from '../typeUtils';\n\nexport interface GestureEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf<typeof State>;\n}\n\nexport interface HandlerStateChangeEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf<typeof State>;\n oldState: ValueOf<typeof State>;\n}\n\n//TODO(TS) events in handlers\n\nexport interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {\n nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;\n}\nexport interface HandlerStateChangeEvent<\n ExtraEventPayloadT = Record<string, unknown>\n> {\n nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;\n}\n\n// Events payloads are types instead of interfaces due to TS limitation.\n// See https://github.com/microsoft/TypeScript/issues/15300 for more info.\nexport type BaseGestureHandlerProps<\n ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>\n> = {\n id?: string;\n enabled?: boolean;\n minPointers?: number;\n waitFor?: React.Ref<unknown> | React.Ref<unknown>[];\n simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n shouldCancelWhenOutside?: boolean;\n hitSlop?:\n | number\n // TODO(TS) take into consideration types from GestureHandler#setHitSlop\n | Partial<\n Record<\n 'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal',\n number\n >\n >\n | Record<'width' | 'left', number>\n | Record<'width' | 'right', number>\n | Record<'height' | 'top', number>\n | Record<'height' | 'bottom', number>;\n // TODO(TS) - fix event types\n onBegan?: (event: HandlerStateChangeEvent) => void;\n onFailed?: (event: HandlerStateChangeEvent) => void;\n onCancelled?: (event: HandlerStateChangeEvent) => void;\n onActivated?: (event: HandlerStateChangeEvent) => void;\n onEnded?: (event: HandlerStateChangeEvent) => void;\n\n //TODO(TS) consider using NativeSyntheticEvent\n onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;\n onHandlerStateChange?: (\n event: HandlerStateChangeEvent<ExtraEventPayloadT>\n ) => void;\n};\n\nexport const baseProps = [\n 'id',\n 'enabled',\n 'minPointers',\n 'waitFor',\n 'simultaneousHandlers',\n 'shouldCancelWhenOutside',\n 'hitSlop',\n 'onBegan',\n 'onFailed',\n 'onCancelled',\n 'onActivated',\n 'onEnded',\n 'onGestureEvent',\n 'onHandlerStateChange',\n] as const;\n\nexport type TapGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport interface TapGestureHandlerProps\n extends BaseGestureHandlerProps<TapGestureHandlerEventPayload> {\n minPointers?: number;\n maxDurationMs?: number;\n maxDelayMs?: number;\n numberOfTaps?: number;\n maxDeltaX?: number;\n maxDeltaY?: number;\n maxDist?: number;\n}\n\nexport type TapGestureHandler = typeof TapGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of this file\nexport const TapGestureHandler = createHandler<\n TapGestureHandlerProps,\n TapGestureHandlerEventPayload\n>({\n name: 'TapGestureHandler',\n allowedProps: [\n ...baseProps,\n 'maxDurationMs',\n 'maxDelayMs',\n 'numberOfTaps',\n 'maxDeltaX',\n 'maxDeltaY',\n 'maxDist',\n 'minPointers',\n ] as const,\n config: {},\n});\n\nexport type FlingGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport interface FlingGestureHandlerProps\n extends BaseGestureHandlerProps<FlingGestureHandlerEventPayload> {\n direction?: number;\n numberOfPointers?: number;\n}\n\nexport type FlingGestureHandler = typeof FlingGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of this file\nexport const FlingGestureHandler = createHandler<\n FlingGestureHandlerProps,\n FlingGestureHandlerEventPayload\n>({\n name: 'FlingGestureHandler',\n allowedProps: [...baseProps, 'numberOfPointers', 'direction'] as const,\n config: {},\n});\n\nclass ForceTouchFallback extends React.Component {\n static forceTouchAvailable = false;\n componentDidMount() {\n console.warn(\n 'ForceTouchGestureHandler is not available on this platform. Please use ForceTouchGestureHandler.forceTouchAvailable to conditionally render other components that would provide a fallback behavior specific to your usecase'\n );\n }\n render() {\n return this.props.children;\n }\n}\n\nexport type ForceTouchGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n force: number;\n};\n\nexport interface ForceTouchGestureHandlerProps\n extends BaseGestureHandlerProps<ForceTouchGestureHandlerEventPayload> {\n minForce?: number;\n maxForce?: number;\n feedbackOnActivation?: boolean;\n}\n\nexport type ForceTouchGestureHandler = typeof ForceTouchGestureHandler & {\n forceTouchAvailable: boolean;\n};\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of this file\nexport const ForceTouchGestureHandler = PlatformConstants?.forceTouchAvailable\n ? createHandler<\n ForceTouchGestureHandlerProps,\n ForceTouchGestureHandlerEventPayload\n >({\n name: 'ForceTouchGestureHandler',\n allowedProps: [\n ...baseProps,\n 'minForce',\n 'maxForce',\n 'feedbackOnActivation',\n ] as const,\n config: {},\n })\n : ForceTouchFallback;\n\n(ForceTouchGestureHandler as ForceTouchGestureHandler).forceTouchAvailable =\n PlatformConstants?.forceTouchAvailable || false;\n\nexport type LongPressGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport interface LongPressGestureHandlerProps\n extends BaseGestureHandlerProps<LongPressGestureHandlerEventPayload> {\n minDurationMs?: number;\n maxDist?: number;\n}\n\nexport type LongPressGestureHandler = typeof LongPressGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of this file\nexport const LongPressGestureHandler = createHandler<\n LongPressGestureHandlerProps,\n LongPressGestureHandlerEventPayload\n>({\n name: 'LongPressGestureHandler',\n allowedProps: [...baseProps, 'minDurationMs', 'maxDist'] as const,\n config: {},\n});\n\nfunction validatePanGestureHandlerProps(props: PanGestureHandlerProps) {\n if (props.minDeltaX && props.activeOffsetX) {\n throw new Error(\n `It's not supported use minDeltaX with activeOffsetXStart or activeOffsetXEnd`\n );\n }\n if (props.maxDeltaX && props.failOffsetX) {\n throw new Error(\n `It's not supported use minDeltaX with activeOffsetXStart or activeOffsetXEnd`\n );\n }\n if (props.minDeltaY && props.activeOffsetY) {\n throw new Error(\n `It's not supported use minDeltaX with activeOffsetYStart or activeOffsetYEnd`\n );\n }\n if (props.maxDeltaY && props.failOffsetY) {\n throw new Error(\n `It's not supported use minDeltaX with activeOffsetYStart or activeOffsetYEnd`\n );\n }\n if (\n Array.isArray(props.activeOffsetX) &&\n (props.activeOffsetX[0] > 0 || props.activeOffsetX[1] < 0)\n ) {\n throw new Error(\n `First element of activeOffsetX should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.activeOffsetY) &&\n (props.activeOffsetY[0] > 0 || props.activeOffsetY[1] < 0)\n ) {\n throw new Error(\n `First element of activeOffsetY should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.failOffsetX) &&\n (props.failOffsetX[0] > 0 || props.failOffsetX[1] < 0)\n ) {\n throw new Error(\n `First element of failOffsetX should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.failOffsetY) &&\n (props.failOffsetY[0] > 0 || props.failOffsetY[1] < 0)\n ) {\n throw new Error(\n `First element of failOffsetY should be negative, a the second one should be positive`\n );\n }\n}\n\nfunction transformPanGestureHandlerProps(props: PanGestureHandlerProps) {\n type InternalPanGHKeys =\n | 'activeOffsetXStart'\n | 'activeOffsetXEnd'\n | 'failOffsetXStart'\n | 'failOffsetXEnd'\n | 'activeOffsetYStart'\n | 'activeOffsetYEnd'\n | 'failOffsetYStart'\n | 'failOffsetYEnd';\n type PanGestureHandlerInternalProps = PanGestureHandlerProps &\n Partial<Record<InternalPanGHKeys, number>>;\n\n const res: PanGestureHandlerInternalProps = { ...props };\n if (props.minDeltaX !== undefined) {\n delete res.minDeltaX;\n res.activeOffsetXStart = -props.minDeltaX;\n res.activeOffsetXEnd = props.minDeltaX;\n }\n if (props.maxDeltaX !== undefined) {\n delete res.maxDeltaX;\n res.failOffsetXStart = -props.maxDeltaX;\n res.failOffsetXEnd = props.maxDeltaX;\n }\n if (props.minOffsetX !== undefined) {\n delete res.minOffsetX;\n if (props.minOffsetX < 0) {\n res.activeOffsetXStart = props.minOffsetX;\n } else {\n res.activeOffsetXEnd = props.minOffsetX;\n }\n }\n\n if (props.minDeltaY !== undefined) {\n delete res.minDeltaY;\n res.activeOffsetYStart = -props.minDeltaY;\n res.activeOffsetYEnd = props.minDeltaY;\n }\n if (props.maxDeltaY !== undefined) {\n delete res.maxDeltaY;\n res.failOffsetYStart = -props.maxDeltaY;\n res.failOffsetYEnd = props.maxDeltaY;\n }\n\n if (props.minOffsetY !== undefined) {\n delete res.minOffsetY;\n if (props.minOffsetY < 0) {\n res.activeOffsetYStart = props.minOffsetY;\n } else {\n res.activeOffsetYEnd = props.minOffsetY;\n }\n }\n\n if (props.activeOffsetX !== undefined) {\n delete res.activeOffsetX;\n if (Array.isArray(props.activeOffsetX)) {\n res.activeOffsetXStart = props.activeOffsetX[0];\n res.activeOffsetXEnd = props.activeOffsetX[1];\n } else if (props.activeOffsetX < 0) {\n res.activeOffsetXStart = props.activeOffsetX;\n } else {\n res.activeOffsetXEnd = props.activeOffsetX;\n }\n }\n\n if (props.activeOffsetY !== undefined) {\n delete res.activeOffsetY;\n if (Array.isArray(props.activeOffsetY)) {\n res.activeOffsetYStart = props.activeOffsetY[0];\n res.activeOffsetYEnd = props.activeOffsetY[1];\n } else if (props.activeOffsetY < 0) {\n res.activeOffsetYStart = props.activeOffsetY;\n } else {\n res.activeOffsetYEnd = props.activeOffsetY;\n }\n }\n\n if (props.failOffsetX !== undefined) {\n delete res.failOffsetX;\n if (Array.isArray(props.failOffsetX)) {\n res.failOffsetXStart = props.failOffsetX[0];\n res.failOffsetXEnd = props.failOffsetX[1];\n } else if (props.failOffsetX < 0) {\n res.failOffsetXStart = props.failOffsetX;\n } else {\n res.failOffsetXEnd = props.failOffsetX;\n }\n }\n\n if (props.failOffsetY !== undefined) {\n delete res.failOffsetY;\n if (Array.isArray(props.failOffsetY)) {\n res.failOffsetYStart = props.failOffsetY[0];\n res.failOffsetYEnd = props.failOffsetY[1];\n } else if (props.failOffsetY < 0) {\n res.failOffsetYStart = props.failOffsetY;\n } else {\n res.failOffsetYEnd = props.failOffsetY;\n }\n }\n\n return res;\n}\n\nfunction managePanProps(props: PanGestureHandlerProps) {\n if (__DEV__) {\n validatePanGestureHandlerProps(props);\n }\n return transformPanGestureHandlerProps(props);\n}\n\nexport type PanGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n translationX: number;\n translationY: number;\n velocityX: number;\n velocityY: number;\n};\n\nexport interface PanGestureHandlerProps\n extends BaseGestureHandlerProps<PanGestureHandlerEventPayload> {\n /** @deprecated use activeOffsetX*/\n minDeltaX?: number;\n /** @deprecated use activeOffsetY*/\n minDeltaY?: number;\n /** @deprecated use failOffsetX*/\n maxDeltaX?: number;\n /** @deprecated use failOffsetY*/\n maxDeltaY?: number;\n /** @deprecated use activeOffsetX*/\n minOffsetX?: number;\n /** @deprecated use failOffsetY*/\n minOffsetY?: number;\n activeOffsetY?: number | number[];\n activeOffsetX?: number | number[];\n failOffsetY?: number | number[];\n failOffsetX?: number | number[];\n minDist?: number;\n minVelocity?: number;\n minVelocityX?: number;\n minVelocityY?: number;\n minPointers?: number;\n maxPointers?: number;\n avgTouches?: boolean;\n enableTrackpadTwoFingerGesture?: boolean;\n}\n\nexport type PanGestureHandler = typeof PanGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of this file\nexport const PanGestureHandler = createHandler<\n PanGestureHandlerProps,\n PanGestureHandlerEventPayload\n>({\n name: 'PanGestureHandler',\n allowedProps: [\n ...baseProps,\n 'activeOffsetY',\n 'activeOffsetX',\n 'failOffsetY',\n 'failOffsetX',\n 'minDist',\n 'minVelocity',\n 'minVelocityX',\n 'minVelocityY',\n 'minPointers',\n 'maxPointers',\n 'avgTouches',\n 'enableTrackpadTwoFingerGesture',\n ] as const,\n config: {},\n transformProps: managePanProps,\n customNativeProps: [\n 'activeOffsetYStart',\n 'activeOffsetYEnd',\n 'activeOffsetXStart',\n 'activeOffsetXEnd',\n 'failOffsetYStart',\n 'failOffsetYEnd',\n 'failOffsetXStart',\n 'failOffsetXEnd',\n ],\n});\n\nexport type PinchGestureHandlerEventPayload = {\n scale: number;\n focalX: number;\n focalY: number;\n velocity: number;\n};\n\nexport interface PinchGestureHandlerProps\n extends BaseGestureHandlerProps<PinchGestureHandlerEventPayload> {}\n\nexport type PinchGestureHandler = typeof PinchGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of this file\nexport const PinchGestureHandler = createHandler<\n PinchGestureHandlerProps,\n PinchGestureHandlerEventPayload\n>({\n name: 'PinchGestureHandler',\n allowedProps: baseProps,\n config: {},\n});\n\nexport type RotationGestureHandlerEventPayload = {\n rotation: number;\n anchorX: number;\n anchorY: number;\n velocity: number;\n};\n\nexport interface RotationGestureHandlerProps\n extends BaseGestureHandlerProps<RotationGestureHandlerEventPayload> {}\n\nexport type RotationGestureHandler = typeof RotationGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of this file\nexport const RotationGestureHandler = createHandler<\n RotationGestureHandlerProps,\n RotationGestureHandlerEventPayload\n>({\n name: 'RotationGestureHandler',\n allowedProps: baseProps,\n config: {},\n});\n"]}