How to use the prop-types.object.isRequired 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 CrocoDillon / universal-react-redux-boilerplate / src / modules / App / App.js View on Github external
// @flow
import React, { Component } from 'react'
import { object } from 'prop-types'
import { renderRoutes } from 'react-router-config'

import Header from './components/Header'

class App extends Component {

  static displayName = 'App';

  static propTypes = {
    route: object.isRequired
  };

  render() {
    const styles = require('./App.scss')

    const { route } = this.props

    return (
      <div>
        <header>
        { renderRoutes(route.routes) }
      </header></div>
    )
  }
}
github rbelouin / fip.rbelouin.com / src / js / views / player-song-list.jsx View on Github external
<div>
          {favorite}
          {spotify}
        </div>
      
    );
  }
});

export default createReactClass({
  displayName: "SongList",
  propTypes: {
    songs: array.isRequired,
    favBus: object.isRequired,
    playBus: object.isRequired
  },
  getInitialState: function() {
    return {
      selectedSongId: null
    };
  },
  onFavorite: function(song) {
    this.props.favBus.push({
      type: song.favorite ? "remove" : "add",
      song: song
    });
  },
  onSelect: function(song) {
    var selectedSongId = song.id === this.state.selectedSongId ? null : song.id;

    this.setState({ selectedSongId });
github AJInteractive / InterviewJS / packages / composer / src / partials / modals / NewStoryModal.js View on Github external
{getModalBody()}
        
      
    );
  }
}

NewStoryModal.propTypes = {
  createInterviewee: func.isRequired,
  createStory: func.isRequired,
  deleteInterviewee: func.isRequired,
  handleClose: func.isRequired,
  isOpen: bool.isRequired,
  router: object.isRequired,
  stories: arrayOf(object),
  updateInterviewee: func.isRequired,
  updateStory: func.isRequired,
  user: object.isRequired,
};

NewStoryModal.defaultProps = {
  stories: [],
};
github mtrifilo / react-ssr-boilerplate / client / components / Login / LoginForm.js View on Github external
validationError={this.state.validationErrors.password}
        /&gt;
          <button type="submit">
          Submit
          </button>
      
    )
  }
}

LoginForm.propTypes = {
  dispatchLoginRequest: func.isRequired
}

LoginForm.contextTypes = {
  router: object.isRequired
}

const mapStateToProps = state =&gt; {
  return {
    loginLoading: state.loginLocal.loginLoading
  }
}

const mapDispatchToProps = dispatch =&gt; {
  return {
    dispatchLoginRequest (userData) {
      dispatch(loginRequest(userData))
    }
  }
}
github sharetribe / ftw-daily / src / components / FieldDateRangeInput / FieldDateRangeInput.js View on Github external
};

FieldDateRangeInputComponent.propTypes = {
  className: string,
  rootClassName: string,
  unitType: propTypes.bookingUnitType.isRequired,
  useMobileMargins: bool,
  endDateId: string,
  endDateLabel: string,
  endDatePlaceholderText: string,
  startDateId: string,
  startDateLabel: string,
  startDatePlaceholderText: string,
  timeSlots: arrayOf(propTypes.timeSlot),
  input: object.isRequired,
  meta: object.isRequired,
  focusedInput: oneOf([START_DATE, END_DATE]),
  onFocusedInputChange: func,
};

const FieldDateRangeInput = props =&gt; {
  return ;
};

export { DateRangeInput };
export default FieldDateRangeInput;
github ejarzo / Shape-Your-Music / src / components / Shape / Component.jsx View on Github external
import { themeColors, appColors } from 'utils/color';

import ShapeVertex from './ShapeVertex';
import Portal from 'react-portal';
import ShapeEditorPopover from './ShapeEditorPopover';
import withProjectContext from 'views/Project/withProjectContext';
import { TOOL_TYPES } from 'views/Project/Container';

const propTypes = {
  scaleObj: object.isRequired,
  activeTool: string.isRequired,
  isPlaying: bool.isRequired,
  tempo: number.isRequired,

  points: array.isRequired,
  attrs: object.isRequired,

  noteIndexModifier: number.isRequired,

  colorIndex: number.isRequired,
  index: number.isRequired,
  volume: number.isRequired,

  isSelected: bool.isRequired,
  isMuted: bool.isRequired,
  isDragging: bool.isRequired,
  isSoloed: bool.isRequired,

  dragBoundFunc: func.isRequired,
  handleDrag: func.isRequired,
  handleDragStart: func.isRequired,
  handleDragEnd: func.isRequired,
github paularmstrong / react-stateful-firestore / src / connectAuth.js View on Github external
context: {
      firebase: {
        auth: firebase.auth.Auth,
        firestore: firebase.firestore.Firestore,
        messaging: firebase.messaging.Messaging,
        selectAuth: (state: StoreState) =&gt; any,
        storage: firebase.storage.Storage,
        store: Store
      }
    };

    static displayName = 'ConnectAuth';
    static WrappedComponent = WrappedComponent;

    static contextTypes = {
      firebase: object.isRequired
    };

    constructor(props: Props, context: any) {
      super(props, context);
      this.state = { doc: emptyObject, fetchStatus: FetchStatus.LOADING };
      this._loaded = false;
    }

    componentWillMount() {
      const { store } = this.context.firebase;
      this._unsubscribe = store.subscribe(this._handleState);
      this._handleState();
    }

    componentWillUnmount() {
      if (this._unsubscribe) {
github aya-experience / citation / citation-backoffice / src / components / sitemap / LeafPage.js View on Github external
);

LeafPage.propTypes = {
	page: object.isRequired,
	direction: number.isRequired,
	position: object.isRequired,
	drag: func.isRequired
};

export default enhancer(LeafPage);
github taskcluster / taskcluster-tools / src / views / HooksManager / HookBrowser.jsx View on Github external
import { Component } from 'react';
import { string, func, object } from 'prop-types';
import TreeView from 'react-treeview';
import 'react-treeview/react-treeview.css';
import Error from '../../components/Error';

export default class HookBrowser extends Component {
  static propTypes = {
    group: string.isRequired,
    hookGroupId: string,
    hookId: string,
    selectHook: func.isRequired,
    hooks: object.isRequired
  };

  constructor(props) {
    super(props);

    this.state = {
      hooksList: null,
      error: null
    };
  }

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

  componentWillReceiveProps(nextProps) {