How to use the instanceOf function from prop-types
Find comprehensive JavaScript prop-types.instanceOf code examples handpicked from public code repositorys.
122 123 124 125 126 127 128 129 130 131
propTypes: { ...ScrollView.propTypes, /** * An instance of [ListView.DataSource](docs/listviewdatasource.html) to use */ dataSource: PropTypes.instanceOf(ListViewDataSource).isRequired, /** * (sectionID, rowID, adjacentRowHighlighted) => renderable * * If provided, a renderable component to be rendered as the separator
481
0
231
87 88 89 90 91 92 93 94 95 96
// see https://github.com/facebook/react/blob/HEAD/packages/shared/isValidElementType.js optionalElementType: PropTypes.elementType, // You can also declare that a prop is an instance of a class. This uses // JS's instanceof operator. optionalMessage: PropTypes.instanceOf(Message), // You can ensure that your prop is limited to specific values by treating // it as an enum. optionalEnum: PropTypes.oneOf(['News', 'Photos']),
388
0
59
+ 3 other calls in file
GitHub: Stremio/stremio-web
91 92 93 94 95 96 97 98 99 100
Router.propTypes = { className: PropTypes.string, onPathNotMatch: PropTypes.func, viewsConfig: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.exact({ regexp: PropTypes.instanceOf(RegExp).isRequired, urlParamsNames: PropTypes.arrayOf(PropTypes.string).isRequired, component: PropTypes.elementType.isRequired }))).isRequired };
129
502
31
14 15 16 17 18 19 20 21 22 23 24 25
} } } DateTime.propTypes = { value: PropTypes.instanceOf(Date), timeZone: PropTypes.string }; export default DateTime;
0
1
0
GitHub: iustins/online-shop
8737 8738 8739 8740 8741 8742 8743 8744 8745 8746
locale: PropTypes.string, format: PropTypes.string, tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), className: PropTypes.string, getValue: PropTypes.func, value: PropTypes.instanceOf(Date) }; DatePicker.defaultProps = { theme: {}, tag: 'div',
0
0
1
+ 4 other calls in file
GitHub: romibi/CodingTrain
27 28 29 30 31 32 33 34 35 36
}); 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, PropTypes.oneOf([false]),
0
0
2
prop-types.default is the most popular function in prop-types (2947 examples)