@ionic/react
Advanced tools
Comparing version 0.0.6-4 to 0.0.6-5
@@ -93,3 +93,3 @@ import { defineCustomElements } from '@ionic/core/loader'; | ||
function createReactComponent(tagName) { | ||
function createReactComponent(tagName, attributeValues = []) { | ||
const displayName = dashToPascalCase(tagName); | ||
@@ -99,3 +99,2 @@ class ReactComponent extends React.Component { | ||
super(props); | ||
this.componentRef = React.createRef(); | ||
} | ||
@@ -106,5 +105,5 @@ static get displayName() { | ||
componentDidMount() { | ||
this.componentWillReceiveProps(this.props); | ||
this.componentDidUpdate(this.props); | ||
} | ||
componentWillReceiveProps(props) { | ||
componentDidUpdate(props) { | ||
const node = ReactDom.findDOMNode(this); | ||
@@ -115,3 +114,9 @@ attachEventProps(node, props, this.props); | ||
const _a = this.props, { children, forwardedRef } = _a, cProps = __rest(_a, ["children", "forwardedRef"]); | ||
return React.createElement(tagName, Object.assign({}, cProps, { ref: forwardedRef }), children); | ||
const propsWithoutAttributeValues = Object.keys(cProps).reduce((oldValue, key) => { | ||
if (attributeValues.indexOf(key) === -1) { | ||
oldValue[key] = cProps[key]; | ||
} | ||
return oldValue; | ||
}, {}); | ||
return React.createElement(tagName, Object.assign({}, propsWithoutAttributeValues, { ref: forwardedRef }), children); | ||
} | ||
@@ -127,3 +132,3 @@ } | ||
// ionicons | ||
const IonIcon = /*@__PURE__*/ createReactComponent('ion-icon'); | ||
const IonIcon = /*@__PURE__*/ createReactComponent('ion-icon', ['icon']); | ||
// /*@__PURE__*/createReactComponent | ||
@@ -130,0 +135,0 @@ const IonTabBarInner = /*@__PURE__*/ createReactComponent('ion-tab-bar'); |
@@ -98,3 +98,3 @@ 'use strict'; | ||
function createReactComponent(tagName) { | ||
function createReactComponent(tagName, attributeValues = []) { | ||
const displayName = dashToPascalCase(tagName); | ||
@@ -104,3 +104,2 @@ class ReactComponent extends React.Component { | ||
super(props); | ||
this.componentRef = React.createRef(); | ||
} | ||
@@ -111,5 +110,5 @@ static get displayName() { | ||
componentDidMount() { | ||
this.componentWillReceiveProps(this.props); | ||
this.componentDidUpdate(this.props); | ||
} | ||
componentWillReceiveProps(props) { | ||
componentDidUpdate(props) { | ||
const node = ReactDom.findDOMNode(this); | ||
@@ -120,3 +119,9 @@ attachEventProps(node, props, this.props); | ||
const _a = this.props, { children, forwardedRef } = _a, cProps = tslib_1.__rest(_a, ["children", "forwardedRef"]); | ||
return React.createElement(tagName, Object.assign({}, cProps, { ref: forwardedRef }), children); | ||
const propsWithoutAttributeValues = Object.keys(cProps).reduce((oldValue, key) => { | ||
if (attributeValues.indexOf(key) === -1) { | ||
oldValue[key] = cProps[key]; | ||
} | ||
return oldValue; | ||
}, {}); | ||
return React.createElement(tagName, Object.assign({}, propsWithoutAttributeValues, { ref: forwardedRef }), children); | ||
} | ||
@@ -132,3 +137,3 @@ } | ||
// ionicons | ||
const IonIcon = /*@__PURE__*/ createReactComponent('ion-icon'); | ||
const IonIcon = /*@__PURE__*/ createReactComponent('ion-icon', ['icon']); | ||
// /*@__PURE__*/createReactComponent | ||
@@ -135,0 +140,0 @@ const IonTabBarInner = /*@__PURE__*/ createReactComponent('ion-tab-bar'); |
import React from 'react'; | ||
export declare function createReactComponent<PropType, ElementType>(tagName: string): React.ForwardRefExoticComponent<React.PropsWithoutRef<PropType & { | ||
export declare function createReactComponent<PropType, ElementType>(tagName: string, attributeValues?: string[]): React.ForwardRefExoticComponent<React.PropsWithoutRef<PropType & { | ||
ref?: React.RefObject<ElementType>; | ||
children?: React.ReactNode; | ||
}> & React.RefAttributes<ElementType>>; |
{ | ||
"name": "@ionic/react", | ||
"version": "0.0.6-4", | ||
"version": "0.0.6-5", | ||
"description": "React specific wrapper for @ionic/core", | ||
@@ -46,3 +46,4 @@ "keywords": [ | ||
"react-router": "^5.0.1", | ||
"react-router-dom": "^5.0.1" | ||
"react-router-dom": "^5.0.1", | ||
"ionicons": "4.5.10-1" | ||
}, | ||
@@ -57,2 +58,3 @@ "devDependencies": { | ||
"@types/react-router-dom": "^4.3.1", | ||
"ionicons": "4.5.10-1", | ||
"jest": "^24.8.0", | ||
@@ -59,0 +61,0 @@ "jest-dom": "^3.4.0", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
452689
4118
0
7
21