How to use the prop-types.objectOf 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 weihanglo / pycontw-mobile / js / components / ScheduleList / index.js View on Github external
import Header from './Header'
import Filter from './Filter'
import TagPopover from './TagPopover'
import I18n from '../../i18n'

const SCALE_MIN_FACTOR = 0.95

const MODAL_MAP = 'MODAL_MAP'
const MODAL_FILTER = 'MODAL_FILTER'
const MODAL_TAGPOPOVER = 'MODAL_TAGPOPOVER'

export default class extends React.Component {
  static propTypes = {
    dates: PropTypes.arrayOf(PropTypes.string),
    favoriteEvents: PropTypes.objectOf(PropTypes.bool),
    filter: PropTypes.objectOf(PropTypes.bool),
    isFetching: PropTypes.bool,
    schedule: PropTypes.array,
    selectedDate: PropTypes.string,
    tagMapping: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
    syncCompleted: PropTypes.bool,
    fetchSchedule: PropTypes.func,
    goToSchedule: PropTypes.func, // for MyScheduleList only
    onCellPress: PropTypes.func,
    saveFavorites: PropTypes.func,
    selectDate: PropTypes.func,
    updateFilter: PropTypes.func,
    navigation: PropTypes.object,
    style: ViewPropTypes.style
  }

  state = {
github kleros / tokens-on-trial / src / containers / action-modal / index.js View on Github external
import './action-modal.css'

class ActionModal extends PureComponent {
  static propTypes = {
    token: tokenSelectors.tokenShape,
    badge: badgeSelectors.badgeShape,
    tokenFormIsInvalid: PropTypes.bool.isRequired,
    evidenceFormIsInvalid: PropTypes.bool.isRequired,
    openActionModal: modalSelectors.openActionModalShape,
    closeActionModal: PropTypes.func.isRequired,
    actionModalParam: PropTypes.shape({}),
    envObjects: PropTypes.shape({}).isRequired,
    arbitrableTokenListData:
      arbitrableTokenListSelectors.arbitrableTokenListDataShape.isRequired,
    badgeContracts: PropTypes.objectOf(
      arbitrableAddressListSelectors._arbitrableAddressListDataShape
    ),

    // Token actions
    fetchArbitrableTokenListData: PropTypes.func.isRequired,
    fetchArbitrableAddressListData: PropTypes.func.isRequired,
    submitTokenForm: PropTypes.func.isRequired,
    submitTokenEvidence: PropTypes.func.isRequired,
    submitEvidenceForm: PropTypes.func.isRequired,
    createToken: PropTypes.func.isRequired,
    clearToken: PropTypes.func.isRequired,
    fundDispute: PropTypes.func.isRequired,
    challengeRequest: PropTypes.func.isRequired,
    resubmitToken: PropTypes.func.isRequired,
    fundAppeal: PropTypes.func.isRequired,
github Apiki / next.js-starter-project / src / components / card / index.js View on Github external
<p>{excerpt}</p>
    

    <div>
      <a href="{link}">This is a link</a>
    </div>
  
);

Card.propTypes = {
  link: t.string.isRequired,
  title: t.string,
  excerpt: t.string,
  featuredMedia: t.shape({
    alt: t.string,
    sizes: t.objectOf(t.object).isRequired,
  }).isRequired,
};

export { Card };
github bbc / simorgh / src / app / containers / ArticleFigure / fixtureData.jsx View on Github external
captionBlock={caption}
        copyright={copyright}
        height={height}
        ratio={imageRatio}
        src={imageSrc}
        width={width}
        type={type}
        lazyLoad={lazyLoad}
        showCopyright
      /&gt;
    
  
);

GenerateFixtureData.propTypes = {
  caption: objectOf(any),
  copyright: string,
  lazyLoad: bool,
  platform: string,
  type: string,
  height: number,
  width: number,
  service: string,
};

GenerateFixtureData.defaultProps = {
  caption: null,
  copyright: null,
  lazyLoad: false,
  platform: 'canonical',
  type: '',
  height: imageHeight,
github macarthur-lab / gnomadjs / projects / gnomad / src / client / TissueExpressionTrack.js View on Github external
)

IndividualTissueTrack.propTypes = {
  exons: PropTypes.arrayOf(
    PropTypes.shape({
      start: PropTypes.number.isRequired,
      stop: PropTypes.number.isRequired,
    })
  ).isRequired,
  expressionRegions: PropTypes.arrayOf(
    PropTypes.shape({
      start: PropTypes.number.isRequired,
      stop: PropTypes.number.isRequired,
      mean: PropTypes.number,
      tissues: PropTypes.objectOf(PropTypes.number).isRequired,
    })
  ).isRequired,
  tissue: PropTypes.string.isRequired,
}

class TissueExpressionTrack extends Component {
  static propTypes = {
    exons: PropTypes.arrayOf(
      PropTypes.shape({
        start: PropTypes.number.isRequired,
        stop: PropTypes.number.isRequired,
      })
    ).isRequired,
    expressionRegions: PropTypes.arrayOf(
      PropTypes.shape({
        start: PropTypes.number.isRequired,
github sociomantic-tsunami / nessie-ui / src / DatePicker / DatePickerItem.jsx View on Github external
selected    : isSelected,
                type,
            } ) }
            disabled     = { isDisabled }
            onClick      = { handleClick }
            type         = "button"
            value        = { value }&gt;
            
        
    );
};

DatePickerItem.propTypes = {
    children   : PropTypes.node,
    className  : PropTypes.string,
    cssMap     : PropTypes.objectOf( PropTypes.string ),
    forceHover : PropTypes.bool,
    isDisabled : PropTypes.bool,
    isSelected : PropTypes.bool,
    isReadOnly : PropTypes.bool,
    label      : PropTypes.string,
    onClick    : PropTypes.func,
    value      : PropTypes.string,
    type       : PropTypes.oneOf( [ 'day', 'month' ] ),
};

DatePickerItem.defaultProps = {
    children   : undefined,
    className  : undefined,
    cssMap     : styles,
    forceHover : false,
    isDisabled : false,
github OpusCapita / fsm-workflow / gui / src / client / components / Inspector / Inspector.react.js View on Github external
}, {
      "name": "Approve order",
      "arguments": {
        "orderId": "order-7"
      }
    }]
  }
};

const propTypes = {
  options: PropTypes.objectOf(
    PropTypes.shape({
      name: PropTypes.string,
      items: PropTypes.arrayOf(PropTypes.shape({
        name: PropTypes.string,
        arguments: PropTypes.objectOf(PropTypes.any)
      })),
      onAdd: PropTypes.func,
      onDelete: PropTypes.func
    })
  ),
  name: PropTypes.string,
  description: PropTypes.string,
  deleteButtonLabel: PropTypes.string,
  onNameChange: PropTypes.func,
  onDescriptionChange: PropTypes.func,
  contentElement1: PropTypes.element,
  contentElement2: PropTypes.element
};

const defaultProps = {
  options: defaultOptions,
github chainer / chainerui / frontend / src / components / LogExporter.jsx View on Github external
}
}

LogExporter.propTypes = {
  project: PropTypes.shape({
    id: PropTypes.number,
    name: PropTypes.string,
    pathName: PropTypes.string
  }).isRequired,
  results: PropTypes.objectOf(PropTypes.any).isRequired,
  stats: PropTypes.shape({
    logKeys: PropTypes.arrayOf(PropTypes.string),
    xAxisKeys: PropTypes.arrayOf(PropTypes.string)
  }).isRequired,
  projectConfig: PropTypes.shape({
    axes: PropTypes.objectOf(PropTypes.shape({
      axisName: PropTypes.string,
      logKeysConfig: PropTypes.objectOf(PropTypes.shape({
        selected: PropTypes.bool
      }))
    })),
    resultsConfig: PropTypes.objectOf(PropTypes.shape({
      hidden: PropTypes.bool
    })),
    lines: PropTypes.objectOf(
      PropTypes.shape({
        resultId: PropTypes.number,
        logKey: PropTypes.string,
        config: PropTypes.shape({
          color: PropTypes.string,
          isVisible: PropTypes.bool
        })
github veritone / veritone-sdk / packages / veritone-widgets / src / widgets / SourceDropdownMenu / index.js View on Github external
import React from 'react';
import { arrayOf, objectOf, any, func, string } from 'prop-types';
import { SourceDropdownMenu } from 'veritone-react-common';

import widget from '../../shared/widget';

class SourceDropdownMenuWidget extends React.Component {
  static propTypes = {
    sourceId: string,
    sources: arrayOf(objectOf(any)).isRequired,
    handleSourceChange: func.isRequired,
    openCreateSource: func.isRequired,
    closeCreateSource: func.isRequired,
    loadNextPage: func.isRequired
  };

  state = {
    sourceId: this.props.sourceId
  };

  handleSourceChange = sourceId => {
    let newState = { sourceId };
    this.setState(newState, this.sendSourceIdToParent);
  };

  sendSourceIdToParent = () => {
github apache / incubator-superset / superset / assets / src / dashboard / components / SliceAdder.jsx View on Github external
import { CellMeasurer, CellMeasurerCache, List } from 'react-virtualized';
import SearchInput, { createFilter } from 'react-search-input';
import { t } from '@superset-ui/translation';

import AddSliceCard from './AddSliceCard';
import AddSliceDragPreview from './dnd/AddSliceDragPreview';
import DragDroppable from './dnd/DragDroppable';
import Loading from '../../components/Loading';
import { CHART_TYPE, NEW_COMPONENT_SOURCE_TYPE } from '../util/componentTypes';
import { NEW_CHART_ID, NEW_COMPONENTS_SOURCE_ID } from '../util/constants';
import { slicePropShape } from '../util/propShapes';

const propTypes = {
  fetchAllSlices: PropTypes.func.isRequired,
  isLoading: PropTypes.bool.isRequired,
  slices: PropTypes.objectOf(slicePropShape).isRequired,
  lastUpdated: PropTypes.number.isRequired,
  errorMessage: PropTypes.string,
  userId: PropTypes.string.isRequired,
  selectedSliceIds: PropTypes.arrayOf(PropTypes.number).isRequired,
  editMode: PropTypes.bool,
  height: PropTypes.number,
};

const defaultProps = {
  selectedSliceIds: [],
  editMode: false,
  errorMessage: '',
  height: window.innerHeight,
};

const KEYS_TO_FILTERS = ['slice_name', 'viz_type', 'datasource_name'];