RN: Delete TextInput.selectionState Prop

Summary:
Deletes the `selectionState` prop from `TextInput`.

It does not provide meaningful value over `onBlur`, `onFocus`, and `selectionState`.

Changelog:
[Breaking][TextInput] Removing `selectionState` prop, use `onBlur`, `onFocus`, and `onUpdate` instead.

Reviewed By: zackargyle, TheSavior

Differential Revision: D17879667

fbshipit-source-id: 03a4e239406932adad898d6d2a092e3bc2e6b064
This commit is contained in:
Tim Yung
2019-10-12 15:52:25 -07:00
committed by Facebook Github Bot
parent 63769518e0
commit 2becdfd404
3 changed files with 1 additions and 198 deletions
+1 -31
View File
@@ -10,7 +10,6 @@
'use strict';
const DeprecatedTextInputPropTypes = require('../../DeprecatedPropTypes/DeprecatedTextInputPropTypes');
const DocumentSelectionState = require('../../vendor/document/selection/DocumentSelectionState');
const NativeMethodsMixin = require('../../Renderer/shims/NativeMethodsMixin');
const Platform = require('../../Utilities/Platform');
const React = require('react');
@@ -221,23 +220,6 @@ type IOSProps = $ReadOnly<{|
*/
enablesReturnKeyAutomatically?: ?boolean,
/**
* An instance of `DocumentSelectionState`, this is some state that is responsible for
* maintaining selection information for a document.
*
* Some functionality that can be performed with this instance is:
*
* - `blur()`
* - `focus()`
* - `update()`
*
* > You can reference `DocumentSelectionState` in
* > [`vendor/document/selection/DocumentSelectionState.js`](https://github.com/facebook/react-native/blob/master/Libraries/vendor/document/selection/DocumentSelectionState.js)
*
* @platform ios
*/
selectionState?: ?DocumentSelectionState,
/**
* When the clear button should appear on the right side of the text view.
* This property is supported only for single-line TextInput component.
@@ -1115,10 +1097,6 @@ const TextInput = createReactClass({
if (this.props.onFocus) {
this.props.onFocus(event);
}
if (this.props.selectionState) {
this.props.selectionState.focus();
}
},
_onPress: function(event: PressEvent) {
@@ -1161,7 +1139,7 @@ const TextInput = createReactClass({
this._lastNativeSelection = event.nativeEvent.selection;
if (this.props.selection || this.props.selectionState) {
if (this.props.selection) {
this.forceUpdate();
}
},
@@ -1198,10 +1176,6 @@ const TextInput = createReactClass({
) {
this._inputRef.setNativeProps(nativeProps);
}
if (this.props.selectionState && selection) {
this.props.selectionState.update(selection.start, selection.end);
}
},
_onBlur: function(event: BlurEvent) {
@@ -1211,10 +1185,6 @@ const TextInput = createReactClass({
if (this.props.onBlur) {
this.props.onBlur(event);
}
if (this.props.selectionState) {
this.props.selectionState.blur();
}
},
_onTextInput: function(event: TextInputEvent) {