How to use the PropTypes function from react

Find comprehensive JavaScript react.PropTypes code examples handpicked from public code repositorys.

3
4
5
6
7
8
9
10
11
12
var UI = require('react-topui');

module.exports = React.createClass({
  
  propTypes: {
    links: React.PropTypes.array.isRequired
  },

  nav: function(fragment){
    window.location.href = fragment;
fork icon42
star icon260
watch icon20

+ 3 other calls in file

43
44
45
46
47
48
49
50
51
52
    return previewProp(this.props.val, !!this.props.nested, !!this.props.inverted, this.context.theme);
  }
}

PropVal.contextTypes = {
  theme: React.PropTypes.object.isRequired,
};

function previewProp(val: any, nested: boolean, inverted: boolean, theme: Theme) {
  let style = {
fork icon6
star icon106
watch icon2

3
4
5
6
7
8
9
10
11
12
var color = require('../../js/color')

var GeneOpenMenu = React.createClass({

    propTypes: {
        gene: React.PropTypes.object
    },
    
    getInitialState: function() {
        return {
fork icon6
star icon2
watch icon25

+ 4 other calls in file

8
9
10
11
12
13
14
15
16
17
mixins: [ClassNameMixin],

propTypes: {
  classPrefix: React.PropTypes.string,
  now: React.PropTypes.number,
  label: React.PropTypes.string,
  active: React.PropTypes.bool,
  striped: React.PropTypes.bool,
  amSize: React.PropTypes.string,
  amStyle: React.PropTypes.string
fork icon235
star icon0
watch icon92

+ 13 other calls in file

15
16
17
18
19
20
21
22
23
24
var Dropdown = React.createClass({
  mixins: [ClassNameMixin],

  propTypes: {
    title: React.PropTypes.node.isRequired,
    dropup: React.PropTypes.bool,
    navItem: React.PropTypes.bool,
    btnStyle: React.PropTypes.string,
    btnSize: React.PropTypes.string,
    btnInlineStyle: React.PropTypes.object,
fork icon235
star icon0
watch icon2

+ 41 other calls in file

30
31
32
33
34
35
36
37
38
39
};


var ParallaxScrollViewComposition = React.createClass({
  propTypes: {
    scrollViewComponent: React.PropTypes.func,
  },

  setNativeProps: function(nativeProps) {
    this._root.setNativeProps(nativeProps);
fork icon82
star icon578
watch icon15

4
5
6
7
8
9
10
11
12
var color = require('../../js/color')

var GenePanel = React.createClass({
    
    propTypes: {
        gene: React.PropTypes.object.isRequired
    },

    render: function() {
fork icon6
star icon2
watch icon25

+ 3 other calls in file

12
13
14
15
16
17
18
19
20
21
22
23
var FileUploader = React.createClass({


    displayName: 'FileUploader',


    propTypes: {
        allowClear: React.PropTypes.bool,
        allowDownload: React.PropTypes.bool,
        onClickClear: React.PropTypes.func,
        mode: React.PropTypes.oneOf(['object', 'array']),

fork icon1
star icon5
watch icon15

+ 25 other calls in file

30
31
32
33
34
35
36
37
38
39
40
41
var ColorPicker = React.createClass({


    displayName: 'ColorPicker',


    propTypes: {
        width: React.PropTypes.number,
        height: React.PropTypes.number,
        type: React.PropTypes.oneOf(_.keys(pickers)),
        format: React.PropTypes.oneOf([
            'rgb', 'hsl', 'hsv', 'cmyk',
fork icon1
star icon5
watch icon15

+ 13 other calls in file

4
5
6
7
8
9
10
11
12
13
14
15
    d3 = require('d3');


var mixinChart = {


    propTypes: {
        limit: React.PropTypes.number,
        loading: React.PropTypes.bool,
        data: React.PropTypes.array,
        colors: React.PropTypes.array,
        groupExtra: React.PropTypes.bool,
fork icon1
star icon5
watch icon15

+ 35 other calls in file

17
18
19
20
21
22
23
24
25
26
groupExtra: React.PropTypes.bool,
collapsible: React.PropTypes.bool,
renderItem: React.PropTypes.func,
width: React.PropTypes.number,
height: React.PropTypes.number,
style: React.PropTypes.object,
data: React.PropTypes.array,
onOpen: React.PropTypes.func,
OnClose: React.PropTypes.func,
labelViewAll: React.PropTypes.string,
fork icon1
star icon5
watch icon15

+ 25 other calls in file

25
26
27
28
29
30
31
32
33
34
min: React.PropTypes.number,

/**
 * Maximum
 */
max: React.PropTypes.number,

/**
 * value
 */
fork icon1
star icon5
watch icon15

+ 11 other calls in file

32
33
34
35
36
37
38
39
40
    defaultValue: React.PropTypes.any,

    /**
     * callback function calls on changing value
     */
    onChange: React.PropTypes.func,

    icons: React.PropTypes.oneOf(['native', 'nice', 'toggle'])
},
fork icon1
star icon5
watch icon15

+ 7 other calls in file

149
150
151
152
153
154
155
156
157
158
159
160
const ReactPlayground = React.createClass({
  mixins: [selfCleaningTimeout],


  propTypes: {
    codeText: React.PropTypes.string.isRequired,
    transformer: React.PropTypes.func
  },


  getDefaultProps() {
    return {
fork icon0
star icon1
watch icon0

12
13
14
15
16
17
18
19
20
21
22
var CodeMirror = React.createClass({
  displayName: 'CodeMirror',


  propTypes: {
    className: React.PropTypes.any,
    codeMirrorInstance: React.PropTypes.func,
    defaultValue: React.PropTypes.string,
    onChange: React.PropTypes.func,
    onFocusChange: React.PropTypes.func,
    onScroll: React.PropTypes.func,
fork icon0
star icon0
watch icon0

+ 9 other calls in file

8136
8137
8138
8139
8140
8141
8142
8143
8144
8145

/**
 * Function responsible for tracking the loaded state of each row.
 * It should implement the following signature: ({ index: number }): boolean
 */
isRowLoaded: _react.PropTypes.func.isRequired,

/**
 * Callback to be invoked when more rows must be loaded.
 * It should implement the following signature: ({ startIndex, stopIndex }): Promise
fork icon0
star icon0
watch icon0

+ 166 other calls in file

37
38
39
40
41
42
43
44
45
46
ignoreAccents: _react2['default'].PropTypes.bool, // strip diacritics when filtering; defaults to true
ignoreCase: _react2['default'].PropTypes.bool, // perform case-insensitive filtering; defaults to true
loadingPlaceholder: _react2['default'].PropTypes.oneOfType([// replaces the placeholder while options are loading
_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
loadOptions: _react2['default'].PropTypes.func.isRequired, // callback to load options asynchronously; (inputValue: string, callback: Function): ?Promise
options: _react.PropTypes.array.isRequired, // array of options
placeholder: _react2['default'].PropTypes.oneOfType([// field placeholder, displayed when there's no value (shared with Select)
_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
noResultsText: _react2['default'].PropTypes.oneOfType([// field noResultsText, displayed when no options come back from the server
_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
fork icon0
star icon0
watch icon0

7
8
9
10
11
12
13
14
15
16
let TableBody = React.createClass({

  mixins: [ClickAwayable, StylePropable],

  propTypes: {
    allRowsSelected: React.PropTypes.bool,
    deselectOnClickaway: React.PropTypes.bool,
    displayRowCheckbox: React.PropTypes.bool,
    multiSelectable: React.PropTypes.bool,
    onCellClick: React.PropTypes.func,
fork icon0
star icon0
watch icon17

+ 29 other calls in file