@ionic/react
Advanced tools
Comparing version 0.0.2-2 to 0.0.2-3
import { FrameworkDelegate } from '@ionic/core'; | ||
export declare function attachViewToDom(parentElement: HTMLElement, reactComponent: any, propsOrData: any, classesToAdd: string[]): Promise<{ | ||
element: HTMLDivElement; | ||
element: HTMLDivElement | HTMLIonPageElement; | ||
reactElement: any; | ||
@@ -10,1 +10,2 @@ instance: any; | ||
export { Delegate }; | ||
export declare function shouldWrapInIonPage(element: HTMLElement): boolean; |
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { isElementModal, isElementNav } from './utils/helpers'; | ||
export function attachViewToDom(parentElement, reactComponent, propsOrData, classesToAdd) { | ||
const wrappingDiv = document.createElement('div'); | ||
const wrappingDiv = shouldWrapInIonPage(parentElement) ? document.createElement('ion-page') : document.createElement('div'); | ||
if (classesToAdd) { | ||
@@ -30,2 +31,5 @@ for (const clazz of classesToAdd) { | ||
export { Delegate }; | ||
export function shouldWrapInIonPage(element) { | ||
return isElementModal(element) || isElementNav(element); | ||
} | ||
//# sourceMappingURL=react-framework-delegate.js.map |
export declare function getOrAppendElement(tagName: string): Element; | ||
export declare function isElementNav(element: HTMLElement): boolean; | ||
export declare function isElementModal(element: HTMLElement): boolean; |
@@ -10,2 +10,8 @@ export function getOrAppendElement(tagName) { | ||
} | ||
export function isElementNav(element) { | ||
return element.tagName.toUpperCase() === 'ION-NAV'; | ||
} | ||
export function isElementModal(element) { | ||
return element.classList.contains('modal-wrapper'); | ||
} | ||
//# sourceMappingURL=helpers.js.map |
{ | ||
"name": "@ionic/react", | ||
"version": "0.0.2-2", | ||
"version": "0.0.2-3", | ||
"description": "React specific wrapper for @ionic/core", | ||
@@ -36,4 +36,4 @@ "keywords": [ | ||
"@ionic/core": "next", | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0", | ||
"react": "latest", | ||
"react-dom": "latest", | ||
"typescript": "~2.5.2" | ||
@@ -40,0 +40,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
9265
108