From 8b88da60cc1c027c56c0375be7c31e30b848baf5 Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Dall'Agnol Date: Sun, 14 Aug 2022 14:56:56 -0300 Subject: [PATCH 1/2] fix: Proptypes error on react-native 0.69 --- package.json | 1 + src/components/affix/index.js | 40 ++++++++++++++------------ src/components/counter/index.js | 21 +++++++------- src/components/field/index.js | 25 +++++++--------- src/components/helper/index.js | 51 ++++++++++++++++++--------------- src/components/label/index.js | 35 +++++++++++----------- yarn.lock | 27 +++++++++++++++-- 7 files changed, 116 insertions(+), 84 deletions(-) diff --git a/package.json b/package.json index ca16b9a6..1698e291 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "preset": "react-native" }, "dependencies": { + "deprecated-react-native-prop-types": "^2.3.0", "prop-types": "^15.5.9" }, "devDependencies": { diff --git a/src/components/affix/index.js b/src/components/affix/index.js index 44330d25..5ea56e46 100644 --- a/src/components/affix/index.js +++ b/src/components/affix/index.js @@ -1,17 +1,18 @@ -import PropTypes from 'prop-types' -import React, { PureComponent } from 'react' -import { Animated, Text } from 'react-native' +import PropTypes from 'prop-types'; +import React, { PureComponent } from 'react'; +import { Animated } from 'react-native'; +import { TextPropTypes } from 'deprecated-react-native-prop-types'; -import styles from './styles' +import styles from './styles'; export default class Affix extends PureComponent { static defaultProps = { numberOfLines: 1, - } + }; static propTypes = { numberOfLines: PropTypes.number, - style: Text.propTypes.style, + style: TextPropTypes.style, color: PropTypes.string.isRequired, fontSize: PropTypes.number.isRequired, @@ -20,16 +21,19 @@ export default class Affix extends PureComponent { labelAnimation: PropTypes.instanceOf(Animated.Value).isRequired, - children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]), - } + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node, + ]), + }; render() { - let { labelAnimation, style, children, type, fontSize, color } = this.props + let { labelAnimation, style, children, type, fontSize, color } = this.props; let containerStyle = { height: fontSize * 1.5, opacity: labelAnimation, - } + }; let textStyle = { includeFontPadding: false, @@ -37,24 +41,24 @@ export default class Affix extends PureComponent { fontSize, color, - } + }; switch (type) { case 'prefix': - containerStyle.paddingRight = 8 - textStyle.textAlign = 'left' - break + containerStyle.paddingRight = 8; + textStyle.textAlign = 'left'; + break; case 'suffix': - containerStyle.paddingLeft = 8 - textStyle.textAlign = 'right' - break + containerStyle.paddingLeft = 8; + textStyle.textAlign = 'right'; + break; } return ( {children} - ) + ); } } diff --git a/src/components/counter/index.js b/src/components/counter/index.js index 679ca9cc..31cee3f8 100644 --- a/src/components/counter/index.js +++ b/src/components/counter/index.js @@ -1,8 +1,9 @@ -import PropTypes from 'prop-types' -import React, { PureComponent } from 'react' -import { Text } from 'react-native' +import PropTypes from 'prop-types'; +import React, { PureComponent } from 'react'; +import { Text } from 'react-native'; +import { TextPropTypes } from 'deprecated-react-native-prop-types'; -import styles from './styles' +import styles from './styles'; export default class Counter extends PureComponent { static propTypes = { @@ -12,24 +13,24 @@ export default class Counter extends PureComponent { baseColor: PropTypes.string.isRequired, errorColor: PropTypes.string.isRequired, - style: Text.propTypes.style, - } + style: TextPropTypes.style, + }; render() { - let { count, limit, baseColor, errorColor, style } = this.props + let { count, limit, baseColor, errorColor, style } = this.props; if (!limit) { - return null + return null; } let textStyle = { color: count > limit ? errorColor : baseColor, - } + }; return ( {count} / {limit} - ) + ); } } diff --git a/src/components/field/index.js b/src/components/field/index.js index 6ba80838..c5f1e84e 100644 --- a/src/components/field/index.js +++ b/src/components/field/index.js @@ -1,14 +1,11 @@ import PropTypes from 'prop-types'; import React, { PureComponent } from 'react'; +import { View, TextInput, Animated, StyleSheet, Platform } from 'react-native'; import { - View, - Text, - TextInput, - Animated, - StyleSheet, - Platform, + TextPropTypes, ViewPropTypes, -} from 'react-native'; + TextInputPropTypes, +} from 'deprecated-react-native-prop-types'; import Line from '../line'; import Label from '../label'; @@ -64,7 +61,7 @@ export default class TextField extends PureComponent { }; static propTypes = { - ...TextInput.propTypes, + ...TextInputPropTypes, animationDuration: PropTypes.number, @@ -82,9 +79,9 @@ export default class TextField extends PureComponent { labelOffset: Label.propTypes.offset, - labelTextStyle: Text.propTypes.style, - titleTextStyle: Text.propTypes.style, - affixTextStyle: Text.propTypes.style, + labelTextStyle: TextPropTypes.style, + titleTextStyle: TextPropTypes.style, + affixTextStyle: TextPropTypes.style, tintColor: PropTypes.string, textColor: PropTypes.string, @@ -115,8 +112,8 @@ export default class TextField extends PureComponent { prefix: PropTypes.string, suffix: PropTypes.string, - containerStyle: (ViewPropTypes || View.propTypes).style, - inputContainerStyle: (ViewPropTypes || View.propTypes).style, + containerStyle: ViewPropTypes.style, + inputContainerStyle: ViewPropTypes.style, }; static inputContainerStyle = styles.inputContainer; @@ -451,7 +448,7 @@ export default class TextField extends PureComponent { inputProps() { let store = {}; - for (let key in TextInput.propTypes) { + for (let key in TextInputPropTypes) { if (key === 'defaultValue') { continue; } diff --git a/src/components/helper/index.js b/src/components/helper/index.js index 486e367c..14b79b9e 100644 --- a/src/components/helper/index.js +++ b/src/components/helper/index.js @@ -1,77 +1,82 @@ -import PropTypes from 'prop-types' -import React, { PureComponent } from 'react' -import { Animated, Text } from 'react-native' +import PropTypes from 'prop-types'; +import React, { PureComponent } from 'react'; +import { Animated } from 'react-native'; +import { TextPropTypes } from 'deprecated-react-native-prop-types'; -import styles from './styles' +import styles from './styles'; export default class Helper extends PureComponent { static propTypes = { title: PropTypes.string, error: PropTypes.string, disabled: PropTypes.bool, - style: Text.propTypes.style, + style: TextPropTypes.style, baseColor: PropTypes.string, errorColor: PropTypes.string, focusAnimation: PropTypes.instanceOf(Animated.Value), - } + }; constructor(props) { - super(props) + super(props); - let { error, focusAnimation } = this.props + let { error, focusAnimation } = this.props; let opacity = focusAnimation.interpolate({ inputRange: [-1, -0.5, 0], outputRange: [1, 0, 1], extrapolate: 'clamp', - }) + }); this.state = { errored: !!error, opacity, - } + }; } componentDidMount() { - let { focusAnimation } = this.props + let { focusAnimation } = this.props; - this.listener = focusAnimation.addListener(this.onAnimation.bind(this)) + this.listener = focusAnimation.addListener(this.onAnimation.bind(this)); } componentWillUnmount() { - let { focusAnimation } = this.props + let { focusAnimation } = this.props; - focusAnimation.removeListener(this.listener) + focusAnimation.removeListener(this.listener); } onAnimation({ value }) { if (this.animationValue > -0.5 && value <= -0.5) { - this.setState({ errored: true }) + this.setState({ errored: true }); } if (this.animationValue < -0.5 && value >= -0.5) { - this.setState({ errored: false }) + this.setState({ errored: false }); } - this.animationValue = value + this.animationValue = value; } render() { - let { errored, opacity } = this.state - let { style, title, error, disabled, baseColor, errorColor } = this.props + let { errored, opacity } = this.state; + let { style, title, error, disabled, baseColor, errorColor } = this.props; - let text = errored ? error : title + let text = errored ? error : title; if (text == null) { - return null + return null; } let textStyle = { opacity, color: !disabled && errored ? errorColor : baseColor, - } + }; - return {text} + return ( + + {text} + + ); } } diff --git a/src/components/label/index.js b/src/components/label/index.js index a6bcbede..a59286d2 100644 --- a/src/components/label/index.js +++ b/src/components/label/index.js @@ -1,15 +1,16 @@ -import PropTypes from 'prop-types' -import React, { PureComponent } from 'react' -import { Animated, Text } from 'react-native' +import PropTypes from 'prop-types'; +import React, { PureComponent } from 'react'; +import { Animated } from 'react-native'; +import { TextPropTypes } from 'deprecated-react-native-prop-types'; -import styles from './styles' +import styles from './styles'; export default class Label extends PureComponent { static defaultProps = { numberOfLines: 1, disabled: false, restricted: false, - } + }; static propTypes = { numberOfLines: PropTypes.number, @@ -39,9 +40,9 @@ export default class Label extends PureComponent { y1: PropTypes.number, }), - style: Text.propTypes.style, + style: TextPropTypes.style, label: PropTypes.string, - } + }; render() { let { @@ -59,10 +60,10 @@ export default class Label extends PureComponent { focusAnimation, labelAnimation, ...props - } = this.props + } = this.props; if (label == null) { - return null + return null; } let color = disabled @@ -72,19 +73,19 @@ export default class Label extends PureComponent { : focusAnimation.interpolate({ inputRange: [-1, 0, 1], outputRange: [errorColor, baseColor, tintColor], - }) + }); let textStyle = { lineHeight: (style && style.lineHeight) || fontSize, fontSize, color, - } + }; - let { x0, y0, x1, y1 } = offset + let { x0, y0, x1, y1 } = offset; - y0 += activeFontSize - y0 += contentInset.label - y0 += fontSize * 0.25 + y0 += activeFontSize; + y0 += contentInset.label; + y0 += fontSize * 0.25; let containerStyle = { transform: [ @@ -107,7 +108,7 @@ export default class Label extends PureComponent { }), }, ], - } + }; return ( @@ -115,6 +116,6 @@ export default class Label extends PureComponent { {label} - ) + ); } } diff --git a/yarn.lock b/yarn.lock index b2623abd..76453a69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2414,6 +2414,11 @@ resolved "https://registry.yarnpkg.com/@react-native-community/eslint-plugin/-/eslint-plugin-1.1.0.tgz#e42b1bef12d2415411519fd528e64b593b1363dc" integrity sha512-W/J0fNYVO01tioHjvYWQ9m6RgndVtbElzYozBq1ZPrHO/iCzlqoySHl4gO/fpCl9QEFjvJfjPgtPMTMlsoq5DQ== +"@react-native/normalize-color@*": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@react-native/normalize-color/-/normalize-color-2.0.0.tgz#da955909432474a9a0fe1cbffc66576a0447f567" + integrity sha512-Wip/xsc5lw8vsBlmY2MO/gFLp3MvuZ2baBZjDeTjjndMgM0h5sxz7AZR62RDPGgstp8Np7JzjvVqVT7tpFZqsw== + "@release-it/conventional-changelog@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@release-it/conventional-changelog/-/conventional-changelog-2.0.1.tgz#bdd52ad3ecc0d6e39d637592d6ea2bd6d28e5ecb" @@ -4388,6 +4393,15 @@ depd@~1.1.2: resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= +deprecated-react-native-prop-types@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-2.3.0.tgz#c10c6ee75ff2b6de94bb127f142b814e6e08d9ab" + integrity sha512-pWD0voFtNYxrVqvBMYf5gq3NA2GCpfodS1yNynTPc93AYA/KEMGeWDqqeUB6R2Z9ZofVhks2aeJXiuQqKNpesA== + dependencies: + "@react-native/normalize-color" "*" + invariant "*" + prop-types "*" + deprecation@^2.0.0, deprecation@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" @@ -6000,7 +6014,7 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -invariant@^2.2.4: +invariant@*, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== @@ -8753,6 +8767,15 @@ prompts@^2.4.2: kleur "^3.0.3" sisteransi "^1.0.5" +prop-types@*: + version "15.8.1" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" + integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.13.1" + prop-types@^15.5.9, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" @@ -8886,7 +8909,7 @@ react-devtools-core@^4.6.0: shell-quote "^1.6.1" ws "^7" -react-is@^16.12.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: +react-is@^16.12.0, react-is@^16.13.1, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== From 9b6c4f1986339f1c9bd46693bd0677978ba5ac0a Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Dall'Agnol Date: Sun, 14 Aug 2022 14:57:23 -0300 Subject: [PATCH 2/2] chore: Run eslint and update tests snapshots --- .eslintrc.js | 4 +- example/__tests__/App-test.js | 14 --- example/app.js | 3 +- index.js | 8 +- scripts/bootstrap.js | 2 +- src/components/affix/styles.js | 4 +- src/components/affix/test.js | 40 +++---- src/components/counter/styles.js | 4 +- src/components/counter/test.js | 32 +++--- .../field-filled/__snapshots__/test.js.snap | 6 + src/components/field-filled/index.js | 13 ++- src/components/field-filled/styles.js | 4 +- src/components/field-filled/test.js | 60 ++++++---- .../field-outlined/__snapshots__/test.js.snap | 6 + src/components/field-outlined/index.js | 36 +++--- src/components/field-outlined/test.js | 58 ++++++---- .../field/__snapshots__/test.js.snap | 13 +++ src/components/field/styles.js | 4 +- src/components/field/test.js | 108 ++++++++++-------- src/components/helper/styles.js | 4 +- src/components/helper/test.js | 36 +++--- src/components/label/styles.js | 4 +- src/components/label/test.js | 64 ++++++----- src/components/line/index.js | 54 +++++---- src/components/line/styles.js | 4 +- src/components/line/test.js | 38 +++--- src/components/outline/index.js | 59 ++++++---- src/components/outline/styles.js | 8 +- src/components/outline/test.js | 38 +++--- 29 files changed, 403 insertions(+), 325 deletions(-) delete mode 100644 example/__tests__/App-test.js diff --git a/.eslintrc.js b/.eslintrc.js index e9a017f9..e3d0dfc0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,10 +2,10 @@ module.exports = { plugins: ['react-perf'], extends: ['@react-native-community', 'plugin:react-perf/recommended'], rules: { - semi: 0, + 'semi': 0, 'react-perf/jsx-no-new-object-as-prop': 1, 'react-perf/jsx-no-new-array-as-prop': 0, 'react-perf/jsx-no-new-function-as-prop': 0, 'react-perf/jsx-no-jsx-as-prop': 1, }, -} +}; diff --git a/example/__tests__/App-test.js b/example/__tests__/App-test.js deleted file mode 100644 index 17847669..00000000 --- a/example/__tests__/App-test.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @format - */ - -import 'react-native'; -import React from 'react'; -import App from '../App'; - -// Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; - -it('renders correctly', () => { - renderer.create(); -}); diff --git a/example/app.js b/example/app.js index 8053ba20..739897df 100644 --- a/example/app.js +++ b/example/app.js @@ -157,8 +157,7 @@ class App extends Component { + keyboardShouldPersistTaps="handled"> { let affix = renderer @@ -24,10 +24,10 @@ it('renders prefix', () => { {prefix} ) - .toJSON() + .toJSON(); - expect(affix).toMatchSnapshot() -}) + expect(affix).toMatchSnapshot(); +}); it('renders inactive prefix', () => { let affix = renderer @@ -36,10 +36,10 @@ it('renders inactive prefix', () => { {prefix} ) - .toJSON() + .toJSON(); - expect(affix).toMatchSnapshot() -}) + expect(affix).toMatchSnapshot(); +}); it('renders suffix', () => { let affix = renderer @@ -48,10 +48,10 @@ it('renders suffix', () => { {suffix} ) - .toJSON() + .toJSON(); - expect(affix).toMatchSnapshot() -}) + expect(affix).toMatchSnapshot(); +}); it('renders inactive suffix', () => { let affix = renderer @@ -60,7 +60,7 @@ it('renders inactive suffix', () => { {suffix} ) - .toJSON() + .toJSON(); - expect(affix).toMatchSnapshot() -}) + expect(affix).toMatchSnapshot(); +}); diff --git a/src/components/counter/styles.js b/src/components/counter/styles.js index b1666740..8eb9cdf4 100644 --- a/src/components/counter/styles.js +++ b/src/components/counter/styles.js @@ -1,4 +1,4 @@ -import { StyleSheet } from 'react-native' +import { StyleSheet } from 'react-native'; export default StyleSheet.create({ text: { @@ -9,4 +9,4 @@ export default StyleSheet.create({ paddingVertical: 2, marginLeft: 8, }, -}) +}); diff --git a/src/components/counter/test.js b/src/components/counter/test.js index aa42fa28..b57bc1f1 100644 --- a/src/components/counter/test.js +++ b/src/components/counter/test.js @@ -1,8 +1,8 @@ -import 'react-native' -import React from 'react' -import renderer from 'react-test-renderer' +import 'react-native'; +import React from 'react'; +import renderer from 'react-test-renderer'; -import Counter from '.' +import Counter from '.'; /* eslint-env jest */ @@ -10,22 +10,26 @@ const props = { baseColor: 'blue', errorColor: 'red', fontSize: 12, -} +}; it('renders null when limit is not set', () => { - let counter = renderer.create().toJSON() + let counter = renderer.create().toJSON(); - expect(counter).toBeNull() -}) + expect(counter).toBeNull(); +}); it('renders when limit is set', () => { - let counter = renderer.create().toJSON() + let counter = renderer + .create() + .toJSON(); - expect(counter).toMatchSnapshot() -}) + expect(counter).toMatchSnapshot(); +}); it('renders when limit is exceeded', () => { - let counter = renderer.create().toJSON() + let counter = renderer + .create() + .toJSON(); - expect(counter).toMatchSnapshot() -}) + expect(counter).toMatchSnapshot(); +}); diff --git a/src/components/field-filled/__snapshots__/test.js.snap b/src/components/field-filled/__snapshots__/test.js.snap index 485b017f..f73dd437 100644 --- a/src/components/field-filled/__snapshots__/test.js.snap +++ b/src/components/field-filled/__snapshots__/test.js.snap @@ -51,6 +51,7 @@ exports[`renders 1`] = ` /> { - let field = renderer.create().toJSON() + let field = renderer.create().toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders value', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders disabled value', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders title', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders counter', () => { let field = renderer - .create() - .toJSON() + .create( + + ) + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders accessory', () => { - let render = () => + let render = () => ; - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); diff --git a/src/components/field-outlined/__snapshots__/test.js.snap b/src/components/field-outlined/__snapshots__/test.js.snap index 011e0330..483c16a8 100644 --- a/src/components/field-outlined/__snapshots__/test.js.snap +++ b/src/components/field-outlined/__snapshots__/test.js.snap @@ -170,6 +170,7 @@ exports[`renders 1`] = ` /> + return ; } } diff --git a/src/components/field-outlined/test.js b/src/components/field-outlined/test.js index 82a482b3..4ddd7470 100644 --- a/src/components/field-outlined/test.js +++ b/src/components/field-outlined/test.js @@ -1,53 +1,61 @@ -import { Image } from 'react-native' -import React from 'react' -import renderer from 'react-test-renderer' +import { Image } from 'react-native'; +import React from 'react'; +import renderer from 'react-test-renderer'; -import OutlinedTextField from '.' +import OutlinedTextField from '.'; const props = { label: 'test', -} +}; /* eslint-env jest */ it('renders', () => { - let field = renderer.create().toJSON() + let field = renderer.create().toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders value', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders disabled value', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders title', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders counter', () => { let field = renderer - .create() - .toJSON() + .create( + + ) + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders accessory', () => { - let render = () => + let render = () => ; let field = renderer .create() - .toJSON() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); diff --git a/src/components/field/__snapshots__/test.js.snap b/src/components/field/__snapshots__/test.js.snap index 705e7bf3..760ff284 100644 --- a/src/components/field/__snapshots__/test.js.snap +++ b/src/components/field/__snapshots__/test.js.snap @@ -48,6 +48,7 @@ exports[`renders 1`] = ` /> { - let field = renderer.create().toJSON() + let field = renderer.create().toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders value', () => { - let field = renderer.create().toJSON() + let field = renderer.create().toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders disabled value', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders default value', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders multiline value', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders title', () => { - let field = renderer.create().toJSON() + let field = renderer.create().toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders error', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders counter', () => { let field = renderer .create() - .toJSON() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders restriction', () => { let field = renderer .create() - .toJSON() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders prefix', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders suffix', () => { - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders left accessory', () => { - let render = () => + let render = () => ; - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); it('renders right accessory', () => { - let render = () => + let render = () => ; - let field = renderer.create().toJSON() + let field = renderer + .create() + .toJSON(); - expect(field).toMatchSnapshot() -}) + expect(field).toMatchSnapshot(); +}); diff --git a/src/components/helper/styles.js b/src/components/helper/styles.js index fadeb8e2..b9dec92f 100644 --- a/src/components/helper/styles.js +++ b/src/components/helper/styles.js @@ -1,4 +1,4 @@ -import { StyleSheet } from 'react-native' +import { StyleSheet } from 'react-native'; export default StyleSheet.create({ text: { @@ -9,4 +9,4 @@ export default StyleSheet.create({ paddingVertical: 2, textAlign: 'left', }, -}) +}); diff --git a/src/components/helper/test.js b/src/components/helper/test.js index d6a2ddac..ac7b3a47 100644 --- a/src/components/helper/test.js +++ b/src/components/helper/test.js @@ -1,13 +1,13 @@ -import 'react-native' -import React from 'react' -import { Animated } from 'react-native' -import renderer from 'react-test-renderer' +import 'react-native'; +import React from 'react'; +import { Animated } from 'react-native'; +import renderer from 'react-test-renderer'; -import Helper from '.' +import Helper from '.'; /* eslint-env jest */ -const text = 'helper' +const text = 'helper'; const props = { title: text, fontSize: 16, @@ -16,24 +16,26 @@ const props = { errorColor: 'red', focusAnimation: new Animated.Value(0), -} +}; it('renders helper', () => { - let helper = renderer.create().toJSON() + let helper = renderer.create().toJSON(); - expect(helper).toMatchSnapshot() -}) + expect(helper).toMatchSnapshot(); +}); it('renders disabled helper', () => { - let helper = renderer.create().toJSON() + let helper = renderer.create().toJSON(); - expect(helper).toMatchSnapshot() -}) + expect(helper).toMatchSnapshot(); +}); it('renders helper with error', () => { let helper = renderer - .create() - .toJSON() + .create( + + ) + .toJSON(); - expect(helper).toMatchSnapshot() -}) + expect(helper).toMatchSnapshot(); +}); diff --git a/src/components/label/styles.js b/src/components/label/styles.js index 60debfa0..af560f33 100644 --- a/src/components/label/styles.js +++ b/src/components/label/styles.js @@ -1,4 +1,4 @@ -import { StyleSheet } from 'react-native' +import { StyleSheet } from 'react-native'; export default StyleSheet.create({ container: { @@ -14,4 +14,4 @@ export default StyleSheet.create({ includeFontPadding: false, textAlignVertical: 'top', }, -}) +}); diff --git a/src/components/label/test.js b/src/components/label/test.js index adc86196..24c3da8f 100644 --- a/src/components/label/test.js +++ b/src/components/label/test.js @@ -1,9 +1,9 @@ -import 'react-native' -import React from 'react' -import { Animated } from 'react-native' -import renderer from 'react-test-renderer' +import 'react-native'; +import React from 'react'; +import { Animated } from 'react-native'; +import renderer from 'react-test-renderer'; -import Label from '.' +import Label from '.'; /* eslint-env jest */ @@ -22,25 +22,27 @@ const props = { focusAnimation: new Animated.Value(0), labelAnimation: new Animated.Value(0), label: 'test', -} +}; it('renders label', () => { - let label = renderer.create(