How to use the prop-types.PropTypes.func 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 OasisDEX / oasis-react / src / containers / EthereumAddressInputField.jsx View on Github external
// import ImmutablePropTypes from 'react-immutable-proptypes';

import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import EthereumAddressInput from "../components/EthereumAddressInput";
import { Field } from "redux-form/immutable";
import web3 from "../bootstrap/web3";
import CSSModule from "react-css-modules";
import style from "./EthereumAddressInputField.scss";
import { VALIDATION_VALUE_IS_REQUIRED } from '../constants';

const propTypes = PropTypes && {
  fieldName: PropTypes.string.isRequired,
  actions: PropTypes.object.isRequired,
  disabled: PropTypes.bool,
  onValidityChange: PropTypes.func
};

export const VALIDATION_ERROR__NOT_ETHEREUM_ADDRESS_FORMAT =
  "VALIDATION_ERROR/NOT_ETHEREUM_ADDRESS_FORMAT";

export class EthereumAddressInputFieldWrapper extends PureComponent {
  constructor(props) {
    super(props);
    this.componentIsUnmounted = false;
    this.validateEthereumAddress = this.validateEthereumAddress.bind(this);
  }

  render() {
    const { fieldName, disabled } = this.props;
    return (
      <div></div>
github testshallpass / react-native-simple-stepper / src / SimpleStepper.js View on Github external
export default class SimpleStepper extends Component {
  static propTypes = {
    value: PropTypes.number,
    initialValue: PropTypes.number,
    minimumValue: PropTypes.number,
    maximumValue: PropTypes.number,
    stepValue: PropTypes.number,
    valueChanged: PropTypes.func,
    activeOpacity: PropTypes.number,
    disabledOpacity: PropTypes.number,
    incrementImage: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    decrementImage: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    disabled: PropTypes.bool,
    renderDecrementImage: PropTypes.func,
    renderIncrementImage: PropTypes.func,
    renderDecrementStep: PropTypes.func,
    renderIncrementStep: PropTypes.func,
    wraps: PropTypes.bool,
    onMin: PropTypes.func,
    onMax: PropTypes.func,
    onIncrement: PropTypes.func,
    onDecrement: PropTypes.func,
    showText: PropTypes.bool,
    renderText: PropTypes.func,
    textStyle: PropTypes.object,
    containerStyle: PropTypes.object,
    separatorStyle: PropTypes.object,
    incrementStepStyle: PropTypes.object,
    decrementStepStyle: PropTypes.object,
    incrementImageStyle: PropTypes.object,
    decrementImageStyle: PropTypes.object,
  };
github StephenChou1017 / react-big-scheduler / src / ResourceEvents.js View on Github external
constructor(props) {
        super(props);

        this.state = {
            isSelecting: false,
            left: 0,
            width: 0,
        }
    }

    static propTypes = {
        resourceEvents: PropTypes.object.isRequired,
        schedulerData: PropTypes.object.isRequired,
        dndSource: PropTypes.object.isRequired,
        onSetAddMoreState: PropTypes.func,
        updateEventStart: PropTypes.func,
        updateEventEnd: PropTypes.func,
        moveEvent: PropTypes.func,
        movingEvent: PropTypes.func,
        conflictOccurred: PropTypes.func,
        subtitleGetter: PropTypes.func,
        eventItemClick: PropTypes.func,
        viewEventClick: PropTypes.func,
        viewEventText:PropTypes.string,
        viewEvent2Click: PropTypes.func,
        viewEvent2Text: PropTypes.string,
        newEvent: PropTypes.func,
        eventItemTemplateResolver: PropTypes.func,
    }

    componentDidMount() {
        const {schedulerData} = this.props;
github iproduct / course-node-express-react / 17-react-todos-redux-es7-decorator / src / app / components / todo-details.js View on Github external
import React from 'react';
import { PropTypes } from 'prop-types';

class TodoDetails extends React.Component {
  static propTypes = {
    todo: PropTypes.object,
    onTodoEdited: PropTypes.func,
    onTodoCanceled: PropTypes.func
  };

  constructor(props) {
    super(props);
    this.state = { masterTodo: props.todo, editedTodo: { ...props.todo } };
  }

  componentWillReceiveProps(nextProps) {
    this.setState({ masterTodo: nextProps.todo, editedTodo: { ...nextProps.todo } } );
  }

  render() {
    return (
    <form>
      <hr>
      <div></div></form>
github cescoferraro / react-boil / shared / components / styles.context.tsx View on Github external
import * as React from "react";
import { PropTypes } from "prop-types";


export class PostCSSProvider extends React.Component {
    static propTypes = {
        children: PropTypes.element.isRequired,
        onInsertCss: PropTypes.func.isRequired,
    };

    static childContextTypes = {
        insertCss: PropTypes.func.isRequired,
    };

    getChildContext() {
        return { insertCss: this.props.onInsertCss };
    }

    render() {
        return React.Children.only(this.props.children);
    }
}
github StephenChou1017 / react-big-scheduler / src / AddMorePopover.js View on Github external
constructor(props) {
        super(props);

        this.state = {
            dndSource: new DnDSource((props) => { return props.eventItem;}, EventItem),
        }
    }

    static propTypes = {
        schedulerData: PropTypes.object.isRequired,
        headerItem: PropTypes.object.isRequired,
        left: PropTypes.number.isRequired,
        top: PropTypes.number.isRequired,
        height: PropTypes.number.isRequired,
        closeAction: PropTypes.func.isRequired,
        subtitleGetter: PropTypes.func,
        moveEvent: PropTypes.func,
        eventItemClick: PropTypes.func,
        viewEventClick: PropTypes.func,
        viewEventText:PropTypes.string,
        viewEvent2Click: PropTypes.func,
        viewEvent2Text: PropTypes.string,
        eventItemTemplateResolver: PropTypes.func,
    }

    render() {
        const {headerItem, left, top, height, closeAction, schedulerData} = this.props;
        const {config, localeMoment} = schedulerData;
        const {time, start, end, events} = headerItem;
        let header = localeMoment(time).format(config.addMorePopoverHeaderFormat);
        let durationStart = localeMoment(start);
        let durationEnd = localeMoment(end);
github benfluleck / HelloBooks / client / src / app / components / container / booklist / DisplayRecentBooks.jsx View on Github external
<div>
        
          <div>
            {[...getAllBooks]}
          </div>
        
      </div>
    );
  }
}

DisplayRecentBooks.propTypes = {
  offset: PropTypes.number,
  limit: PropTypes.number,
  books: PropTypes.object,
  fetchAllRecentBooks: PropTypes.func.isRequired,
  recentBooks: PropTypes.arrayOf(PropTypes.shape({
    id: PropTypes.number
  }))
};

export { DisplayRecentBooks };

DisplayRecentBooks.defaultProps = {
  limit: 8,
  offset: 0
};

const mapStateToProps = ({ bookReducer }) =&gt; ({
  recentBooks: bookReducer.recentBooksList
});
github hackoregon / civic / packages / 2019-disaster-game / src / components / Game / SummaryScreen / index.js View on Github external
css={buttonStyle}
          onClick={restartGame}
          onTouchEnd={restartGame}
        &gt;
          <p>PLAY AGAIN</p>
        
      
    
  );
};

SummaryScreen.propTypes = {
  goToNextChapter: PropTypes.func,
  goToChapter: PropTypes.func,
  resetStateKit: PropTypes.func,
  resetStateTasks: PropTypes.func,
  increasePlayCount: PropTypes.func,
  playCount: PropTypes.number,
  reloadMode: PropTypes.bool,
  playAudio: PropTypes.func,
  stopAudio: PropTypes.func
};

const mapStateToProps = state =&gt; ({
  reloadMode: getReloadMode(state)
});

const mapDispatchToProps = dispatch =&gt; ({
  goToNextChapter: bindActionCreators(_goToNextChapter, dispatch),
  goToChapter: bindActionCreators(_goToChapter, dispatch),
  resetStateKit: bindActionCreators(_resetStateKit, dispatch),
  resetStateTasks: bindActionCreators(_resetStateTasks, dispatch),
github StephenChou1017 / react-big-scheduler / src / index.js View on Github external
nextClick: PropTypes.func.isRequired,
        onViewChange: PropTypes.func.isRequired,
        onSelectDate: PropTypes.func.isRequired,
        onSetAddMoreState: PropTypes.func,
        updateEventStart: PropTypes.func,
        updateEventEnd: PropTypes.func,
        moveEvent: PropTypes.func,
        movingEvent: PropTypes.func,
        leftCustomHeader: PropTypes.object,
        rightCustomHeader: PropTypes.object,
        newEvent: PropTypes.func,
        subtitleGetter: PropTypes.func,
        eventItemClick: PropTypes.func,
        viewEventClick: PropTypes.func,
        viewEventText: PropTypes.string,
        viewEvent2Click: PropTypes.func,
        viewEvent2Text: PropTypes.string,
        conflictOccurred: PropTypes.func,
        eventItemTemplateResolver: PropTypes.func,
        dndSources: PropTypes.array,
        slotClickedFunc: PropTypes.func,
        toggleExpandFunc: PropTypes.func,
        slotItemTemplateResolver: PropTypes.func,
        nonAgendaCellHeaderTemplateResolver: PropTypes.func,
        onScrollLeft: PropTypes.func,
        onScrollRight: PropTypes.func,
        onScrollTop: PropTypes.func,
        onScrollBottom: PropTypes.func,
    }

    componentDidMount(props, state){
        this.resolveScrollbarSize();
github StephenChou1017 / react-big-scheduler / src / EventItem.js View on Github external
width: PropTypes.number.isRequired,
        top: PropTypes.number.isRequired,
        isInPopover: PropTypes.bool.isRequired,
        leftIndex: PropTypes.number.isRequired,
        rightIndex: PropTypes.number.isRequired,
        isDragging: PropTypes.bool.isRequired,
        connectDragSource: PropTypes.func.isRequired,
        connectDragPreview: PropTypes.func.isRequired,
        updateEventStart: PropTypes.func,
        updateEventEnd: PropTypes.func,
        moveEvent: PropTypes.func,
        subtitleGetter: PropTypes.func,
        eventItemClick: PropTypes.func,
        viewEventClick: PropTypes.func,
        viewEventText: PropTypes.string,
        viewEvent2Click: PropTypes.func,
        viewEvent2Text: PropTypes.string,
        conflictOccurred: PropTypes.func,
        eventItemTemplateResolver: PropTypes.func,
    }

    UNSAFE_componentWillReceiveProps(np) {
        const {left, top, width} = np;
        this.setState({
            left: left,
            top: top,
            width: width,
        });

        this.subscribeResizeEvent(np);
    }