MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / isGesture

Function isGesture

packages/core/ui/core/bindable/index.ts:66–78  ·  view source on GitHub ↗
(eventOrGestureName: string)

Source from the content-addressed store, hash-verified

64}
65
66export function isGesture(eventOrGestureName: string): boolean {
67 // Not sure whether this trimming and lowercasing is still needed in practice
68 // (all Core tests pass without it), so worth revisiting in future. I think
69 // this is used exclusively by the XML flavour, and my best guess is that
70 // maybe it's to handle how getEventOrGestureName("onTap") might pass "Tap"
71 // into this.
72 const t = eventOrGestureName.trim().toLowerCase();
73
74 // Would be nice to have a convenience function for getting all GestureState
75 // names in `gestures-common.ts`, but when I tried introducing it, it created
76 // a circular dependency that crashed the automated tests app.
77 return t === 'tap' || t === 'doubletap' || t === 'pinch' || t === 'pan' || t === 'swipe' || t === 'rotation' || t === 'longpress' || t === 'touch';
78}
79
80// TODO: Make this instance function so that we dont need public static tapEvent = "tap"
81// in controls. They will just override this one and provide their own event support.

Callers 1

isEventOrGestureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected