How to use the objectOf function from prop-types

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

104
105
106
107
108
109
110
111
112

// An array of a certain type
optionalArrayOf: PropTypes.arrayOf(PropTypes.number),

// An object with property values of a certain type
optionalObjectOf: PropTypes.objectOf(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 icon59

13
14
15
16
17
18
19
20
21
22
23


const ImageURISourcePropType = PropTypes.shape({
  uri: PropTypes.string,
  bundle: PropTypes.string,
  method: PropTypes.string,
  headers: PropTypes.objectOf(PropTypes.string),
  body: PropTypes.string,
  cache: PropTypes.oneOf([
    'default',
    'reload',
fork icon5
star icon3
watch icon0

682
683
684
685
686
687
688
689
690
691
692
}


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
fork icon0
star icon1
watch icon0

962
963
964
965
966
967
968
969
970
971
projectStudios: PropTypes.arrayOf(PropTypes.object),
refreshSession: PropTypes.func,
registrationOpen: PropTypes.bool,
remixProject: PropTypes.func,
remixes: PropTypes.arrayOf(PropTypes.object),
replies: PropTypes.objectOf(PropTypes.array),
reportProject: PropTypes.func,
resetProject: PropTypes.func,
sessionStatus: PropTypes.string,
setFavedStatus: PropTypes.func.isRequired,
fork icon0
star icon0
watch icon1

116
117
118
119
120
121
122
123
124
125
126
        isPhone: true
    }
};


ValidatedPhoneInput.propTypes = {
    validations: PropTypes.objectOf(PropTypes.bool)
};


module.exports = ValidatedPhoneInput;
fork icon0
star icon0
watch icon1

18
19
20
21
22
23
24
25
26
27
28
29
}


RadioBlockGroup.propTypes = {
  styles: PropTypes.oneOfType([
    PropTypes.array,
    PropTypes.objectOf(CustomPropTypes.style)
  ])
}


module.exports = RadioBlockGroup
fork icon0
star icon0
watch icon0

61
62
63
64
65
66
67
68
69
70
71
  onChange: () => {},
  nonsensitive: FS_SHOW
}


RadioBlock.propTypes = {
  styleSheet: PropTypes.objectOf(CustomPropTypes.style),
  checked: PropTypes.bool,
  onChange: PropTypes.func,
  id: PropTypes.string.isRequired,
  name: PropTypes.string.isRequired,
fork icon0
star icon0
watch icon0