How to use the airbnb-prop-types.ref function in airbnb-prop-types

To help you get started, we’ve selected a few airbnb-prop-types 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 massgov / mayflower / react / src / components / atoms / buttons / ButtonWithIcon / index.js View on Github external
};
  return(
    <button aria-expanded="{expanded}">
      <span>{text}</span>
      {icon}
    </button>
  );
};

ButtonWithIcon.propTypes = {
  /** id for the button */
  id: PropTypes.string,
  // Function to run on click of the button.
  onClick: PropTypes.func,
  // Sets a reference to the button onto the passed node.
  setButtonRef: ref(),
  // Button text.
  text: PropTypes.string,
  /** HTML <button> 'type' attribute  */
  type: PropTypes.oneOf(['submit', 'reset', 'button', '']),
  // Button classes.
  classes: PropTypes.arrayOf(PropTypes.string),
  // Icon to display within the button.
  icon: PropTypes.element,
  // Adds expanded class to button if true.
  expanded: PropTypes.bool,
  // Adds capitalized class to button if true.
  capitalized: PropTypes.bool,
  // Defines the size, default size fits the most square icons and "small" setting is specific for the chevron icon.
  iconSize: PropTypes.oneOf(['', 'small']),
  /** The aria-label property is used to provide the label to any assistive
   * technologies. This is useful if the text value is not descriptive of the</button>
github airbnb / enzyme / packages / enzyme-adapter-utils / src / createMountWrapper.jsx View on Github external
// eslint-disable-next-line react/jsx-props-no-spreading
      const component = ;
      if (WrappingComponent) {
        return (
          // eslint-disable-next-line react/jsx-props-no-spreading
          
            {component}
          
        );
      }
      return component;
    }
  }
  WrapperComponent.propTypes = {
    Component: makeValidElementType(adapter).isRequired,
    refProp: PropTypes.oneOfType([PropTypes.string, ref()]),
    props: PropTypes.object.isRequired,
    wrappingComponentProps: PropTypes.object,
    context: PropTypes.object,
  };
  WrapperComponent.defaultProps = {
    refProp: null,
    context: null,
    wrappingComponentProps: null,
  };

  if (options.context &amp;&amp; (node.type.contextTypes || options.childContextTypes)) {
    // For full rendering, we are using this wrapper component to provide context if it is
    // specified in both the options AND the child component defines `contextTypes` statically
    // OR the merged context types for all children (the node component or deeper children) are
    // specified in options parameter under childContextTypes.
    // In that case, we define both a `getChildContext()` function and a `childContextTypes` prop.