Process childContextTypes via internal constructor
Tim Routowicz committed
May 22, 2015 at 11:06 UTC
d7843fe4d23bf4eeb772465a9b9d9ad498399c40
1 file changed
+6
-3
src/renderers/shared/reconciler/ReactCompositeComponent.js
+6
-3
@@ -371,25 +371,28 @@ var ReactCompositeComponentMixin = {
371
* @private
372
*/
373
_processChildContext: function(currentContext) {
374
+ var Component = ReactNativeComponent.getComponentClassForElement(
375
+ this._currentElement
376
+ );
377
var inst = this._instance;
378
var childContext = inst.getChildContext && inst.getChildContext();
379
if (childContext) {
380
invariant(
378
- typeof inst.constructor.childContextTypes === 'object',
381
+ typeof Component.childContextTypes === 'object',
382
'%s.getChildContext(): childContextTypes must be defined in order to ' +
383
'use getChildContext().',
384
this.getName() || 'ReactCompositeComponent'
385
);
386
if (__DEV__) {
387
this._checkPropTypes(
385
- inst.constructor.childContextTypes,
388
+ Component.childContextTypes,
389
childContext,
390
ReactPropTypeLocations.childContext
391
);
392
}
393
for (var name in childContext) {
394
invariant(
392
- name in inst.constructor.childContextTypes,
395
+ name in Component.childContextTypes,
396
'%s.getChildContext(): key "%s" is not defined in childContextTypes.',
397
this.getName() || 'ReactCompositeComponent',
398
name