How to use the prop-types.instanceOf 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 prymitive / karma / ui / src / Components / Labels / FilteringCounterBadge / index.js View on Github external
import { observer } from "mobx-react";

import Flash from "react-reveal/Flash";

import { AlertStore } from "Stores/AlertStore";
import { TooltipWrapper } from "Components/TooltipWrapper";
import { BaseLabel } from "Components/Labels/BaseLabel";

// Same as FilteringLabel but for labels that are counters (usually @state)
// and only renders a pill badge with the counter, it doesn't render anything
// if the counter is 0
const FilteringCounterBadge = observer(
  class FilteringCounterBadge extends BaseLabel {
    static propTypes = {
      alertStore: PropTypes.instanceOf(AlertStore).isRequired,
      name: PropTypes.string.isRequired,
      value: PropTypes.string.isRequired,
      counter: PropTypes.number.isRequired,
      themed: PropTypes.bool.isRequired,
      alwaysVisible: PropTypes.bool,
      defaultColor: PropTypes.oneOf(["light", "primary"])
    };
    static defaultProps = {
      defaultColor: "light"
    };

    render() {
      const {
        name,
        value,
        counter,
github weseek / growi / src / client / js / components / User / UserPictureList.jsx View on Github external
{users}
      
    );
  }

}

/**
 * Wrapper component for using unstated
 */
const UserPictureListWrapper = (props) => {
  return createSubscribedElement(UserPictureList, props, [AppContainer]);
};

UserPictureList.propTypes = {
  appContainer: PropTypes.instanceOf(AppContainer).isRequired,

  userIds: PropTypes.arrayOf(PropTypes.string),
  users: PropTypes.arrayOf(PropTypes.object),
};

UserPictureList.defaultProps = {
  userIds: [],
  users: [],
};

export default UserPictureListWrapper;
github ballerina-attic / composer / modules / web / src / plugins / ballerina / diagram / views / default / components / decorators / client-responder-decorator.jsx View on Github external
}

ClientResponderDecorator.defaultProps = {
    editorOptions: null,
    children: null,
};

ClientResponderDecorator.propTypes = {
    viewState: PropTypes.shape({
        bBox: PropTypes.instanceOf(SimpleBBox),
        fullExpression: PropTypes.string,
        components: PropTypes.object,
    }).isRequired,
    children: PropTypes.node,
    model: PropTypes.instanceOf(Node).isRequired,
    editorOptions: PropTypes.shape({
        propertyType: PropTypes.string,
        key: PropTypes.string,
        model: PropTypes.instanceOf(Object),
        getterMethod: PropTypes.func,
        setterMethod: PropTypes.func,
    }),
    onBreakpointClick: PropTypes.func.isRequired,
    isBreakpoint: PropTypes.bool.isRequired,
};

ClientResponderDecorator.contextTypes = {
    getOverlayContainer: PropTypes.instanceOf(Object).isRequired,
    editor: PropTypes.instanceOf(Object).isRequired,
    environment: PropTypes.instanceOf(Object).isRequired,
    activeArbiter: PropTypes.instanceOf(ActiveArbiter).isRequired,
github wso2 / carbon-apimgt / features / apimgt / org.wso2.carbon.apimgt.store.feature / src / main / resources / store-new / source / src / app / components / Apis / Details / Comments / CommentEdit.jsx View on Github external
);
    }
}

CommentEdit.propTypes = {
    classes: PropTypes.instanceOf(Object).isRequired,
    apiId: PropTypes.string.isRequired,
    allComments: PropTypes.instanceOf(Array).isRequired,
    commentsUpdate: PropTypes.func.isRequired,
    toggleShowEdit: PropTypes.func.isRequired,
    comment: PropTypes.instanceOf(Object).isRequired,
    intl: PropTypes.shape({
        formatMessage: PropTypes.func,
    }).isRequired,
};

export default injectIntl(withStyles(styles, { withTheme: true })(CommentEdit));
github ballerina-attic / composer / modules / web / src / plugins / ballerina / views / source-view.jsx View on Github external
className='syntax-errors-counter-container'
                                    onClick={this.toggleErrorListPopover}
                                >
                                    <span>{this.state.syntaxErrors.length}</span>
                                
                            
                        }
                    
                
            
        );
    }
}

SourceView.propTypes = {
    file: PropTypes.instanceOf(File).isRequired,
    commandProxy: PropTypes.shape({
        on: PropTypes.func.isRequired,
        dispatch: PropTypes.func.isRequired,
        getCommands: PropTypes.func.isRequired,
    }).isRequired,
    parseFailed: PropTypes.bool.isRequired,
    displayErrorList: PropTypes.bool.isRequired,
    panelResizeInProgress: PropTypes.bool.isRequired,
    width: PropTypes.number.isRequired,
    height: PropTypes.number.isRequired,
};

SourceView.contextTypes = {
    isTabActive: PropTypes.func.isRequired,
    editor: PropTypes.instanceOf(Object).isRequired,
    ballerinaPlugin: PropTypes.objectOf(Object).isRequired,
github ballerina-attic / composer / modules / web / js / ballerina / tool-palette / tool-palette-view.jsx View on Github external
{state === 'library' &amp;&amp;
                    }
                
            
        );
    }
}

ToolPaletteView.propTypes = {
    isTransformActive: PropTypes.bool.isRequired,
    height: PropTypes.number.isRequired,
    width: PropTypes.number.isRequired,
};

ToolPaletteView.contextTypes = {
    astRoot: PropTypes.instanceOf(CompilationUnitNode),
    environment: PropTypes.instanceOf(PackageScopedEnvironment).isRequired,
};

export default ToolPaletteView;
github mapseed / platform / src / base / static / components / molecules / form-field-types / map-drawing-toolbar.js View on Github external
)}
      
    );
  }
}

MapDrawingToolbar.propTypes = {
  activeColorpicker: PropTypes.string,
  activeDrawingTool: PropTypes.string,
  activeMarker: PropTypes.string,
  existingCollectionId: PropTypes.string,
  existingGeometry: PropTypes.instanceOf(Map),
  existingModelId: PropTypes.number,
  existingGeometryStyle: PropTypes.instanceOf(Map),
  geometryStyle: PropTypes.shape({
    [constants.LINE_COLOR_PROPERTY_NAME]: PropTypes.string.isRequired,
    [constants.LINE_OPACITY_PROPERTY_NAME]: PropTypes.number.isRequired,
    [constants.FILL_COLOR_PROPERTY_NAME]: PropTypes.string.isRequired,
    [constants.FILL_OPACITY_PROPERTY_NAME]: PropTypes.number.isRequired,
  }).isRequired,
  isMarkerPanelVisible: PropTypes.bool.isRequired,
  markers: PropTypes.arrayOf(PropTypes.string),
  name: PropTypes.string.isRequired,
  onChange: PropTypes.func.isRequired,
  resetDrawingToolbarState: PropTypes.func.isRequired,
  setActiveColorpicker: PropTypes.func.isRequired,
  setActiveDrawingTool: PropTypes.func.isRequired,
  setActiveMarkerIndex: PropTypes.func.isRequired,
  setGeometryStyle: PropTypes.func.isRequired,
  setMarkers: PropTypes.func.isRequired,
github ballerina-attic / composer / modules / web / js / ballerina / components / statement-decorator.jsx View on Github external
children: null,
};

StatementDecorator.propTypes = {
    viewState: PropTypes.shape({
        bBox: PropTypes.instanceOf(SimpleBBox),
        fullExpression: PropTypes.string,
        components: PropTypes.objectOf(PropTypes.instanceOf(SimpleBBox)),
    }).isRequired,
    children: PropTypes.node,
    model: PropTypes.instanceOf(ASTNode).isRequired,
    expression: PropTypes.string.isRequired,
    editorOptions: PropTypes.shape({
        propertyType: PropTypes.string,
        key: PropTypes.string,
        model: PropTypes.instanceOf(ASTNode),
        getterMethod: PropTypes.func,
        setterMethod: PropTypes.func,
    }),
    onBreakpointClick: PropTypes.func.isRequired,
    isBreakpoint: PropTypes.bool.isRequired,
    isDebugHit: PropTypes.bool.isRequired,
};

StatementDecorator.contextTypes = {
    dragDropManager: PropTypes.instanceOf(DragDropManager).isRequired,
    messageManager: PropTypes.instanceOf(MessageManager).isRequired,
    getOverlayContainer: PropTypes.instanceOf(Object).isRequired,
    editor: PropTypes.instanceOf(Object).isRequired,
    environment: PropTypes.instanceOf(Object).isRequired,
    activeArbiter: PropTypes.instanceOf(ActiveArbiter).isRequired,
};
github patternfly / patternfly-react / packages / patternfly-3 / patternfly-react / src / components / DateTimePicker / TimePicker.js View on Github external
this.setState({ tmpValue: formatTime(value, locale) })}
          &gt;
            
          
        
      
    );
  }
}

TimePicker.propTypes = {
  /** Value of the input */
  value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
  /** locale string for formating the time string */
  locale: PropTypes.string,
  /** id of the popover */
  id: PropTypes.string,
  /** Placement of the popover */
  placement: OverlayTrigger.propTypes.placement
};
TimePicker.defaultProps = {
  value: new Date(),
  locale: 'en-US',
  id: 'popover-time-picker',
  placement: 'top'
};
export default TimePicker;