File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -184,11 +184,20 @@ class TextInput extends React.Component<TextInputProps, State> {
184184 }
185185
186186 state = {
187- labeled : new Animated . Value ( this . props . value ? 0 : 1 ) ,
187+ labeled : new Animated . Value (
188+ ( this . props . value !== undefined
189+ ? this . props . value
190+ : this . props . defaultValue )
191+ ? 0
192+ : 1
193+ ) ,
188194 error : new Animated . Value ( this . props . error ? 1 : 0 ) ,
189195 focused : false ,
190196 placeholder : '' ,
191- value : this . props . value || this . props . defaultValue ,
197+ value :
198+ this . props . value !== undefined
199+ ? this . props . value
200+ : this . props . defaultValue ,
192201 labelLayout : {
193202 measured : false ,
194203 width : 0 ,
@@ -201,8 +210,7 @@ class TextInput extends React.Component<TextInputProps, State> {
201210 componentDidUpdate ( prevProps : TextInputProps , prevState : State ) {
202211 if (
203212 prevState . focused !== this . state . focused ||
204- prevState . value !== this . state . value ||
205- this . props . defaultValue
213+ prevState . value !== this . state . value
206214 ) {
207215 // The label should be minimized if the text input is focused, or has text
208216 // In minimized mode, the label moves up and becomes small
You can’t perform that action at this time.
0 commit comments