Use flow strict-local

Summary:
Changelog:
[General][Changed] TextInput: use flow strict-local

Reviewed By: kacieb

Differential Revision: D26573763

fbshipit-source-id: 9d7d48310dd41949d07ad7616c4713b521c2545d
This commit is contained in:
Nadiia D
2021-02-22 18:30:01 -08:00
committed by Facebook GitHub Bot
parent 174372c178
commit 7b09eb54e7
+16 -14
View File
@@ -4,12 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/
'use strict';
const DeprecatedTextInputPropTypes = require('../../DeprecatedPropTypes/DeprecatedTextInputPropTypes');
const Platform = require('../../Utilities/Platform');
const React = require('react');
@@ -869,13 +867,14 @@ function InternalTextInput(props: Props): React.Node {
selection = null;
}
let viewCommands: TextInputNativeCommands<HostComponent<any>>;
let viewCommands;
if (AndroidTextInputCommands) {
viewCommands = AndroidTextInputCommands;
} else {
viewCommands = props.multiline
? RCTMultilineTextInputNativeCommands
: RCTSinglelineTextInputNativeCommands;
viewCommands =
props.multiline === true
? RCTMultilineTextInputNativeCommands
: RCTSinglelineTextInputNativeCommands;
}
const text =
@@ -1089,13 +1088,15 @@ function InternalTextInput(props: Props): React.Node {
const {onBlur, onFocus, ...eventHandlers} = usePressability(config) || {};
if (Platform.OS === 'ios') {
const RCTTextInputView = props.multiline
? RCTMultilineTextInputView
: RCTSinglelineTextInputView;
const RCTTextInputView =
props.multiline === true
? RCTMultilineTextInputView
: RCTSinglelineTextInputView;
const style = props.multiline
? [styles.multilineInput, props.style]
: props.style;
const style =
props.multiline === true
? [styles.multilineInput, props.style]
: props.style;
textInput = (
<RCTTextInputView
@@ -1125,7 +1126,7 @@ function InternalTextInput(props: Props): React.Node {
let children = props.children;
const childCount = React.Children.count(children);
invariant(
!(props.value && childCount),
!(props.value != null && childCount),
'Cannot specify both value and children.',
);
if (childCount > 1) {
@@ -1222,6 +1223,7 @@ const styles = StyleSheet.create({
},
});
// $FlowFixMe[unclear-type] Unclear type. Using `any` type is not safe.
module.exports = ((ExportedForwardRef: any): React.AbstractComponent<
React.ElementConfig<typeof InternalTextInput>,
$ReadOnly<{|