(workInProgress)
| 8548 | } |
| 8549 | |
| 8550 | function checkClassInstance(workInProgress) { |
| 8551 | var instance = workInProgress.stateNode; |
| 8552 | var type = workInProgress.type; |
| 8553 | { |
| 8554 | var name = getComponentName(workInProgress) || 'Component'; |
| 8555 | var renderPresent = instance.render; |
| 8556 | |
| 8557 | if (!renderPresent) { |
| 8558 | if (type.prototype && typeof type.prototype.render === 'function') { |
| 8559 | warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); |
| 8560 | } else { |
| 8561 | warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); |
| 8562 | } |
| 8563 | } |
| 8564 | |
| 8565 | var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state; |
| 8566 | 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); |
| 8567 | var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved; |
| 8568 | 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); |
| 8569 | var noInstancePropTypes = !instance.propTypes; |
| 8570 | warning(noInstancePropTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); |
| 8571 | var noInstanceContextTypes = !instance.contextTypes; |
| 8572 | warning(noInstanceContextTypes, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); |
| 8573 | var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function'; |
| 8574 | 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); |
| 8575 | if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { |
| 8576 | 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'); |
| 8577 | } |
| 8578 | var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function'; |
| 8579 | warning(noComponentDidUnmount, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); |
| 8580 | var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function'; |
| 8581 | 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); |
| 8582 | var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function'; |
| 8583 | warning(noComponentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); |
| 8584 | var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function'; |
| 8585 | warning(noUnsafeComponentWillRecieveProps, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); |
| 8586 | var hasMutatedProps = instance.props !== workInProgress.pendingProps; |
| 8587 | 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); |
| 8588 | var noInstanceDefaultProps = !instance.defaultProps; |
| 8589 | 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); |
| 8590 | var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function'; |
| 8591 | warning(noInstanceGetDerivedStateFromProps, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); |
| 8592 | var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function'; |
| 8593 | warning(noInstanceGetDerivedStateFromCatch, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); |
| 8594 | var _state = instance.state; |
| 8595 | if (_state && (typeof _state !== 'object' || isArray(_state))) { |
| 8596 | warning(false, '%s.state: must be set to an object or null', name); |
| 8597 | } |
| 8598 | if (typeof instance.getChildContext === 'function') { |
| 8599 | warning(typeof type.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); |
| 8600 | } |
| 8601 | } |
| 8602 | } |
| 8603 | |
| 8604 | function resetInputPointers(workInProgress, instance) { |
| 8605 | instance.props = workInProgress.memoizedProps; |
no test coverage detected