From 5d23b907125ef4b644b10fbe0a6d778fb3cf0354 Mon Sep 17 00:00:00 2001 From: Akshay Vijay Jain Date: Mon, 31 May 2021 20:08:33 +0530 Subject: [PATCH 1/5] updating errored flag, on change of error message #228 Fix issue #228 This component was missing componentDidUpdate and therefore error message was not visible after we submit the form, the error was comming, but the flag stored in state, was not being updated. We are updating this.state.errored with this commit. --- src/components/helper/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/helper/index.js b/src/components/helper/index.js index 6060f9f5..bbed6a93 100644 --- a/src/components/helper/index.js +++ b/src/components/helper/index.js @@ -42,6 +42,9 @@ export default class Helper extends PureComponent { this.listener = focusAnimation .addListener(this.onAnimation.bind(this)); } + componentDidUpdate(prevProps, prevState) { + this.setState({ errored: !! this.props.error}) + } componentWillUnmount() { let { focusAnimation } = this.props; From 6b46588ee38e629596906099ce72523b4548d503 Mon Sep 17 00:00:00 2001 From: Akshay Vijay Jain Date: Mon, 31 May 2021 20:16:18 +0530 Subject: [PATCH 2/5] fixing linting errors --- src/components/helper/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/helper/index.js b/src/components/helper/index.js index bbed6a93..fbb9234e 100644 --- a/src/components/helper/index.js +++ b/src/components/helper/index.js @@ -43,7 +43,8 @@ export default class Helper extends PureComponent { .addListener(this.onAnimation.bind(this)); } componentDidUpdate(prevProps, prevState) { - this.setState({ errored: !! this.props.error}) + + this.setState({ errored: !! this.props.error }); } componentWillUnmount() { @@ -54,11 +55,20 @@ export default class Helper extends PureComponent { onAnimation({ value }) { if (this.animationValue > -0.5 && value <= -0.5) { - this.setState({ errored: true }); + this. + + + + + + + ({ errored: true }); } if (this.animationValue < -0.5 && value >= -0.5) { - this.setState({ errored: false }); + this. + + ({ errored: false }); } this.animationValue = value; From a9beb57a13fe2c7ae449ff7a47eb2b567c8a89a7 Mon Sep 17 00:00:00 2001 From: Akshay Vijay Jain Date: Mon, 31 May 2021 20:20:32 +0530 Subject: [PATCH 3/5] fixing linting error 2 --- src/components/helper/index.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/components/helper/index.js b/src/components/helper/index.js index fbb9234e..d229420e 100644 --- a/src/components/helper/index.js +++ b/src/components/helper/index.js @@ -42,11 +42,12 @@ export default class Helper extends PureComponent { this.listener = focusAnimation .addListener(this.onAnimation.bind(this)); } + componentDidUpdate(prevProps, prevState) { - - this.setState({ errored: !! this.props.error }); - } + this.setState({ errored: !!this.props.error }); + } + componentWillUnmount() { let { focusAnimation } = this.props; @@ -55,20 +56,11 @@ export default class Helper extends PureComponent { onAnimation({ value }) { if (this.animationValue > -0.5 && value <= -0.5) { - this. - - - - - - - ({ errored: true }); + this.setState({ errored: true }); } if (this.animationValue < -0.5 && value >= -0.5) { - this. - - ({ errored: false }); + this.setState({ errored: false }); } this.animationValue = value; From f196d0eac0b5c0a0d6cf9952175b880b70a76835 Mon Sep 17 00:00:00 2001 From: Akshay Vijay Jain Date: Mon, 31 May 2021 20:25:43 +0530 Subject: [PATCH 4/5] removing trailing space --- src/components/helper/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/helper/index.js b/src/components/helper/index.js index d229420e..5e8097de 100644 --- a/src/components/helper/index.js +++ b/src/components/helper/index.js @@ -44,10 +44,9 @@ export default class Helper extends PureComponent { } componentDidUpdate(prevProps, prevState) { - this.setState({ errored: !!this.props.error }); } - + componentWillUnmount() { let { focusAnimation } = this.props; From ae6aec304d9aac0496e7a5cac4bb9ff687a86d68 Mon Sep 17 00:00:00 2001 From: Akshay Vijay Jain Date: Mon, 31 May 2021 20:31:48 +0530 Subject: [PATCH 5/5] adding component did update to update this.state.errored Fix issue #228