From b28dead90dcd21acc2249a7eb221a7b3f66ed116 Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Dall'Agnol Date: Wed, 9 Dec 2020 13:09:04 -0300 Subject: [PATCH] fix: TextField value prop not updating internal text state --- src/components/field/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/field/index.js b/src/components/field/index.js index e1113ba2..bd62ceb1 100644 --- a/src/components/field/index.js +++ b/src/components/field/index.js @@ -129,13 +129,18 @@ export default class TextField extends PureComponent { y1: 0, } - static getDerivedStateFromProps({ error }, state) { + static getDerivedStateFromProps({ error, value }, state) { + let newState = {} /* Keep last received error in state */ if (error && error !== state.error) { - return { error } + newState.error = error } - return null + if (value !== state.text) { + newState.text = value + } + + return newState } constructor(props) {