Skip to content

Commit 7b09eb5

Browse files
Nadiia Dfacebook-github-bot
authored andcommitted
Use flow strict-local
Summary: Changelog: [General][Changed] TextInput: use flow strict-local Reviewed By: kacieb Differential Revision: D26573763 fbshipit-source-id: 9d7d48310dd41949d07ad7616c4713b521c2545d
1 parent 174372c commit 7b09eb5

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

Libraries/Components/TextInput/TextInput.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @flow
7+
* @flow strict-local
88
* @format
99
*/
1010

11-
'use strict';
12-
1311
const DeprecatedTextInputPropTypes = require('../../DeprecatedPropTypes/DeprecatedTextInputPropTypes');
1412
const Platform = require('../../Utilities/Platform');
1513
const React = require('react');
@@ -869,13 +867,14 @@ function InternalTextInput(props: Props): React.Node {
869867
selection = null;
870868
}
871869

872-
let viewCommands: TextInputNativeCommands<HostComponent<any>>;
870+
let viewCommands;
873871
if (AndroidTextInputCommands) {
874872
viewCommands = AndroidTextInputCommands;
875873
} else {
876-
viewCommands = props.multiline
877-
? RCTMultilineTextInputNativeCommands
878-
: RCTSinglelineTextInputNativeCommands;
874+
viewCommands =
875+
props.multiline === true
876+
? RCTMultilineTextInputNativeCommands
877+
: RCTSinglelineTextInputNativeCommands;
879878
}
880879

881880
const text =
@@ -1089,13 +1088,15 @@ function InternalTextInput(props: Props): React.Node {
10891088
const {onBlur, onFocus, ...eventHandlers} = usePressability(config) || {};
10901089

10911090
if (Platform.OS === 'ios') {
1092-
const RCTTextInputView = props.multiline
1093-
? RCTMultilineTextInputView
1094-
: RCTSinglelineTextInputView;
1091+
const RCTTextInputView =
1092+
props.multiline === true
1093+
? RCTMultilineTextInputView
1094+
: RCTSinglelineTextInputView;
10951095

1096-
const style = props.multiline
1097-
? [styles.multilineInput, props.style]
1098-
: props.style;
1096+
const style =
1097+
props.multiline === true
1098+
? [styles.multilineInput, props.style]
1099+
: props.style;
10991100

11001101
textInput = (
11011102
<RCTTextInputView
@@ -1125,7 +1126,7 @@ function InternalTextInput(props: Props): React.Node {
11251126
let children = props.children;
11261127
const childCount = React.Children.count(children);
11271128
invariant(
1128-
!(props.value && childCount),
1129+
!(props.value != null && childCount),
11291130
'Cannot specify both value and children.',
11301131
);
11311132
if (childCount > 1) {
@@ -1222,6 +1223,7 @@ const styles = StyleSheet.create({
12221223
},
12231224
});
12241225

1226+
// $FlowFixMe[unclear-type] Unclear type. Using `any` type is not safe.
12251227
module.exports = ((ExportedForwardRef: any): React.AbstractComponent<
12261228
React.ElementConfig<typeof InternalTextInput>,
12271229
$ReadOnly<{|

0 commit comments

Comments
 (0)