How to use the oneOf function from prop-types
Find comprehensive JavaScript prop-types.oneOf code examples handpicked from public code repositorys.
91 92 93 94 95 96 97 98 99 100
// 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']), // An object that could be one of many types optionalUnion: PropTypes.oneOfType([ PropTypes.string,
388
0
59
9 10 11 12 13 14 15 16 17 18
host: PropTypes.string.isRequired, secret: PropTypes.string.isRequired, scope: PropTypes.arrayOf(PropTypes.string).isRequired, afterAuth: PropTypes.func.isRequired, shopStore: PropTypes.object, accessMode: PropTypes.oneOf(['offline', 'online']) }; const defaults = { shopStore: new MemoryStrategy(),
87
0
1
86 87 88 89 90 91 92 93 94 95
uri: PropTypes.string, /* * The HTTP Method to use. Defaults to GET if not specified. * NOTE: On Android, only GET and POST are supported. */ method: PropTypes.oneOf(['GET', 'POST']), /* * Additional HTTP headers to send with the request. * NOTE: On Android, this can only be used with GET requests. */
87
0
76
+ 3 other calls in file
GitHub: jimczj/issue-helper
43 44 45 46 47 48 49 50 51
const formType = PropTypes.shape({ title: stringType, formItems: PropTypes.arrayOf(PropTypes.shape({ label: stringType, mdTitle: PropTypes.string, type: PropTypes.oneOf(['textarea', 'version', 'code', 'input']).isRequired, required: PropTypes.bool })) })
0
4
2
15 16 17 18 19 20 21 22 23 24
uri: PropTypes.string, bundle: PropTypes.string, method: PropTypes.string, headers: PropTypes.objectOf(PropTypes.string), body: PropTypes.string, cache: PropTypes.oneOf([ 'default', 'reload', 'force-cache', 'only-if-cached',
5
3
0
GitHub: steedos/steedos-unpkg
684 685 686 687 688 689 690 691 692 693
if (process.env.NODE_ENV !== 'production') { FolderViewer.propTypes = { path: PropTypes.string.isRequired, details: PropTypes.objectOf(PropTypes.shape({ path: PropTypes.string.isRequired, type: PropTypes.oneOf(['directory', 'file']).isRequired, contentType: PropTypes.string, // file only integrity: PropTypes.string, // file only
0
1
0
GitHub: neiht13/nksx
241 242 243 244 245 246 247 248 249 250 251
}; var PROP_TYPES = process.env.NODE_ENV !== 'production' ? { value: PropTypes.string.isRequired, size: PropTypes.number, level: PropTypes.oneOf(['L', 'M', 'Q', 'H']), bgColor: PropTypes.string, fgColor: PropTypes.string, includeMargin: PropTypes.bool, imageSettings: PropTypes.shape({
0
0
1
+ 8 other calls in file
2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973
CardImgOverlay.defaultProps = defaultProps$K; /** * CarouselContext * { * direction: PropTypes.oneOf(['start', 'end']).isRequired, * } */ var CarouselContext = React__default["default"].createContext({});
0
0
1
GitHub: ingramlucifer/ras_app
33 34 35 36 37 38 39 40 41 42
}, scrollOnMountCalled: false, tabWillChangeWithoutGesture: false, propTypes: { tabBarPosition: PropTypes.oneOf([ "top", "bottom", "overlayTop", "overlayBottom",
0
0
1
+ 16 other calls in file
185 186 187 188 189 190 191 192 193 194
commentText: PropTypes.string.isRequired, 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,
0
0
1
+ 3 other calls in file
31 32 33 34 35 36 37 38 39 40
}, scrollOnMountCalled: false, tabWillChangeWithoutGesture: false, propTypes: { tabBarPosition: PropTypes.oneOf(['top', 'bottom', 'overlayTop', 'overlayBottom', ]), initialPage: PropTypes.number, page: PropTypes.number, onChangeTab: PropTypes.func, onScroll: PropTypes.func,
0
0
1
253 254 255 256 257 258 259 260 261 262 263
TextBlock.propTypes = { width: PropTypes.number, fontFamily: PropTypes.string, vAlign: PropTypes.oneOf(["top", "middle", "bottom"]), textAlign: PropTypes.oneOf(["left", "center", "justify", "right"]), underline: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]), bold: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]), italic: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]), lineHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
0
0
4
GitHub: iustins/online-shop
3275 3276 3277 3278 3279 3280 3281 3282 3283 3284
children: PropTypes.node, circle: PropTypes.bool, className: PropTypes.string, color: PropTypes.string, tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), size: PropTypes.oneOf(['lg', 'sm']) }; Pagination.defaultProps = { circle: false, className: "",
0
0
1
+ 9 other calls in file
517 518 519 520 521 522 523 524 525 526
* - `'all'` * * @platform ios */ dataDetectorTypes: (PropTypes.oneOfType([ PropTypes.oneOf(DataDetectorTypes), PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)), ]): React$PropType$Primitive< | 'phoneNumber' | 'link'
0
0
1
3 4 5 6 7 8 9 10 11 12 13 14
class ButtonSizeOption extends React.Component { static get propTypes() { return { onChange: PropTypes.func.isRequired, buttonLarge: PropTypes.oneOf([undefined, 'on']), }; } render() {
0
0
1
+ 7 other calls in file
3 4 5 6 7 8 9 10 11 12 13 14
class HideConversationOption extends React.Component { static get propTypes() { return { onChange: PropTypes.func.isRequired, hideConversation: PropTypes.oneOf([undefined, 'on']), }; } render() {
0
0
1
+ 7 other calls in file
25 26 27 28 29 30 31 32 33 34 35
}); const CustomizationOptionUrlPropTypes = Object.assign(baseUrlProps, { buttonHideUsername: PropTypes.oneOf([undefined, 'on']), buttonRecommendation: PropTypes.array, buttonType: ButtonType, theme: PropTypes.oneOf(['dark', 'light']), }); const baseQueryParamConfig = {}; CUSTOMIZATION_OPTION_KEYS.forEach(key => {
0
0
1
+ 15 other calls in file
GitHub: romibi/CodingTrain
31 32 33 34 35 36 37 38 39 40
video_number: PropTypes.number.isRequired, date: PropTypes.instanceOf(Date).isRequired, video_id: PropTypes.string, live_example: PropTypes.oneOfType([ PropTypes.string, PropTypes.oneOf([false]), ]), can_contribute: PropTypes.bool, topics: PropTypes.arrayOf(PropTypes.shape(link)), links: PropTypes.arrayOf(PropTypes.shape(link)),
0
0
2
+ 5 other calls in file
prop-types.default is the most popular function in prop-types (2947 examples)