@ionic/react
Advanced tools
Comparing version 5.0.0-dev.201911072022.7909b12 to 5.0.0-dev.201911072352.9dbef19
@@ -141,29 +141,32 @@ import React, { useContext } from 'react'; | ||
const attachProps = (node, newProps, oldProps = {}) => { | ||
// add any classes in className to the class list | ||
const className = getClassName(node.classList, newProps, oldProps); | ||
if (className !== '') { | ||
node.className = className; | ||
} | ||
Object.keys(newProps).forEach(name => { | ||
if (name === 'children' || name === 'style' || name === 'ref' || name === 'class' || name === 'className' || name === 'forwardedRef') { | ||
return; | ||
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first | ||
if (node instanceof Element) { | ||
// add any classes in className to the class list | ||
const className = getClassName(node.classList, newProps, oldProps); | ||
if (className !== '') { | ||
node.className = className; | ||
} | ||
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) { | ||
const eventName = name.substring(2); | ||
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1); | ||
if (!isCoveredByReact(eventNameLc)) { | ||
syncEvent(node, eventNameLc, newProps[name]); | ||
Object.keys(newProps).forEach(name => { | ||
if (name === 'children' || name === 'style' || name === 'ref' || name === 'class' || name === 'className' || name === 'forwardedRef') { | ||
return; | ||
} | ||
} | ||
else { | ||
node[name] = newProps[name]; | ||
const propType = typeof newProps[name]; | ||
if (propType === 'string') { | ||
node.setAttribute(camelToDashCase(name), newProps[name]); | ||
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) { | ||
const eventName = name.substring(2); | ||
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1); | ||
if (!isCoveredByReact(eventNameLc)) { | ||
syncEvent(node, eventNameLc, newProps[name]); | ||
} | ||
} | ||
else { | ||
node[name] = newProps[name]; | ||
const propType = typeof newProps[name]; | ||
if (propType === 'string') { | ||
node.setAttribute(camelToDashCase(name), newProps[name]); | ||
} | ||
else { | ||
node[name] = newProps[name]; | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -409,7 +412,13 @@ const getClassName = (classList, newProps, oldProps) => { | ||
const _a = this.props, { isOpen, onDidDismiss } = _a, cProps = __rest(_a, ["isOpen", "onDidDismiss"]); | ||
const overlay = this.overlay = await controller.create(Object.assign({}, cProps)); | ||
let overlay = this.overlay; | ||
if (!overlay) { | ||
overlay = this.overlay = await controller.create(Object.assign({}, cProps)); | ||
} | ||
attachProps(overlay, { | ||
[dismissEventName]: onDidDismiss | ||
}, prevProps); | ||
await overlay.present(); | ||
// Check isOpen again since the value could of changed during the async call to controller.create | ||
if (this.props.isOpen === true) { | ||
await overlay.present(); | ||
} | ||
} | ||
@@ -416,0 +425,0 @@ render() { |
@@ -147,29 +147,32 @@ 'use strict'; | ||
const attachProps = (node, newProps, oldProps = {}) => { | ||
// add any classes in className to the class list | ||
const className = getClassName(node.classList, newProps, oldProps); | ||
if (className !== '') { | ||
node.className = className; | ||
} | ||
Object.keys(newProps).forEach(name => { | ||
if (name === 'children' || name === 'style' || name === 'ref' || name === 'class' || name === 'className' || name === 'forwardedRef') { | ||
return; | ||
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first | ||
if (node instanceof Element) { | ||
// add any classes in className to the class list | ||
const className = getClassName(node.classList, newProps, oldProps); | ||
if (className !== '') { | ||
node.className = className; | ||
} | ||
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) { | ||
const eventName = name.substring(2); | ||
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1); | ||
if (!isCoveredByReact(eventNameLc)) { | ||
syncEvent(node, eventNameLc, newProps[name]); | ||
Object.keys(newProps).forEach(name => { | ||
if (name === 'children' || name === 'style' || name === 'ref' || name === 'class' || name === 'className' || name === 'forwardedRef') { | ||
return; | ||
} | ||
} | ||
else { | ||
node[name] = newProps[name]; | ||
const propType = typeof newProps[name]; | ||
if (propType === 'string') { | ||
node.setAttribute(camelToDashCase(name), newProps[name]); | ||
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) { | ||
const eventName = name.substring(2); | ||
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1); | ||
if (!isCoveredByReact(eventNameLc)) { | ||
syncEvent(node, eventNameLc, newProps[name]); | ||
} | ||
} | ||
else { | ||
node[name] = newProps[name]; | ||
const propType = typeof newProps[name]; | ||
if (propType === 'string') { | ||
node.setAttribute(camelToDashCase(name), newProps[name]); | ||
} | ||
else { | ||
node[name] = newProps[name]; | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -415,7 +418,13 @@ const getClassName = (classList, newProps, oldProps) => { | ||
const _a = this.props, { isOpen, onDidDismiss } = _a, cProps = tslib_1.__rest(_a, ["isOpen", "onDidDismiss"]); | ||
const overlay = this.overlay = await controller.create(Object.assign({}, cProps)); | ||
let overlay = this.overlay; | ||
if (!overlay) { | ||
overlay = this.overlay = await controller.create(Object.assign({}, cProps)); | ||
} | ||
attachProps(overlay, { | ||
[dismissEventName]: onDidDismiss | ||
}, prevProps); | ||
await overlay.present(); | ||
// Check isOpen again since the value could of changed during the async call to controller.create | ||
if (this.props.isOpen === true) { | ||
await overlay.present(); | ||
} | ||
} | ||
@@ -422,0 +431,0 @@ render() { |
{ | ||
"name": "@ionic/react", | ||
"version": "5.0.0-dev.201911072022.7909b12", | ||
"version": "5.0.0-dev.201911072352.9dbef19", | ||
"description": "React specific wrapper for @ionic/core", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ionic/core": "5.0.0-dev.201911072022.7909b12", | ||
"@ionic/core": "5.0.0-dev.201911072352.9dbef19", | ||
"tslib": "*" | ||
@@ -45,0 +45,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
## @ionic/react (beta) | ||
## @ionic/react | ||
@@ -30,5 +30,2 @@ These are React specific building blocks on top of [@ionic/core](https://www.npmjs.com/package/@ionic/core) components/services. | ||
Open the './capacitor.config.json' file in your projects root. | ||
Change `"webDir": "www"` to be `"webDir": "build"` (dependent on your config but Ionic React defaults with this as the build directory) | ||
Then run the following command to get started with either `ios` or `android` platforms. | ||
@@ -35,0 +32,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 not supported yet
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 not supported yet
680986
5097
58
+ Added@ionic/core@5.0.0-dev.201911072352.9dbef19(transitive)
- Removed@ionic/core@5.0.0-dev.201911072022.7909b12(transitive)