|
4 | 4 | * This source code is licensed under the MIT license found in the
|
5 | 5 | * LICENSE file in the root directory of this source tree.
|
6 | 6 | *
|
7 |
| - * @flow |
| 7 | + * @flow strict-local |
8 | 8 | * @format
|
9 | 9 | */
|
10 | 10 |
|
11 |
| -'use strict'; |
12 |
| - |
13 | 11 | const DeprecatedTextInputPropTypes = require('../../DeprecatedPropTypes/DeprecatedTextInputPropTypes');
|
14 | 12 | const Platform = require('../../Utilities/Platform');
|
15 | 13 | const React = require('react');
|
@@ -869,13 +867,14 @@ function InternalTextInput(props: Props): React.Node {
|
869 | 867 | selection = null;
|
870 | 868 | }
|
871 | 869 |
|
872 |
| - let viewCommands: TextInputNativeCommands<HostComponent<any>>; |
| 870 | + let viewCommands; |
873 | 871 | if (AndroidTextInputCommands) {
|
874 | 872 | viewCommands = AndroidTextInputCommands;
|
875 | 873 | } else {
|
876 |
| - viewCommands = props.multiline |
877 |
| - ? RCTMultilineTextInputNativeCommands |
878 |
| - : RCTSinglelineTextInputNativeCommands; |
| 874 | + viewCommands = |
| 875 | + props.multiline === true |
| 876 | + ? RCTMultilineTextInputNativeCommands |
| 877 | + : RCTSinglelineTextInputNativeCommands; |
879 | 878 | }
|
880 | 879 |
|
881 | 880 | const text =
|
@@ -1089,13 +1088,15 @@ function InternalTextInput(props: Props): React.Node {
|
1089 | 1088 | const {onBlur, onFocus, ...eventHandlers} = usePressability(config) || {};
|
1090 | 1089 |
|
1091 | 1090 | if (Platform.OS === 'ios') {
|
1092 |
| - const RCTTextInputView = props.multiline |
1093 |
| - ? RCTMultilineTextInputView |
1094 |
| - : RCTSinglelineTextInputView; |
| 1091 | + const RCTTextInputView = |
| 1092 | + props.multiline === true |
| 1093 | + ? RCTMultilineTextInputView |
| 1094 | + : RCTSinglelineTextInputView; |
1095 | 1095 |
|
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; |
1099 | 1100 |
|
1100 | 1101 | textInput = (
|
1101 | 1102 | <RCTTextInputView
|
@@ -1125,7 +1126,7 @@ function InternalTextInput(props: Props): React.Node {
|
1125 | 1126 | let children = props.children;
|
1126 | 1127 | const childCount = React.Children.count(children);
|
1127 | 1128 | invariant(
|
1128 |
| - !(props.value && childCount), |
| 1129 | + !(props.value != null && childCount), |
1129 | 1130 | 'Cannot specify both value and children.',
|
1130 | 1131 | );
|
1131 | 1132 | if (childCount > 1) {
|
@@ -1222,6 +1223,7 @@ const styles = StyleSheet.create({
|
1222 | 1223 | },
|
1223 | 1224 | });
|
1224 | 1225 |
|
| 1226 | +// $FlowFixMe[unclear-type] Unclear type. Using `any` type is not safe. |
1225 | 1227 | module.exports = ((ExportedForwardRef: any): React.AbstractComponent<
|
1226 | 1228 | React.ElementConfig<typeof InternalTextInput>,
|
1227 | 1229 | $ReadOnly<{|
|
|
0 commit comments