Skip to content

Commit 6446baa

Browse files
committed
Temporary return incorrect TextInput fix
1 parent 99e9bdc commit 6446baa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Libraries/Components/TextInput/TextInput.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ const TextInput = createReactClass({
815815
_inputRef: (undefined: any),
816816
_focusSubscription: (undefined: ?Function),
817817
_lastNativeText: (undefined: ?string),
818+
_initialDefaultValue: (undefined: ?string),
818819
_lastNativeSelection: (undefined: ?Selection),
819820

820821
componentDidMount: function() {
@@ -893,6 +894,17 @@ const TextInput = createReactClass({
893894
: '';
894895
},
895896

897+
_getTextDesktop: function(): ?string {
898+
if(!this._initialDefaultValue && typeof this.props.defaultValue === 'string') {
899+
this._initialDefaultValue = this.props.defaultValue;
900+
}
901+
return typeof this.props.value === 'string'
902+
? this.props.value
903+
: typeof this._initialDefaultValue === 'string'
904+
? this._initialDefaultValue
905+
: '';
906+
},
907+
896908
_setNativeRef: function(ref: any) {
897909
this._inputRef = ref;
898910
},
@@ -1112,7 +1124,7 @@ const TextInput = createReactClass({
11121124
onBlur={this._onBlur}
11131125
onChange={this._onChange}
11141126
onSelectionChangeShouldSetResponder={() => true}
1115-
text={this._getText()}
1127+
text={this._getTextDesktop()}
11161128
/>
11171129
)
11181130
},

0 commit comments

Comments
 (0)