chore(): update deps (#19437)

This commit is contained in:
Manu MA
2019-09-25 18:12:57 +02:00
committed by GitHub
parent 0f05ea4245
commit 446cf78e58
8 changed files with 219 additions and 119 deletions

View File

@ -1,7 +1,5 @@
import { JSX, actionSheetController } from '@ionic/core';
import { ActionSheetOptions, actionSheetController } from '@ionic/core';
import { createOverlayComponent } from './createOverlayComponent';
export type ActionSheetOptions = JSX.IonActionSheet;
export const IonActionSheet = /*@__PURE__*/createOverlayComponent<ActionSheetOptions, HTMLIonActionSheetElement>('IonActionSheet', actionSheetController);

View File

@ -22,7 +22,7 @@ describe('createComponent - events', () => {
test('should add custom events', () => {
const FakeIonFocus = jest.fn((e) => e);
const IonInput = createReactComponent<JSX.IonInput, HTMLIonInputElement>('ion-input');
const IonInput = createReactComponent<JSX.IonInput>('ion-input');
const { getByText } = render(
<IonInput onIonFocus={FakeIonFocus}>

View File

@ -8,16 +8,12 @@ import { RouterDirection } from './hrefprops';
import { attachEventProps, createForwardRef, dashToPascalCase, isCoveredByReact } from './utils';
import { deprecationWarning } from './utils/dev';
interface IonicReactInternalProps<ElementType> {
interface IonicReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> {
forwardedRef?: React.Ref<ElementType>;
children?: React.ReactNode;
href?: string;
routerLink?: string;
target?: string;
style?: string;
ref?: React.Ref<any>;
routerDirection?: RouterDirection;
className?: string;
}
export const createReactComponent = <PropType, ElementType>(
@ -25,10 +21,10 @@ export const createReactComponent = <PropType, ElementType>(
hrefComponent = false
) => {
const displayName = dashToPascalCase(tagName);
const ReactComponent = class extends React.Component<IonicReactInternalProps<ElementType>> {
const ReactComponent = class extends React.Component<IonicReactInternalProps<PropType>> {
context!: React.ContextType<typeof NavContext>;
constructor(props: IonicReactInternalProps<ElementType>) {
constructor(props: IonicReactInternalProps<PropType>) {
super(props);
}
@ -41,7 +37,7 @@ export const createReactComponent = <PropType, ElementType>(
}
}
componentDidUpdate(prevProps: IonicReactInternalProps<ElementType>) {
componentDidUpdate(prevProps: IonicReactInternalProps<PropType>) {
const node = ReactDom.findDOMNode(this) as HTMLElement;
attachEventProps(node, this.props, prevProps);
}

View File

@ -12,7 +12,7 @@ type Props = LocalJSX.IonBackButton & ReactProps & {
export const IonBackButton = /*@__PURE__*/(() => class extends React.Component<Props> {
context!: React.ContextType<typeof NavContext>;
clickButton = (e: MouseEvent) => {
clickButton = (e: React.MouseEvent) => {
const defaultHref = this.props.defaultHref;
if (this.context.hasIonicRouter()) {
e.stopPropagation();

View File

@ -1,10 +1,7 @@
import { Platforms, getPlatforms as getPlatformsCore, isPlatform as isPlatformCore } from '@ionic/core';
import React from 'react';
export type IonicReactExternalProps<PropType, ElementType> = PropType & {
ref?: React.RefObject<ElementType>;
children?: React.ReactNode;
};
export type IonicReactExternalProps<PropType, ElementType> = PropType & React.HTMLAttributes<ElementType>;
export const createForwardRef = <PropType, ElementType>(ReactComponent: any, displayName: string) => {
const forwardRef = (props: IonicReactExternalProps<PropType, ElementType>, ref: React.Ref<ElementType>) => {