Skip to content

Commit e31a33e

Browse files
committed
fix: fix textinput not animating on changing error. fixes #611
1 parent 77fb950 commit e31a33e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/TextInput.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ class TextInput extends React.Component<Props, State> {
212212
componentDidUpdate(prevProps, prevState) {
213213
if (
214214
prevState.focused !== this.state.focused ||
215-
prevState.value !== this.state.value
215+
prevState.value !== this.state.value ||
216+
prevProps.error !== this.props.error
216217
) {
217218
// The label should be minimized if the text input is focused, or has text
218219
// In minimized mode, the label moves up and becomes small
@@ -225,7 +226,8 @@ class TextInput extends React.Component<Props, State> {
225226

226227
if (
227228
prevState.focused !== this.state.focused ||
228-
prevProps.label !== this.props.label
229+
prevProps.label !== this.props.label ||
230+
prevProps.error !== this.props.error
229231
) {
230232
// Show placeholder text only if the input is focused, or has error, or there's no label
231233
// We don't show placeholder if there's a label because the label acts as placeholder

0 commit comments

Comments
 (0)