How to use the prop-types.number function in prop-types

To help you get started, we’ve selected a few 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 mozilla-services / screenshots / server / src / pages / shot / drawing-tool.js View on Github external
// Optional step to finish up the drawing
  }

  reset() {
    console.warn("Please override reset() in your component.");
  }
};

exports.DrawingTool.propTypes = {
  baseCanvas: PropTypes.object,
  canvasPixelRatio: PropTypes.number,
  canvasCssWidth: PropTypes.number,
  canvasCssHeight: PropTypes.number,
  updateImageCallback: PropTypes.func,
  color: PropTypes.string,
  lineWidth: PropTypes.number,
};
github youzan / zent / packages / zent / src / menu / MenuItem.tsx View on Github external
isInline?: boolean;
  handleSelect?: (specKey: unknown) => void;
  selectedKey?: unknown[];
  depth?: number;
  inlineIndent?: boolean;
}

export class MenuItem extends Component {
  static propTypes = {
    disabled: PropTypes.bool,
    prefix: PropTypes.string,
    className: PropTypes.string,
    isInline: PropTypes.bool,

    // inline模式独有props
    depth: PropTypes.number,
    inlineIndent: PropTypes.number,
    selectedKey: PropTypes.string,
    handleSelect: PropTypes.func,
  };

  static defaultProps = {
    prefix: 'zent',
  };

  handleClick = (e: React.MouseEvent) => {
    const { specKey, onClick, disabled, isInline, handleSelect } = this.props;

    if (disabled) return;

    if (isInline) {
      handleSelect(specKey);
github geosolutions-it / MapStore2 / web / client / components / background / PreviewButton.jsx View on Github external
* LICENSE file in the root directory of this source tree.
 */

const React = require('react');
const PropTypes = require('prop-types');
const Toolbar = require('../misc/toolbar/Toolbar');

require('./css/previewbutton.css');

class PreviewButton extends React.Component {
    static propTypes = {
        mode: PropTypes.string,
        src: PropTypes.string,
        side: PropTypes.number,
        frame: PropTypes.number,
        margin: PropTypes.number,
        labelHeight: PropTypes.number,
        label: PropTypes.string,
        showLabel: PropTypes.bool,
        onToggle: PropTypes.func,
        onAdd: PropTypes.func,
        currentLayer: PropTypes.object,
        enabledCatalog: PropTypes.bool,
        layers: PropTypes.array,
        mapIsEditable: PropTypes.bool
    };

    static defaultProps = {
        mode: 'desktop',
        src: './images/mapthumbs/none.jpg',
        side: 50,
        frame: 4,
github airbnb / react-sketchapp / src / components / Page.tsx View on Github external
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { or } from 'airbnb-prop-types';
import StyleSheet from '../stylesheet';
import PageStylePropTypes from './PageStylePropTypes';

export const PagePropTypes = {
  name: PropTypes.string,
  children: PropTypes.node,
  style: or([PropTypes.shape(PageStylePropTypes), PropTypes.number]),
};

type Props = PropTypes.InferProps;

export default class Page extends React.Component {
  static propTypes = PagePropTypes;

  render() {
    const { name, children, style, ...otherProps } = this.props;
    const _name = name === 'Symbols' ? 'Symbols (renamed to avoid conflict)' : name;
    const _style = StyleSheet.flatten(style);

    return (
      
        {children}
github Superjo149 / auryo / src / renderer / _shared / CustomScroll.jsx View on Github external
try {
    const PropTypes = require('prop-types')
    CustomScroll.propTypes = {
        className: PropTypes.string,
        children: PropTypes.any,
        allowOuterScroll: PropTypes.bool,
        heightRelativeToParent: PropTypes.string,
        onScroll: PropTypes.func,
        addScrolledClass: PropTypes.bool,
        freezePosition: PropTypes.bool,
        handleClass: PropTypes.string,
        minScrollHandleHeight: PropTypes.number,
        flex: PropTypes.string,
        rtl: PropTypes.bool,
        scrollTo: PropTypes.number,
        threshold: PropTypes.number,
        heightMargin: PropTypes.number,
        keepAtBottom: PropTypes.bool,
        isFetching: PropTypes.bool,
        loadMore: PropTypes.func,
        loader: PropTypes.any
    }
} catch (e) {
} //eslint-disable-line no-empty

CustomScroll.defaultProps = {
    handleClass: 'inner-handle',
    minScrollHandleHeight: 38,
    threshold: 250,
    className: '',
    isFetching: false
}
github LLK / scratch-www / src / components / formik-forms / formik-radio-button.jsx View on Github external
);

FormikRadioButtonSubComponent.propTypes = {
    children: PropTypes.node,
    className: PropTypes.string,
    field: PropTypes.shape({
        name: PropTypes.string,
        onBlur: PropTypes.function,
        onChange: PropTypes.function,
        value: PropTypes.string
    }),
    id: PropTypes.string,
    label: PropTypes.string,
    labelClassName: PropTypes.string,
    value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
};


const FormikRadioButton = ({
    className,
    id,
    isCustomInput,
    label,
    name,
    onSetCustom,
    onSetCustomRef,
    value,
    ...props
}) => (
github geosolutions-it / MapStore2 / web / client / plugins / WidgetsBuilder.jsx View on Github external
connect(
        createSelector(
            dependenciesSelector,
            availableDependenciesSelector,
            (dependencies, availableDependenciesProps) => ({ dependencies, ...availableDependenciesProps }))
        , { toggleConnection }),
    withMapExitButton
)(require('./widgetbuilder/WidgetTypeBuilder'));

class SideBarComponent extends React.Component {
     static propTypes = {
         id: PropTypes.string,
         enabled: PropTypes.bool,
         limitDockHeight: PropTypes.bool,
         fluid: PropTypes.bool,
         zIndex: PropTypes.number,
         dockSize: PropTypes.number,
         position: PropTypes.string,
         onMount: PropTypes.func,
         onUnmount: PropTypes.func,
         onClose: PropTypes.func,
         dimMode: PropTypes.string,
         src: PropTypes.string,
         style: PropTypes.object,
         layout: PropTypes.object,
         shortenChartLabelThreshold: PropTypes.number
     };
     static defaultProps = {
         id: "widgets-builder-plugin",
         enabled: false,
         dockSize: 500,
         limitDockHeight: true,
github BlameDeng / xue-react / packages / message / Message.tsx View on Github external
const componentName = 'Message'

class Message extends React.Component {
  public static displayName = componentName

  public static info: (options: Options) => any = info
  public static success: (options: Options) => any = success
  public static warning: (options: Options) => any = warning
  public static error: (options: Options) => any = error
  public static removeMessage: (messageId: string) => any = removeMessage

  public static propTypes = {
    content: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
    mode: PropTypes.oneOf(['info', 'success', 'warning', 'error']).isRequired,
    top: PropTypes.number.isRequired,
    duration: PropTypes.number,
    showIcon: PropTypes.bool,
    messageId: PropTypes.string,
    className: PropTypes.string,
    style: PropTypes.object
  }

  public state = {
    visible: false
  }

  private closeTimeout: any
  private leaveTimeout: any

  public componentDidMount() {
    const { duration } = this.props
    this.setState({
github buildo / react-cookie-banner / src / CookieBanner.tsx View on Github external
*/
export default class CookieBanner extends React.Component {

  static propTypes = {
    ...BannerContentPropTypes,
    children: PropTypes.oneOfType([
      PropTypes.node,
      PropTypes.func
    ]),
    onAccept: PropTypes.func,
    cookies: PropTypes.instanceOf(Cookies),
    cookie: PropTypes.string,
    cookieExpiration: PropTypes.oneOfType([
      PropTypes.number,
      PropTypes.shape({
        years: PropTypes.number,
        days: PropTypes.number,
        hours: PropTypes.number
      })
    ]),
    cookiePath: PropTypes.string,
    dismissOnScroll: PropTypes.bool,
    dismissOnScrollThreshold: PropTypes.number
  }

  static defaultProps = {
    onAccept: () => {},
    dismissOnScroll: true,
    cookies: new Cookies(),
    cookie: 'accepts-cookies',
    cookieExpiration: { years: 1 },
    buttonMessage: 'Got it',
github fmoo / react-typeahead / src / typeahead / index.js View on Github external
var fuzzy = require('fuzzy');
var classNames = require('classnames');
var createReactClass = require('create-react-class');
var PropTypes = require('prop-types');

/**
 * A "typeahead", an auto-completing text input
 *
 * Renders an text input that shows options nearby that you can use the
 * keyboard or mouse to select.  Requires CSS for MASSIVE DAMAGE.
 */
var Typeahead = createReactClass({
  propTypes: {
    name: PropTypes.string,
    customClasses: PropTypes.object,
    maxVisible: PropTypes.number,
    resultsTruncatedMessage: PropTypes.string,
    options: PropTypes.array,
    allowCustomValues: PropTypes.number,
    initialValue: PropTypes.string,
    value: PropTypes.string,
    placeholder: PropTypes.string,
    disabled: PropTypes.bool,
    textarea: PropTypes.bool,
    inputProps: PropTypes.object,
    onOptionSelected: PropTypes.func,
    onChange: PropTypes.func,
    onKeyDown: PropTypes.func,
    onKeyPress: PropTypes.func,
    onKeyUp: PropTypes.func,
    onFocus: PropTypes.func,
    onBlur: PropTypes.func,