diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 080edf8a6..b7ae1e358 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -812,6 +812,7 @@ const TextInput = createReactClass({ _inputRef: (undefined: any), _focusSubscription: (undefined: ?Function), _lastNativeText: (undefined: ?string), + _initialDefaultValue: (undefined: ?string), _lastNativeSelection: (undefined: ?Selection), componentDidMount: function() { @@ -890,6 +891,17 @@ const TextInput = createReactClass({ : ''; }, + _getTextDesktop: function(): ?string { + if(!this._initialDefaultValue && typeof this.props.defaultValue === 'string') { + this._initialDefaultValue = this.props.defaultValue; + } + return typeof this.props.value === 'string' + ? this.props.value + : typeof this._initialDefaultValue === 'string' + ? this._initialDefaultValue + : ''; + }, + _setNativeRef: function(ref: any) { this._inputRef = ref; }, @@ -1109,7 +1121,7 @@ const TextInput = createReactClass({ onBlur={this._onBlur} onChange={this._onChange} onSelectionChangeShouldSetResponder={() => true} - text={this._getText()} + text={this._getTextDesktop()} /> ) },