From 3da6e9f57e1cb4efb02aa60d4214a53ceea73030 Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Thu, 3 Oct 2019 00:45:39 -0400 Subject: [PATCH 1/2] fix: Remove props from native components (#2100) Most properties are spread into native elements to pass properties directly. However, since some of these props aren't dom properties they error on react-native-web. Fixes #1747 --- .../__tests__/__snapshots__/ButtonGroup.js.snap | 6 ------ src/card/__tests__/__snapshots__/Card.js.snap | 2 -- src/helpers/index.js | 9 +++++++++ src/input/Input.js | 4 ++-- src/input/__tests__/__snapshots__/Input.js.snap | 2 -- src/list/__tests__/__snapshots__/ListItem.js.snap | 2 -- .../__tests__/__snapshots__/PricingCard.js.snap | 10 ---------- .../__tests__/__snapshots__/SearchBar.js.snap | 3 --- src/text/Text.js | 3 ++- src/text/__tests__/__snapshots__/Text.js.snap | 4 ---- src/tile/__tests__/__snapshots__/FeaturedTile.js.snap | 2 -- src/tile/__tests__/__snapshots__/Tile.js.snap | 2 -- 12 files changed, 13 insertions(+), 36 deletions(-) diff --git a/src/buttons/__tests__/__snapshots__/ButtonGroup.js.snap b/src/buttons/__tests__/__snapshots__/ButtonGroup.js.snap index 1427709695..5798667b79 100644 --- a/src/buttons/__tests__/__snapshots__/ButtonGroup.js.snap +++ b/src/buttons/__tests__/__snapshots__/ButtonGroup.js.snap @@ -555,7 +555,6 @@ exports[`ButtonGroup Component should apply values from theme 1`] = ` } > Button 1 @@ -651,7 +649,6 @@ exports[`ButtonGroup Component should apply values from theme 1`] = ` } > Button 2 @@ -745,7 +741,6 @@ exports[`ButtonGroup Component should apply values from theme 1`] = ` } > Button 3 diff --git a/src/card/__tests__/__snapshots__/Card.js.snap b/src/card/__tests__/__snapshots__/Card.js.snap index 866f0f011c..01b0a075ce 100644 --- a/src/card/__tests__/__snapshots__/Card.js.snap +++ b/src/card/__tests__/__snapshots__/Card.js.snap @@ -31,7 +31,6 @@ exports[`Card Component should apply values from theme 1`] = ` > Yea b diff --git a/src/helpers/index.js b/src/helpers/index.js index 7cac95f5e1..ce8dd79951 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -12,6 +12,15 @@ const isIOS = Platform.OS === 'ios'; const conditionalStyle = (condition, style) => (condition ? style : {}); +export const patchWebProps = ({ + updateTheme, + replaceTheme, + onClear, + ...rest +}) => { + return rest; +}; + export { renderNode, getIconType, diff --git a/src/input/Input.js b/src/input/Input.js index e727fad9ea..21344da760 100644 --- a/src/input/Input.js +++ b/src/input/Input.js @@ -10,7 +10,7 @@ import { StyleSheet, } from 'react-native'; -import { nodeType, renderNode } from '../helpers'; +import { nodeType, renderNode, patchWebProps } from '../helpers'; import { fonts, withTheme, ViewPropTypes, TextPropTypes } from '../config'; import Icon from '../icons/Icon'; @@ -114,7 +114,7 @@ class Input extends React.Component { testID="RNE__Input__text-input" underlineColorAndroid="transparent" editable={!disabled} - {...attributes} + {...patchWebProps(attributes)} ref={ref => { this.input = ref; }} diff --git a/src/input/__tests__/__snapshots__/Input.js.snap b/src/input/__tests__/__snapshots__/Input.js.snap index c88c03b126..cfbe34c710 100644 --- a/src/input/__tests__/__snapshots__/Input.js.snap +++ b/src/input/__tests__/__snapshots__/Input.js.snap @@ -761,7 +761,6 @@ exports[`Input component should apply values from theme 1`] = ` editable={true} placeholder="Enter text" rejectResponderTermination={true} - replaceTheme={[Function]} style={ Object { "alignSelf": "center", @@ -773,7 +772,6 @@ exports[`Input component should apply values from theme 1`] = ` } testID="RNE__Input__text-input" underlineColorAndroid="transparent" - updateTheme={[Function]} /> diff --git a/src/list/__tests__/__snapshots__/ListItem.js.snap b/src/list/__tests__/__snapshots__/ListItem.js.snap index 620bf9cc41..0b185e262a 100644 --- a/src/list/__tests__/__snapshots__/ListItem.js.snap +++ b/src/list/__tests__/__snapshots__/ListItem.js.snap @@ -25,7 +25,6 @@ exports[`ListItem component should apply values from theme 1`] = ` } > List Title diff --git a/src/pricing/__tests__/__snapshots__/PricingCard.js.snap b/src/pricing/__tests__/__snapshots__/PricingCard.js.snap index 0602462575..0e068a67c8 100644 --- a/src/pricing/__tests__/__snapshots__/PricingCard.js.snap +++ b/src/pricing/__tests__/__snapshots__/PricingCard.js.snap @@ -30,7 +30,6 @@ exports[`PricingCard component should apply values from theme 1`] = ` } > ALL YOU CAN EAT $0 1 User Basic Support All Core Features diff --git a/src/searchbar/__tests__/__snapshots__/SearchBar.js.snap b/src/searchbar/__tests__/__snapshots__/SearchBar.js.snap index 6a9e8241c1..d4907fdb22 100644 --- a/src/searchbar/__tests__/__snapshots__/SearchBar.js.snap +++ b/src/searchbar/__tests__/__snapshots__/SearchBar.js.snap @@ -129,12 +129,10 @@ exports[`SearchBar wrapper component should apply values from theme 1`] = ` onBlur={[Function]} onCancel={[Function]} onChangeText={[Function]} - onClear={[Function]} onFocus={[Function]} placeholder="Enter search term" platform="android" rejectResponderTermination={true} - replaceTheme={[Function]} style={ Object { "alignSelf": "center", @@ -148,7 +146,6 @@ exports[`SearchBar wrapper component should apply values from theme 1`] = ` } testID="searchInput" underlineColorAndroid="transparent" - updateTheme={[Function]} value="" /> { @@ -34,7 +35,7 @@ const TextElement = props => { h3 && StyleSheet.flatten([{ fontSize: normalize(28) }, h3Style]), h4 && StyleSheet.flatten([{ fontSize: normalize(22) }, h4Style]), ])} - {...rest} + {...patchWebProps(rest)} > {children} diff --git a/src/text/__tests__/__snapshots__/Text.js.snap b/src/text/__tests__/__snapshots__/Text.js.snap index b2aed345be..3947d9180b 100644 --- a/src/text/__tests__/__snapshots__/Text.js.snap +++ b/src/text/__tests__/__snapshots__/Text.js.snap @@ -2,7 +2,6 @@ exports[`Text Component local props should override style props on theme 1`] = ` Hey @@ -64,7 +62,6 @@ exports[`Text Component should render without issues 1`] = ` exports[`Text Component should use values from the theme 1`] = ` Hey diff --git a/src/tile/__tests__/__snapshots__/FeaturedTile.js.snap b/src/tile/__tests__/__snapshots__/FeaturedTile.js.snap index 732eea6d19..8b11e3eecd 100644 --- a/src/tile/__tests__/__snapshots__/FeaturedTile.js.snap +++ b/src/tile/__tests__/__snapshots__/FeaturedTile.js.snap @@ -153,7 +153,6 @@ exports[`FeaturedTitle component should apply values from theme 1`] = ` } /> I am featured diff --git a/src/tile/__tests__/__snapshots__/Tile.js.snap b/src/tile/__tests__/__snapshots__/Tile.js.snap index c54183868f..be635402f7 100644 --- a/src/tile/__tests__/__snapshots__/Tile.js.snap +++ b/src/tile/__tests__/__snapshots__/Tile.js.snap @@ -230,7 +230,6 @@ exports[`Tile component should apply styles from theme 1`] = ` } > Mary is friendly From 4845537ef7dea39fb427077b80303dbe8835e630 Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Thu, 3 Oct 2019 00:51:06 -0400 Subject: [PATCH 2/2] chore: Bump package --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c85cfbf671..0590bc30d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-elements", - "version": "1.2.3", + "version": "1.2.4", "description": "React Native Elements & UI Toolkit", "main": "src/index.js", "types": "src/index.d.ts",