How to use the shape function from prop-types
Find comprehensive JavaScript prop-types.shape code examples handpicked from public code repositorys.
107 108 109 110 111 112 113 114 115
// You can chain any of the above with `isRequired` to make sure a warning // 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 }),
388
0
3
+ 7 other calls in file
GitHub: Stremio/stremio-web
70 71 72 73 74 75 76 77 78 79
message: PropTypes.string, items: PropTypes.arrayOf(PropTypes.shape({ posterShape: PropTypes.string })), itemComponent: PropTypes.elementType, deepLinks: PropTypes.shape({ discover: PropTypes.string, library: PropTypes.string }) };
129
506
31
+ 3 other calls in file
GitHub: BigRoomStudios/strangeluv
32 33 34 35 36 37 38 39 40 41
</Styled.ThemeProvider> ); }; module.exports.propTypes = { middleEnd: T.shape({ store: T.object.isRequired }).isRequired, theme: T.object, Router: T.elementType
7
35
13
+ 3 other calls in file
77 78 79 80 81 82 83 84 85 86
/** * Loads static html or a uri (with optional headers) in the WebView. */ source: PropTypes.oneOfType([ PropTypes.shape({ /* * The URI to load in the WebView. Can be a local or remote file. */ uri: PropTypes.string,
87
0
76
+ 3 other calls in file
12 13 14 15 16 17 18 19 20 21
class FileUpload extends React.Component { static propTypes = { allowedFileTypes: PropTypes.array, elementRef: PropTypes.func, imageUrl: PropTypes.string, imageValidation: PropTypes.shape({ exactHeight: PropTypes.number, exactWidth: PropTypes.number, maxHeight: PropTypes.number, maxWidth: PropTypes.number,
61
78
23
44 45 46 47 48 49 50 51 52 53
hasOutput: PropTypes.bool, output: PropTypes.array, hasError: PropTypes.bool, error: PropTypes.string }), xdebug: PropTypes.shape({ status: PropTypes.string }), container: PropTypes.func.isRequired };
7
42
4
GitHub: jimczj/issue-helper
38 39 40 41 42 43 44 45 46 47
zh: PropTypes.string.isRequired, en: PropTypes.string.isRequired }) ]) const formType = PropTypes.shape({ title: stringType, formItems: PropTypes.arrayOf(PropTypes.shape({ label: stringType, mdTitle: PropTypes.string,
0
4
2
+ 5 other calls in file
9 10 11 12 13 14 15 16 17 18 19 20 21
'use strict'; const PropTypes = require('prop-types'); const ImageURISourcePropType = PropTypes.shape({ uri: PropTypes.string, bundle: PropTypes.string, method: PropTypes.string, headers: PropTypes.objectOf(PropTypes.string),
5
3
0
GitHub: steedos/steedos-unpkg
849 850 851 852 853 854 855 856 857 858 859
} if (process.env.NODE_ENV !== 'production') { FileViewer.propTypes = { path: PropTypes.string.isRequired, details: PropTypes.shape({ contentType: PropTypes.string.isRequired, highlights: PropTypes.arrayOf(PropTypes.string), // code uri: PropTypes.string,
0
1
0
+ 2 other calls in file
GitHub: neiht13/nksx
245 246 247 248 249 250 251 252 253 254
size: PropTypes.number, level: PropTypes.oneOf(['L', 'M', 'Q', 'H']), bgColor: PropTypes.string, fgColor: PropTypes.string, includeMargin: PropTypes.bool, imageSettings: PropTypes.shape({ src: PropTypes.string.isRequired, height: PropTypes.number.isRequired, width: PropTypes.number.isRequired, excavate: PropTypes.bool,
0
0
1
+ 8 other calls in file
186 187 188 189 190 191 192 193 194 195
commentee: PropTypes.string, intl: intlShape.isRequired, objectId: PropTypes.number.isRequired, objectTitle: PropTypes.string, objectType: PropTypes.oneOf([0, 1, 2]).isRequired, user: PropTypes.shape({ id: PropTypes.number, banned: PropTypes.bool, username: PropTypes.string, token: PropTypes.string,
0
0
1
+ 3 other calls in file
GitHub: AquaSet/Scratch
987 988 989 990 991 992 993 994 995 996
email: PropTypes.string, classroomId: PropTypes.string }), userOwnsProject: PropTypes.bool, userPresent: PropTypes.bool, visibilityInfo: PropTypes.shape({ censored: PropTypes.bool, censoredByAdmin: PropTypes.bool, censoredByCommunity: PropTypes.bool, message: PropTypes.string,
0
0
1
588 589 590 591 592 593 594 595 596 597
listKey: React$PropType$Primitive<string>, cellKey: React$PropType$Primitive<string>, |}, |}, |} = { virtualizedCell: PropTypes.shape({ cellKey: PropTypes.string, }), virtualizedList: PropTypes.shape({ getScrollMetrics: PropTypes.func,
0
0
1
+ 13 other calls in file
18 19 20 21 22 23 24
theme: PropTypes.oneOf(['dark', 'light']), dnt: PropTypes.string, hideConversation: PropTypes.oneOf([undefined, 'on']), }; module.exports = PropTypes.shape(CONFIGURATION_TYPE);
0
0
1
+ 7 other calls in file
85 86 87 88 89 90 91 92 93 94
return []; } } // Always returns an object with this shape: // PropTypes.shape( // { values: PropTypes.arrayOf( PropTypes.string ).isRequired // , propertyVerbs: PropTypes.arrayOf( PropTypes.string).isRequired // }) findValues( propId )
0
0
1
+ 8 other calls in file
1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218
return ReactPageShell; }(React.Component); ReactPageShell.propTypes = { meta: PropTypes.shape({ title: PropTypes.string.isRequired, description: PropTypes.string.isRequired, contentType: PropTypes.string, pathname: PropTypes.string,
0
0
0
GitHub: romibi/CodingTrain
1 2 3 4 5 6 7 8 9 10
const exact = require('prop-types-exact'); const link = module.exports.link = exact({ title: PropTypes.string.isRequired, author: PropTypes.oneOfType([ PropTypes.shape(exact({ name: PropTypes.string.isRequired, url: PropTypes.string, })), PropTypes.string,
0
0
2
prop-types.default is the most popular function in prop-types (2947 examples)