fix(react): handle undefined attributes better, fixes #19563, #19580 (#19588)

This commit is contained in:
Ely Lucas
2019-10-09 10:36:25 -06:00
committed by GitHub
parent 7ce916cc7c
commit 033abe994b
10 changed files with 22 additions and 37 deletions

View File

@ -4,8 +4,7 @@ import ReactDom from 'react-dom';
import { NavContext } from '../contexts/NavContext';
import { RouterDirection } from './hrefprops';
import { attachEventProps, createForwardRef, dashToPascalCase, isCoveredByReact } from './utils';
import { deprecationWarning } from './utils/dev';
import { attachProps, createForwardRef, dashToPascalCase, isCoveredByReact } from './utils';
interface IonicReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> {
forwardedRef?: React.Ref<ElementType>;
@ -29,16 +28,11 @@ export const createReactComponent = <PropType, ElementType>(
componentDidMount() {
this.componentDidUpdate(this.props);
if (this.props.href) {
setTimeout(() => {
deprecationWarning('hrefchange', 'As of RC3, href links no longer go through the router, so transitions will not be applied to these links. To maintain transitions, use the new routerLink prop.');
}, 2000);
}
}
componentDidUpdate(prevProps: IonicReactInternalProps<PropType>) {
const node = ReactDom.findDOMNode(this) as HTMLElement;
attachEventProps(node, this.props, prevProps);
attachProps(node, this.props, prevProps);
}
private handleClick = (e: React.MouseEvent<PropType>) => {