How to use the number function from prop-types

Find comprehensive JavaScript prop-types.number code examples handpicked from public code repositorys.

168
169
170
171
172
173
174
175
176
177
 * cells, i.e. they don't span the full width of your view (as in the
 * ListViewGridLayoutExample), you should set the pageSize to be a multiple
 * of the number of cells per row, otherwise you're likely to see gaps at
 * the edge of the ListView as new pages are loaded.
 */
pageSize: PropTypes.number.isRequired,
/**
 * () => renderable
 *
 * The header and footer are always rendered (if these props are provided)
fork icon481
star icon0
watch icon231

+ 7 other calls in file

112
113
114
115
116
117
118
119
120
121
// is shown if the prop isn't provided.

// An object taking on a particular shape
optionalObjectWithShape: PropTypes.shape({
  optionalProperty: PropTypes.string,
  requiredProperty: PropTypes.number.isRequired
}),

// An object with warnings on extra properties
optionalObjectWithStrictShape: PropTypes.exact({
fork icon388
star icon0
watch icon59

+ 11 other calls in file

86
87
88
89
90
91
92
93
94
95
optionalObjectOf: PropTypes.objectOf(PropTypes.number),

// An object taking on a particular shape
optionalObjectWithShape: PropTypes.shape({
  color: PropTypes.string,
  fontSize: PropTypes.number
}),

// You can chain any of the above with `isRequired` to make sure a warning
// is shown if the prop isn't provided.
fork icon388
star icon0
watch icon3

20
21
22
23
24
25
26
27
28
29
  maxHeight: PropTypes.number,
  maxWidth: PropTypes.number,
  minHeight: PropTypes.number,
  minWidth: PropTypes.number,
  ratioHeight: PropTypes.number,
  ratioWidth: PropTypes.number
}),
maxFileSize: PropTypes.number,
onFileAdd: PropTypes.func.isRequired,
onFileRemove: PropTypes.func.isRequired,
fork icon61
star icon78
watch icon23

1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
});
process.env.NODE_ENV !== "production" ? ControlledMenu.propTypes = /*#__PURE__*/_extends({}, rootMenuPropTypes, {
  state: /*#__PURE__*/propTypes.oneOf( /*#__PURE__*/values(MenuStateMap)),
  anchorPoint: /*#__PURE__*/propTypes.exact({
    x: propTypes.number,
    y: propTypes.number
  }),
  anchorRef: propTypes.object,
  skipOpen: propTypes.object,
  captureFocus: propTypes.bool,
fork icon48
star icon883
watch icon6

+ 2 other calls in file

857
858
859
860
861
862
863
864
865
866
      // code
      uri: PropTypes.string,
      // images
      integrity: PropTypes.string.isRequired,
      language: PropTypes.string.isRequired,
      size: PropTypes.number.isRequired
    }).isRequired
  };
}

fork icon0
star icon1
watch icon0

912
913
914
915
916
917
918
919
920
921
922
}


Suggestion.propTypes = {
  id: PropTypes.string.isRequired,
  query: PropTypes.string.isRequired,
  index: PropTypes.number.isRequired,
  ignoreAccents: PropTypes.bool,
  suggestion: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
    id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
    display: PropTypes.string
fork icon0
star icon0
watch icon3

+ 3 other calls in file

251
252
253
254
255
256
257
258
259
260
        src: PropTypes.string.isRequired,
        height: PropTypes.number.isRequired,
        width: PropTypes.number.isRequired,
        excavate: PropTypes.bool,
        x: PropTypes.number,
        y: PropTypes.number
    })
} : {};
var MARGIN_SIZE = 2; // This is *very* rough estimate of max amount of QRCode allowed to be covered.
// It is "wrong" in a lot of ways (area is a terrible way to estimate, it
fork icon0
star icon0
watch icon1

+ 26 other calls in file

175
176
177
178
179
180
181
182
183
184
185
        );
    }
}


CommentMessage.propTypes = {
    actorId: PropTypes.number.isRequired,
    actorUsername: PropTypes.string.isRequired,
    className: PropTypes.string,
    commentDateTime: PropTypes.string.isRequired,
    commentId: PropTypes.number.isRequired,
fork icon0
star icon0
watch icon1

+ 11 other calls in file

1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
  className: PropTypes.node,
  children: PropTypes.node,
  navbar: PropTypes.bool,
  delay: PropTypes.oneOfType([PropTypes.shape({
    show: PropTypes.number,
    hide: PropTypes.number
  }), PropTypes.number]),
  onOpened: PropTypes.func,
  onClosed: PropTypes.func
};
fork icon0
star icon0
watch icon1

+ 84 other calls in file

1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
if (getItemLayout) {
  frame = getItemLayout(data, index);
  if (__DEV__) {
    const frameType = PropTypes.shape({
      length: PropTypes.number.isRequired,
      offset: PropTypes.number.isRequired,
      index: PropTypes.number.isRequired,
    }).isRequired;
    PropTypes.checkPropTypes(
      {frame: frameType},
fork icon0
star icon0
watch icon1

+ 5 other calls in file

393
394
395
396
397
398
399
400
401
402
/**
 * The start and end of the text input's selection. Set start and end to
 * the same value to position the cursor.
 */
selection: (PropTypes.shape({
  start: PropTypes.number.isRequired,
  end: PropTypes.number,
}): React$PropType$Primitive<{
  end?: number,
  start: number,
fork icon0
star icon0
watch icon1

26
27
28
29
30
31
32
33
34
35
  items: PropTypes.arrayOf(PropTypes.shape(link)).isRequired,
});

const videoBase = module.exports.videoBase = exact({
  title: PropTypes.string.isRequired,
  video_number: PropTypes.number.isRequired,
  date: PropTypes.instanceOf(Date).isRequired,
  video_id: PropTypes.string,
  live_example: PropTypes.oneOfType([
    PropTypes.string,
fork icon0
star icon0
watch icon2