@ionic/react
Advanced tools
Comparing version 4.11.0 to 4.11.1
@@ -5,3 +5,3 @@ import React, { useContext } from 'react'; | ||
import { close, reorder, menu, arrowForward, arrowBack, arrowDown, search, closeCircle } from 'ionicons/icons'; | ||
import { isPlatform as isPlatform$1, getPlatforms as getPlatforms$1, alertController, loadingController, toastController, actionSheetController, modalController, popoverController } from '@ionic/core'; | ||
import { isPlatform as isPlatform$1, getPlatforms as getPlatforms$1, alertController, loadingController, toastController, pickerController, actionSheetController, modalController, popoverController } from '@ionic/core'; | ||
export { setupConfig } from '@ionic/core'; | ||
@@ -134,2 +134,3 @@ import { __rest } from 'tslib'; | ||
navigate: (path) => { window.location.pathname = path; }, | ||
tabNavigate: () => undefined, | ||
hasIonicRouter: () => false, | ||
@@ -350,3 +351,2 @@ registerIonPage: () => undefined, | ||
const IonNote = /*@__PURE__*/ createReactComponent('ion-note'); | ||
const IonPicker = /*@__PURE__*/ createReactComponent('ion-picker'); | ||
const IonPickerColumn = /*@__PURE__*/ createReactComponent('ion-picker-column'); | ||
@@ -431,2 +431,4 @@ const IonNav = /*@__PURE__*/ createReactComponent('ion-nav'); | ||
const IonPicker = /*@__PURE__*/ createControllerComponent('IonPicker', pickerController); | ||
const createOverlayComponent = (displayName, controller) => { | ||
@@ -523,11 +525,14 @@ const dismissEventName = `on${displayName}DidDismiss`; | ||
this.onTabButtonClick = (e) => { | ||
const { navigate } = this.props; | ||
if (navigate) { | ||
if (this.state.activeTab === e.detail.tab) { | ||
navigate(this.state.tabs[e.detail.tab].originalHref, 'back'); | ||
if (this.state.activeTab === e.detail.tab) { | ||
const originalHref = this.state.tabs[e.detail.tab].originalHref; | ||
if (this.context.hasIonicRouter()) { | ||
this.context.tabNavigate(originalHref); | ||
} | ||
else { | ||
navigate(this.state.tabs[e.detail.tab].currentHref, 'none'); | ||
this.context.navigate(originalHref, 'back'); | ||
} | ||
} | ||
else { | ||
this.context.navigate(this.state.tabs[e.detail.tab].currentHref, 'none'); | ||
} | ||
}; | ||
@@ -578,8 +583,9 @@ this.renderChild = (activeTab) => (child) => { | ||
} | ||
static get contextType() { | ||
return NavContext; | ||
} | ||
})(); | ||
const IonTabBar = props => { | ||
const context = useContext(NavContext); | ||
return (React.createElement(IonTabBarUnwrapped, Object.assign({}, props, { navigate: props.navigate || ((path, direction) => { | ||
context.navigate(path, direction); | ||
}), currentPath: props.currentPath || context.currentPath }), props.children)); | ||
return (React.createElement(IonTabBarUnwrapped, Object.assign({}, props, { currentPath: props.currentPath || context.currentPath }), props.children)); | ||
}; | ||
@@ -586,0 +592,0 @@ |
@@ -139,2 +139,3 @@ 'use strict'; | ||
navigate: (path) => { window.location.pathname = path; }, | ||
tabNavigate: () => undefined, | ||
hasIonicRouter: () => false, | ||
@@ -355,3 +356,2 @@ registerIonPage: () => undefined, | ||
const IonNote = /*@__PURE__*/ createReactComponent('ion-note'); | ||
const IonPicker = /*@__PURE__*/ createReactComponent('ion-picker'); | ||
const IonPickerColumn = /*@__PURE__*/ createReactComponent('ion-picker-column'); | ||
@@ -436,2 +436,4 @@ const IonNav = /*@__PURE__*/ createReactComponent('ion-nav'); | ||
const IonPicker = /*@__PURE__*/ createControllerComponent('IonPicker', core.pickerController); | ||
const createOverlayComponent = (displayName, controller) => { | ||
@@ -528,11 +530,14 @@ const dismissEventName = `on${displayName}DidDismiss`; | ||
this.onTabButtonClick = (e) => { | ||
const { navigate } = this.props; | ||
if (navigate) { | ||
if (this.state.activeTab === e.detail.tab) { | ||
navigate(this.state.tabs[e.detail.tab].originalHref, 'back'); | ||
if (this.state.activeTab === e.detail.tab) { | ||
const originalHref = this.state.tabs[e.detail.tab].originalHref; | ||
if (this.context.hasIonicRouter()) { | ||
this.context.tabNavigate(originalHref); | ||
} | ||
else { | ||
navigate(this.state.tabs[e.detail.tab].currentHref, 'none'); | ||
this.context.navigate(originalHref, 'back'); | ||
} | ||
} | ||
else { | ||
this.context.navigate(this.state.tabs[e.detail.tab].currentHref, 'none'); | ||
} | ||
}; | ||
@@ -583,8 +588,9 @@ this.renderChild = (activeTab) => (child) => { | ||
} | ||
static get contextType() { | ||
return NavContext; | ||
} | ||
})(); | ||
const IonTabBar = props => { | ||
const context = React.useContext(NavContext); | ||
return (React__default.createElement(IonTabBarUnwrapped, Object.assign({}, props, { navigate: props.navigate || ((path, direction) => { | ||
context.navigate(path, direction); | ||
}), currentPath: props.currentPath || context.currentPath }), props.children)); | ||
return (React__default.createElement(IonTabBarUnwrapped, Object.assign({}, props, { currentPath: props.currentPath || context.currentPath }), props.children)); | ||
}; | ||
@@ -591,0 +597,0 @@ |
@@ -6,2 +6,3 @@ export { AlertButton, AlertInput, setupConfig } from '@ionic/core'; | ||
export { IonToast } from './IonToast'; | ||
export { IonPicker } from './IonPicker'; | ||
export { IonActionSheet } from './IonActionSheet'; | ||
@@ -8,0 +9,0 @@ export { IonModal } from './IonModal'; |
@@ -7,3 +7,3 @@ /// <reference types="react" /> | ||
export declare const IonModal: { | ||
new (props: Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate"> & { | ||
new (props: Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation"> & { | ||
children: import("react").ReactNode; | ||
@@ -15,6 +15,6 @@ } & import("./createOverlayComponent").ReactOverlayProps): { | ||
componentWillUnmount(): void; | ||
componentDidUpdate(prevProps: Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate"> & { | ||
componentDidUpdate(prevProps: Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation"> & { | ||
children: import("react").ReactNode; | ||
} & import("./createOverlayComponent").ReactOverlayProps): Promise<void>; | ||
present(prevProps?: (Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate"> & { | ||
present(prevProps?: (Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation"> & { | ||
children: import("react").ReactNode; | ||
@@ -24,7 +24,7 @@ } & import("./createOverlayComponent").ReactOverlayProps) | undefined): Promise<void>; | ||
context: any; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate"> & { | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation"> & { | ||
children: import("react").ReactNode; | ||
} & import("./createOverlayComponent").ReactOverlayProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; | ||
forceUpdate(callback?: (() => void) | undefined): void; | ||
readonly props: Readonly<Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate"> & { | ||
readonly props: Readonly<Pick<ModalOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation"> & { | ||
children: import("react").ReactNode; | ||
@@ -31,0 +31,0 @@ } & import("./createOverlayComponent").ReactOverlayProps> & Readonly<{ |
@@ -7,3 +7,3 @@ /// <reference types="react" /> | ||
export declare const IonPopover: { | ||
new (props: Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate" | "event"> & { | ||
new (props: Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation" | "event"> & { | ||
children: import("react").ReactNode; | ||
@@ -15,6 +15,6 @@ } & import("./createOverlayComponent").ReactOverlayProps): { | ||
componentWillUnmount(): void; | ||
componentDidUpdate(prevProps: Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate" | "event"> & { | ||
componentDidUpdate(prevProps: Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation" | "event"> & { | ||
children: import("react").ReactNode; | ||
} & import("./createOverlayComponent").ReactOverlayProps): Promise<void>; | ||
present(prevProps?: (Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate" | "event"> & { | ||
present(prevProps?: (Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation" | "event"> & { | ||
children: import("react").ReactNode; | ||
@@ -24,7 +24,7 @@ } & import("./createOverlayComponent").ReactOverlayProps) | undefined): Promise<void>; | ||
context: any; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate" | "event"> & { | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation" | "event"> & { | ||
children: import("react").ReactNode; | ||
} & import("./createOverlayComponent").ReactOverlayProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; | ||
forceUpdate(callback?: (() => void) | undefined): void; | ||
readonly props: Readonly<Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "backdropDismiss" | "cssClass" | "enterAnimation" | "keyboardClose" | "leaveAnimation" | "showBackdrop" | "delegate" | "event"> & { | ||
readonly props: Readonly<Pick<PopoverOptions<import("@ionic/core").ComponentRef>, "id" | "mode" | "animated" | "translucent" | "showBackdrop" | "backdropDismiss" | "cssClass" | "delegate" | "keyboardClose" | "enterAnimation" | "leaveAnimation" | "event"> & { | ||
children: import("react").ReactNode; | ||
@@ -31,0 +31,0 @@ } & import("./createOverlayComponent").ReactOverlayProps> & Readonly<{ |
import { JSX as LocalJSX } from '@ionic/core'; | ||
import React from 'react'; | ||
declare type Props = LocalJSX.IonTabBar & { | ||
navigate?: (path: string, direction: 'back' | 'none') => void; | ||
currentPath?: string; | ||
@@ -6,0 +5,0 @@ slot?: 'bottom' | 'top'; |
@@ -12,4 +12,5 @@ import { RouterDirection } from '@ionic/core'; | ||
registerIonPage: (page: HTMLElement) => void; | ||
tabNavigate: (url: string) => void; | ||
currentPath: string | undefined; | ||
} | ||
export declare const NavContext: React.Context<NavContextState>; |
{ | ||
"name": "@ionic/react", | ||
"version": "4.11.0", | ||
"version": "4.11.1", | ||
"description": "React specific wrapper for @ionic/core", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ionic/core": "4.11.0", | ||
"@ionic/core": "4.11.1", | ||
"tslib": "*" | ||
@@ -45,0 +45,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64
5311
686537
+ Added@ionic/core@4.11.1(transitive)
- Removed@ionic/core@4.11.0(transitive)
Updated@ionic/core@4.11.1