Skip to content

Commit

Permalink
Use flow strict-local
Browse files Browse the repository at this point in the history
Summary:
Changelog:
[General][Changed] TextInput: use flow strict-local

Reviewed By: kacieb

Differential Revision: D26573763

fbshipit-source-id: 9d7d48310dd41949d07ad7616c4713b521c2545d
  • Loading branch information
Nadiia D authored and facebook-github-bot committed Feb 23, 2021
1 parent 174372c commit 7b09eb5
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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<{|
Expand Down

0 comments on commit 7b09eb5

Please sign in to comment.