@@ -197,7 +197,7 @@ var ReactCompositeComponentMixin = {
197
197
this . _hostParent = hostParent ;
198
198
this . _hostContainerInfo = hostContainerInfo ;
199
199
200
- var publicProps = this . _processProps ( this . _currentElement . props ) ;
200
+ var publicProps = this . _currentElement . props ;
201
201
var publicContext = this . _processContext ( context ) ;
202
202
203
203
var Component = this . _currentElement . type ;
@@ -614,7 +614,7 @@ var ReactCompositeComponentMixin = {
614
614
if ( __DEV__ ) {
615
615
var Component = this . _currentElement . type ;
616
616
if ( Component . contextTypes ) {
617
- this . _checkPropTypes (
617
+ this . _checkContextTypes (
618
618
Component . contextTypes ,
619
619
maskedContext ,
620
620
ReactPropTypeLocations . context
@@ -647,7 +647,7 @@ var ReactCompositeComponentMixin = {
647
647
this . getName ( ) || 'ReactCompositeComponent'
648
648
) ;
649
649
if ( __DEV__ ) {
650
- this . _checkPropTypes (
650
+ this . _checkContextTypes (
651
651
Component . childContextTypes ,
652
652
childContext ,
653
653
ReactPropTypeLocations . childContext
@@ -667,39 +667,14 @@ var ReactCompositeComponentMixin = {
667
667
} ,
668
668
669
669
/**
670
- * Processes props by setting default values for unspecified props and
671
- * asserting that the props are valid. Does not mutate its argument; returns
672
- * a new props object with defaults merged in.
670
+ * Assert that the context types are valid
673
671
*
674
- * @param {object } newProps
675
- * @return {object }
676
- * @private
677
- */
678
- _processProps : function ( newProps ) {
679
- if ( __DEV__ ) {
680
- var Component = this . _currentElement . type ;
681
- if ( Component . propTypes ) {
682
- this . _checkPropTypes (
683
- Component . propTypes ,
684
- newProps ,
685
- ReactPropTypeLocations . prop
686
- ) ;
687
- }
688
- }
689
- return newProps ;
690
- } ,
691
-
692
- /**
693
- * Assert that the props are valid
694
- *
695
- * @param {object } propTypes Map of prop name to a ReactPropType
672
+ * @param {object } propTypes Map of context field to a ReactPropType
696
673
* @param {object } props
697
674
* @param {string } location e.g. "prop", "context", "child context"
698
675
* @private
699
676
*/
700
- _checkPropTypes : function ( propTypes , props , location ) {
701
- // TODO: Stop validating prop types here and only use the element
702
- // validation.
677
+ _checkContextTypes : function ( propTypes , props , location ) {
703
678
var componentName = this . getName ( ) ;
704
679
for ( var propName in propTypes ) {
705
680
if ( propTypes . hasOwnProperty ( propName ) ) {
@@ -724,23 +699,12 @@ var ReactCompositeComponentMixin = {
724
699
// top-level render calls, so I'm abstracting it away into
725
700
// a function to minimize refactoring in the future
726
701
var addendum = getDeclarationErrorAddendum ( this ) ;
727
-
728
- if ( location === ReactPropTypeLocations . prop ) {
729
- // Preface gives us something to blacklist in warning module
730
- warning (
731
- false ,
732
- 'Failed Composite propType: %s%s' ,
733
- error . message ,
734
- addendum
735
- ) ;
736
- } else {
737
- warning (
738
- false ,
739
- 'Failed Context Types: %s%s' ,
740
- error . message ,
741
- addendum
742
- ) ;
743
- }
702
+ warning (
703
+ false ,
704
+ 'Failed Context Types: %s%s' ,
705
+ error . message ,
706
+ addendum
707
+ ) ;
744
708
}
745
709
}
746
710
}
@@ -824,13 +788,10 @@ var ReactCompositeComponentMixin = {
824
788
willReceive = true ;
825
789
}
826
790
827
- // Distinguish between a props update versus a simple state update
828
- if ( prevParentElement === nextParentElement ) {
829
- // Skip checking prop types again -- we don't read inst.props to avoid
830
- // warning for DOM component props in this upgrade
831
- nextProps = nextParentElement . props ;
832
- } else {
833
- nextProps = this . _processProps ( nextParentElement . props ) ;
791
+ nextProps = nextParentElement . props ;
792
+
793
+ // Not a simple state update but a props update
794
+ if ( prevParentElement !== nextParentElement ) {
834
795
willReceive = true ;
835
796
}
836
797
0 commit comments