Skip to content

Commit 2becdfd

Browse files
yungstersfacebook-github-bot
authored andcommitted
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
1 parent 6376951 commit 2becdfd

File tree

3 files changed

+1
-198
lines changed

3 files changed

+1
-198
lines changed

Libraries/Components/TextInput/TextInput.js

+1-31
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
'use strict';
1111

1212
const DeprecatedTextInputPropTypes = require('../../DeprecatedPropTypes/DeprecatedTextInputPropTypes');
13-
const DocumentSelectionState = require('../../vendor/document/selection/DocumentSelectionState');
1413
const NativeMethodsMixin = require('../../Renderer/shims/NativeMethodsMixin');
1514
const Platform = require('../../Utilities/Platform');
1615
const React = require('react');
@@ -221,23 +220,6 @@ type IOSProps = $ReadOnly<{|
221220
*/
222221
enablesReturnKeyAutomatically?: ?boolean,
223222

224-
/**
225-
* An instance of `DocumentSelectionState`, this is some state that is responsible for
226-
* maintaining selection information for a document.
227-
*
228-
* Some functionality that can be performed with this instance is:
229-
*
230-
* - `blur()`
231-
* - `focus()`
232-
* - `update()`
233-
*
234-
* > You can reference `DocumentSelectionState` in
235-
* > [`vendor/document/selection/DocumentSelectionState.js`](https://github.com/facebook/react-native/blob/master/Libraries/vendor/document/selection/DocumentSelectionState.js)
236-
*
237-
* @platform ios
238-
*/
239-
selectionState?: ?DocumentSelectionState,
240-
241223
/**
242224
* When the clear button should appear on the right side of the text view.
243225
* This property is supported only for single-line TextInput component.
@@ -1115,10 +1097,6 @@ const TextInput = createReactClass({
11151097
if (this.props.onFocus) {
11161098
this.props.onFocus(event);
11171099
}
1118-
1119-
if (this.props.selectionState) {
1120-
this.props.selectionState.focus();
1121-
}
11221100
},
11231101

11241102
_onPress: function(event: PressEvent) {
@@ -1161,7 +1139,7 @@ const TextInput = createReactClass({
11611139

11621140
this._lastNativeSelection = event.nativeEvent.selection;
11631141

1164-
if (this.props.selection || this.props.selectionState) {
1142+
if (this.props.selection) {
11651143
this.forceUpdate();
11661144
}
11671145
},
@@ -1198,10 +1176,6 @@ const TextInput = createReactClass({
11981176
) {
11991177
this._inputRef.setNativeProps(nativeProps);
12001178
}
1201-
1202-
if (this.props.selectionState && selection) {
1203-
this.props.selectionState.update(selection.start, selection.end);
1204-
}
12051179
},
12061180

12071181
_onBlur: function(event: BlurEvent) {
@@ -1211,10 +1185,6 @@ const TextInput = createReactClass({
12111185
if (this.props.onBlur) {
12121186
this.props.onBlur(event);
12131187
}
1214-
1215-
if (this.props.selectionState) {
1216-
this.props.selectionState.blur();
1217-
}
12181188
},
12191189

12201190
_onTextInput: function(event: TextInputEvent) {

Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js

-17
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
const DeprecatedColorPropType = require('./DeprecatedColorPropType');
1414
const DeprecatedViewPropTypes = require('./DeprecatedViewPropTypes');
15-
const DocumentSelectionState = require('../vendor/document/selection/DocumentSelectionState');
1615
const PropTypes = require('prop-types');
1716
const Text = require('../Text/Text');
1817

@@ -388,22 +387,6 @@ module.exports = {
388387
* The highlight and cursor color of the text input.
389388
*/
390389
selectionColor: DeprecatedColorPropType,
391-
/**
392-
* An instance of `DocumentSelectionState`, this is some state that is responsible for
393-
* maintaining selection information for a document.
394-
*
395-
* Some functionality that can be performed with this instance is:
396-
*
397-
* - `blur()`
398-
* - `focus()`
399-
* - `update()`
400-
*
401-
* > You can reference `DocumentSelectionState` in
402-
* > [`vendor/document/selection/DocumentSelectionState.js`](https://github.com/facebook/react-native/blob/master/Libraries/vendor/document/selection/DocumentSelectionState.js)
403-
*
404-
* @platform ios
405-
*/
406-
selectionState: (PropTypes.instanceOf(DocumentSelectionState): void),
407390
/**
408391
* The start and end of the text input's selection. Set start and end to
409392
* the same value to position the cursor.

Libraries/vendor/document/selection/DocumentSelectionState.js

-150
This file was deleted.

0 commit comments

Comments
 (0)