(workInProgress)
| 7530 | } |
| 7531 | |
| 7532 | function checkClassInstance(workInProgress) { |
| 7533 | var instance = workInProgress.stateNode; |
| 7534 | var type = workInProgress.type; |
| 7535 | { |
| 7536 | var name = getComponentName(workInProgress) || 'Component'; |
| 7537 | var renderPresent = instance.render; |
| 7538 | |
| 7539 | if (!renderPresent) { |
| 7540 | if (type.prototype && typeof type.prototype.render === 'function') { |
| 7541 | warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); |
| 7542 | } else { |
| 7543 | warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); |
| 7544 | } |
| 7545 | } |
| 7546 | |
| 7547 | var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state; |
| 7548 | 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); |
| 7549 | var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved; |
| 7550 | 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); |
| 7551 | var noInstancePropTypes = !instance.propTypes; |
| 7552 | warning(noInstancePropTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); |
| 7553 | var noInstanceContextTypes = !instance.contextTypes; |
| 7554 | warning(noInstanceContextTypes, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); |
| 7555 | var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function'; |
| 7556 | 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); |
| 7557 | if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { |
| 7558 | 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'); |
| 7559 | } |
| 7560 | var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function'; |
| 7561 | warning(noComponentDidUnmount, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); |
| 7562 | var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function'; |
| 7563 | 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); |
| 7564 | var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function'; |
| 7565 | warning(noComponentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); |
| 7566 | var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function'; |
| 7567 | warning(noUnsafeComponentWillRecieveProps, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); |
| 7568 | var hasMutatedProps = instance.props !== workInProgress.pendingProps; |
| 7569 | 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); |
| 7570 | var noInstanceDefaultProps = !instance.defaultProps; |
| 7571 | 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); |
| 7572 | var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function'; |
| 7573 | warning(noInstanceGetDerivedStateFromProps, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); |
| 7574 | var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function'; |
| 7575 | warning(noInstanceGetDerivedStateFromCatch, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); |
| 7576 | var _state = instance.state; |
| 7577 | if (_state && (typeof _state !== 'object' || isArray(_state))) { |
| 7578 | warning(false, '%s.state: must be set to an object or null', name); |
| 7579 | } |
| 7580 | if (typeof instance.getChildContext === 'function') { |
| 7581 | warning(typeof type.childContextTypes === 'object', '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); |
| 7582 | } |
| 7583 | } |
| 7584 | } |
| 7585 | |
| 7586 | function resetInputPointers(workInProgress, instance) { |
| 7587 | instance.props = workInProgress.memoizedProps; |
no test coverage detected