Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ColorPropTypes support for isRequired and more precise description
Summary: The previous implementation of ColorPropType was very hacky as it used `ReactPropTypes.oneOfType([colorValidator, ReactPropTypes.number])`. It turns out that oneOfType also accepts arbitrary functions instead of a type, but doesn't display any of the error message. In this diff I properly implement isRequired (sadly we don't export `createChainableTypeChecker` in ReactPropTypes) and provide a lot more context that we have. I copy and pasted the way we displayed this context from the existing checkers. **Test Plan** When doing .isRequired and do not provide the value: ![simulator screen shot feb 1 2016 9 56 00 am](https://cloud.githubusercontent.com/assets/197597/12726239/61243f88-c8cb-11e5-889b-6594ffd85973.png) When providing a bad value: ![simulator screen shot feb 1 2016 10 01 25 am](https://cloud.githubusercontent.com/assets/197597/12726244/6e80aa36-c8cb-11e5-9bd3-a8637de75496.png) Closes facebook#5671 Reviewed By: svcscm Differential Revision: D2886760 Pulled By: vjeux fb-gh-sync-id: d6be42b5768fca5463fe80fe4b144506d21b0832
- Loading branch information