How to use the hyperview/src/types.TRIGGERS.PRESS function in hyperview

To help you get started, we’ve selected a few hyperview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Instawork / hyperview / src / core / hyper-ref / index.js View on Github external
pressBehaviors.forEach(behaviorElement => {
        const trigger: PressTrigger =
          behaviorElement.getAttribute(ATTRIBUTES.TRIGGER) || TRIGGERS.PRESS;
        const triggerPropName = PRESS_TRIGGERS_PROP_NAMES[trigger];
        const handler = this.createActionHandler(
          element,
          behaviorElement,
          onUpdate,
        );
        if (pressHandlers[triggerPropName]) {
          const oldHandler = pressHandlers[triggerPropName];
          pressHandlers[triggerPropName] = () => {
            oldHandler();
            setTimeout(handler, time);
            time += 1;
          };
        } else {
          pressHandlers[triggerPropName] = handler;
        }
github Instawork / hyperview / src / core / hyper-ref / index.js View on Github external
e =>
        PRESS_TRIGGERS.indexOf(
          e.getAttribute(ATTRIBUTES.TRIGGER) || TRIGGERS.PRESS,
        ) >= 0,
    );
github Instawork / hyperview / src / core / hyper-ref / types.js View on Github external
export const PRESS_PROP_NAMES = {
  ON_LONG_PRESS: 'onLongPress',
  ON_PRESS_IN: 'onPressIn',
  ON_PRESS_OUT: 'onPressOut',
  ON_PRESS: 'onPress',
};

export type PressPropName = $Values;

export const PRESS_TRIGGERS_PROP_NAMES: {
  [PressTrigger]: PressPropName,
} = {
  [TRIGGERS.LONG_PRESS]: PRESS_PROP_NAMES.ON_LONG_PRESS,
  [TRIGGERS.PRESS_IN]: PRESS_PROP_NAMES.ON_PRESS_IN,
  [TRIGGERS.PRESS_OUT]: PRESS_PROP_NAMES.ON_PRESS_OUT,
  [TRIGGERS.PRESS]: PRESS_PROP_NAMES.ON_PRESS,
};