(workInProgress)
| 7627 | } |
| 7628 | |
| 7629 | function checkClassInstance(workInProgress) { |
| 7630 | var instance = workInProgress.stateNode; |
| 7631 | var type = workInProgress.type; |
| 7632 | { |
| 7633 | var name = getComponentName(workInProgress) || 'Component'; |
| 7634 | var renderPresent = instance.render; |
| 7635 | |
| 7636 | if (!renderPresent) { |
| 7637 | if (type.prototype && typeof type.prototype.render === 'function') { |
| 7638 | warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); |
| 7639 | } else { |
| 7640 | warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); |
| 7641 | } |
| 7642 | } |
| 7643 | |
| 7644 | var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state; |
| 7645 | 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); |
| 7646 | var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved; |
| 7647 | 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); |
| 7648 | var noInstancePropTypes = !instance.propTypes; |
| 7649 | warning(noInstancePropTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); |
| 7650 | var noInstanceContextTypes = !instance.contextTypes; |
| 7651 | warning(noInstanceContextTypes, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); |
| 7652 | var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function'; |
| 7653 | 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); |
| 7654 | if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { |
| 7655 | 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'); |
| 7656 | } |
| 7657 | var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function'; |
| 7658 | warning(noComponentDidUnmount, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); |
| 7659 | var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function'; |
| 7660 | 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); |
| 7661 | var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function'; |
| 7662 | warning(noComponentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); |
| 7663 | var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function'; |
| 7664 | warning(noUnsafeComponentWillRecieveProps, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); |
| 7665 | var hasMutatedProps = instance.props !== workInProgress.pendingProps; |
| 7666 | 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); |
| 7667 | var noInstanceDefaultProps = !instance.defaultProps; |
| 7668 | 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); |
| 7669 | var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function'; |
| 7670 | warning(noInstanceGetDerivedStateFromProps, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); |
| 7671 | var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function'; |
| 7672 | warning(noInstanceGetDerivedStateFromCatch, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); |
| 7673 | var _state = instance.state; |
| 7674 | if (_state && (typeof _state !== 'object' || isArray(_state))) { |
| 7675 | warning(false, '%s.state: must be set to an object or null', name); |
| 7676 | } |
| 7677 | if (typeof instance.getChildContext === 'function') { |
| 7678 | warning(typeof type.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); |
| 7679 | } |
| 7680 | } |
| 7681 | } |
| 7682 | |
| 7683 | function resetInputPointers(workInProgress, instance) { |
| 7684 | instance.props = workInProgress.memoizedProps; |
no test coverage detected