(workInProgress)
| 8390 | } |
| 8391 | |
| 8392 | function checkClassInstance(workInProgress) { |
| 8393 | var instance = workInProgress.stateNode; |
| 8394 | var type = workInProgress.type; |
| 8395 | { |
| 8396 | var name = getComponentName(workInProgress) || 'Component'; |
| 8397 | var renderPresent = instance.render; |
| 8398 | |
| 8399 | if (!renderPresent) { |
| 8400 | if (type.prototype && typeof type.prototype.render === 'function') { |
| 8401 | warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); |
| 8402 | } else { |
| 8403 | warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); |
| 8404 | } |
| 8405 | } |
| 8406 | |
| 8407 | var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state; |
| 8408 | warning(noGetInitialStateOnES6, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name); |
| 8409 | var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved; |
| 8410 | warning(noGetDefaultPropsOnES6, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name); |
| 8411 | var noInstancePropTypes = !instance.propTypes; |
| 8412 | warning(noInstancePropTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); |
| 8413 | var noInstanceContextTypes = !instance.contextTypes; |
| 8414 | warning(noInstanceContextTypes, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); |
| 8415 | var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function'; |
| 8416 | warning(noComponentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name); |
| 8417 | if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { |
| 8418 | warning(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(workInProgress) || 'A pure component'); |
| 8419 | } |
| 8420 | var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function'; |
| 8421 | warning(noComponentDidUnmount, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); |
| 8422 | var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function'; |
| 8423 | warning(noComponentDidReceiveProps, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name); |
| 8424 | var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function'; |
| 8425 | warning(noComponentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); |
| 8426 | var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function'; |
| 8427 | warning(noUnsafeComponentWillRecieveProps, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); |
| 8428 | var hasMutatedProps = instance.props !== workInProgress.pendingProps; |
| 8429 | warning(instance.props === undefined || !hasMutatedProps, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name); |
| 8430 | var noInstanceDefaultProps = !instance.defaultProps; |
| 8431 | warning(noInstanceDefaultProps, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name); |
| 8432 | var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function'; |
| 8433 | warning(noInstanceGetDerivedStateFromProps, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); |
| 8434 | var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function'; |
| 8435 | warning(noInstanceGetDerivedStateFromCatch, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); |
| 8436 | var _state = instance.state; |
| 8437 | if (_state && (typeof _state !== 'object' || isArray(_state))) { |
| 8438 | warning(false, '%s.state: must be set to an object or null', name); |
| 8439 | } |
| 8440 | if (typeof instance.getChildContext === 'function') { |
| 8441 | warning(typeof type.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); |
| 8442 | } |
| 8443 | } |
| 8444 | } |
| 8445 | |
| 8446 | function resetInputPointers(workInProgress, instance) { |
| 8447 | instance.props = workInProgress.memoizedProps; |
no test coverage detected