How to use the prop-types.PropTypes.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 Vizzuality / gfw / app / javascript / components / charts / sankey-chart / sankey.js View on Github external
customNode: PropTypes.node,
  /** Function that takes the node info and returns the components to add at the bottom of the tooltip */
  // tooltipChildren: PropTypes.func,
  /** Configuration */
  config: PropTypes.shape({
    /** Configuration for the tooltip */
    tooltip: PropTypes.object,
    /** Configuration for each node */
    node: PropTypes.object,
    /** Configuration for the aspect of the responsive container */
    aspect: PropTypes.number
  }),
  /** Set margin of sankey component, used to calculate a position of all child elements inside sankey charts  */
  margin: PropTypes.shape({
    top: PropTypes.number,
    right: PropTypes.number,
    bottom: PropTypes.number,
    left: PropTypes.number
  }),
  handleMouseOver: PropTypes.func,
  handleMouseLeave: PropTypes.func,
  handleOnClick: PropTypes.func,
  handleOutsideClick: PropTypes.func
};

SankeyChart.defaultProps = {
  width: 960,
  height: 500,
  data: {},
  nodeWidth: 140,
  nodePadding: 10,
  containerWidth: 800,
github elastic / kibana / x-pack / legacy / plugins / ml / public / components / job_selector / timerange_bar / timerange_bar.js View on Github external
<div>
          <div style="{{">
        </div>
        <div style="{style}">
      
    
  );
}

TimeRangeBar.propTypes = {
  ganttBarWidth: PropTypes.number,
  isRunning: PropTypes.bool,
  timerange: PropTypes.shape({
    widthPx: PropTypes.number,
    label: PropTypes.string,
    fromPx: PropTypes.number,
  }),
};
</div></div>
github TakwimuAfrica / Takwimu / takwimu / takwimu_ui / src / components / AboutContent / ContentNavigation.js View on Github external
onClick={(e, index) => {
        e.preventDefault();

        window.history.pushState(null, '', generateHref(index));
        changeActiveContent(index)();
      }}
      linksPrimaryColor={linksPrimaryColor}
      linksSecondaryColor={linksSecondaryColor}
    />
  );
}

AboutContentNavigation.propTypes = {
  classes: PropTypes.shape({}).isRequired,
  title: PropTypes.string.isRequired,
  current: PropTypes.number.isRequired,
  contentHeadings: PropTypes.arrayOf(PropTypes.shape({}).isRequired).isRequired,
  changeActiveContent: PropTypes.func.isRequired,
  linksPrimaryColor: PropTypes.string,
  linksSecondaryColor: PropTypes.string
};

AboutContentNavigation.defaultProps = {
  linksPrimaryColor: 'primary',
  linksSecondaryColor: 'textPrimary'
};

export default withStyles(styles)(AboutContentNavigation);
github jhen0409 / react-native-layout-provider / src / defaultLayoutTypes.js View on Github external
import { PropTypes } from 'prop-types'

export default {
  label: PropTypes.string.isRequired,
  viewport: PropTypes.shape({
    width: PropTypes.number.isRequired,
    height: PropTypes.number.isRequired,
  }).isRequired,
  portrait: PropTypes.bool,
}
github MartinCerny-awin / isomorphic-react-redux-saga-ssr / src / universal / modules / photo / components / Photos.jsx View on Github external
import React, { Component } from 'react';
import { PropTypes } from 'prop-types';

export default class Photos extends Component {
  static defaultProps = {
    photos: [],
  };

  static propTypes = {
    requestPhotos: PropTypes.func.isRequired,
    photos: PropTypes.arrayOf(
      PropTypes.shape({
        id: PropTypes.number.isRequired,
        thumbnailUrl: PropTypes.string.isRequired,
      }),
    ),
  };

  componentWillMount() {
    this.props.requestPhotos();
  }

  render() {
    return (
      <div>
        <h2>Album</h2>

        {this.props.photos
          ? this.props.photos.map(({ id, thumbnailUrl }) =&gt; <img alt="{thumbnailUrl}" src="{thumbnailUrl}">)</div>
github dnnsoftware / Dnn.Platform / TreeControlInteractor / src / TreeControlInteractor.jsx View on Github external
fullyChecked={this.fullyChecked}
                    individuallyChecked={this.individuallyChecked}
                    unchecked={this.unchecked}
                    updateTree={this.updateTree.bind(this)}
                    reAlignTree={this.reAlignTree.bind(this)}
                    findParent={this.findParent.bind(this)}
                /&gt;
            
        );

    }
}

TreeControlInteractor.propTypes = {
    selectedColor: PropTypes.string.isRequired,
    characterLimit: PropTypes.number.isRequired,
    PortalTabsParameters: PropTypes.object.isRequired,
    OnSelect: PropTypes.func.isRequired,
    PortalTabParameters: PropTypes.object.isRequired,
    getInitialPortalTabs: PropTypes.func.isRequired,
    getDescendantPortalTabs: PropTypes.func.isRequired
};
github hackoregon / civic / packages / 2019-disaster-game / src / components / atoms / TitleBar / JourneyBar.new.js View on Github external
JourneyBar.propTypes = {
  badge: PropTypes.shape({
    badgeSVG: PropTypes.string,
    title: PropTypes.string,
    id: PropTypes.string,
    shown: PropTypes.bool,
    activeTaskIndexWhenEarned: PropTypes.oneOfType([null, PropTypes.number])
  }),
  activeChapterIndex: PropTypes.number,
  activeChapterId: PropTypes.string,
  activeTaskPhase: PropTypes.string,
  activeChapterDuration: PropTypes.number,
  allTaskPhaseData: PropTypes.objectOf(
    PropTypes.shape({
      time: PropTypes.number
    })
  ),
  activeTaskIndex: PropTypes.number
};

const mapStateToProps = state => ({
  activeChapterIndex: getActiveChapterIndex(state),
  activeChapterId: getActiveChapterId(state),
  activeTaskPhase: getTaskPhase(state),
  activeChapterDuration: getActiveChapterDuration(state),
  allTaskPhaseData: getAllTaskPhaseData(state),
  activeTaskIndex: getActiveTaskIndex(state)
});

export default connect(mapStateToProps)(JourneyBar);
github hackoregon / civic / packages / 2019-disaster-game / src / components / Game / TaskScreen / index.js View on Github external
);
};

TaskScreenContainer.propTypes = {
  startChapterAndPhaseTimers: PropTypes.func,
  finishSolveTaskEarly: PropTypes.func,
  taskPhase: PropTypes.oneOf([...Object.values(taskPhaseKeys)]),
  playerKit: PropTypes.shape({}),
  activeTask: PropTypes.shape({
    id: PropTypes.string,
    time: PropTypes.number,
    audioInstruction: PropTypes.string,
    audioQuestion: PropTypes.string,
    requiredItem: PropTypes.string,
    numberItemsToSolve: PropTypes.number,
    peopleSavedRange: PropTypes.arrayOf(PropTypes.number),
    petsSaved: PropTypes.number,
    imageSVG: PropTypes.string,
    imageAlt: PropTypes.string,
    sceneSVG: PropTypes.string,
    sceneAlt: PropTypes.string,
    clue: PropTypes.string,
    saveYourselfClue: PropTypes.string,
    completed: PropTypes.bool,
    completedResults: PropTypes.shape({
      people: PropTypes.number,
      pets: PropTypes.number
    })
  }),
  restartGame: PropTypes.func,
  endingChapter: PropTypes.bool,
  endChapter: PropTypes.func,
github FaridSafi / react-native-basketball / components / Ball.js View on Github external
backgroundColor: 'transparent',
  },
});

Ball.defaultProps = {
  onStart: () => {},
  x: 0,
  y: 0,
  radius: 48,
  rotate: 0,
  scale: 1,
};

Ball.propTypes = {
  onStart: PropTypes.func,
  x: PropTypes.number,
  y: PropTypes.number,
  radius: PropTypes.number,
  rotate: PropTypes.number,
  scale: PropTypes.number,
};

export default Ball;
github iproduct / course-node-express-react / 12-react-demo-sqlite-custom-form / src / 02-comment-form-uncontrolled / comment.jsx View on Github external
import React from "react";
import {PropTypes} from 'prop-types';
import Remarkable from 'remarkable';

let md = new Remarkable();

class Comment extends React.Component {
  static propTypes = {
    commentId: PropTypes.number.isRequired,
    author: PropTypes.string,
    children: PropTypes.any,
    onCommentDelete: PropTypes.func
  };

  rawMarkup = () => {
    let rawMarkup = '';
    if (this.props.children) {
      rawMarkup = md.render(this.props.children.toString());
    }
    return { __html: rawMarkup };
  };

  handleDelete = () => {
    let commentId = this.props.commentId;
    if (!commentId) {