@office-iss/react-native-win32 0.0.0-canary.287 → 0.0.0-canary.289

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/.flowconfig +6 -2
  2. package/CHANGELOG.json +63 -1
  3. package/CHANGELOG.md +24 -4
  4. package/Libraries/Alert/Alert.d.ts +4 -1
  5. package/Libraries/Alert/Alert.js +3 -0
  6. package/Libraries/{Modal/ModalInjection.js → Alert/RCTAlertManager.js.flow} +7 -4
  7. package/Libraries/Animated/Animated.js +8 -37
  8. package/Libraries/Animated/Animated.js.flow +15 -0
  9. package/Libraries/Animated/AnimatedExports.js +47 -0
  10. package/Libraries/Animated/AnimatedExports.js.flow +48 -0
  11. package/Libraries/Animated/Easing.js +13 -15
  12. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  13. package/Libraries/Animated/nodes/AnimatedNode.js +2 -1
  14. package/Libraries/Animated/nodes/AnimatedProps.js +18 -1
  15. package/Libraries/Animated/nodes/AnimatedValue.js +6 -2
  16. package/Libraries/Animated/useAnimatedValue.js +1 -3
  17. package/Libraries/Blob/URL.js +23 -10
  18. package/Libraries/Blob/URLSearchParams.js.flow +23 -0
  19. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  20. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  21. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
  22. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
  23. package/Libraries/Components/Button.js +2 -2
  24. package/Libraries/Components/Button.win32.js +2 -2
  25. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
  26. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
  27. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
  28. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
  29. package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
  30. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
  31. package/Libraries/Components/Pressable/Pressable.js +18 -63
  32. package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
  33. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  34. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
  35. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
  36. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
  37. package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
  38. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
  39. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
  40. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
  41. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
  42. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
  43. package/Libraries/Components/ScrollView/ScrollView.js +43 -59
  44. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  45. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
  46. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
  47. package/Libraries/Components/StatusBar/StatusBar.js +33 -22
  48. package/Libraries/Components/Switch/Switch.js +70 -41
  49. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
  50. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
  51. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
  52. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  53. package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
  54. package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
  55. package/Libraries/Components/TextInput/TextInput.d.ts +6 -0
  56. package/Libraries/Components/TextInput/TextInput.flow.js +45 -14
  57. package/Libraries/Components/TextInput/TextInput.js +121 -136
  58. package/Libraries/Components/TextInput/TextInput.win32.js +122 -137
  59. package/Libraries/Components/TextInput/TextInputState.js +2 -18
  60. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
  61. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
  62. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
  63. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  64. package/Libraries/Components/Touchable/Touchable.js +7 -7
  65. package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
  66. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  67. package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
  68. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
  69. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
  70. package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
  71. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
  72. package/Libraries/Components/View/View.js +1 -1
  73. package/Libraries/Components/View/View.win32.js +1 -1
  74. package/Libraries/Components/View/ViewNativeComponent.js +2 -4
  75. package/Libraries/Components/View/ViewPropTypes.js +15 -12
  76. package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
  77. package/Libraries/Core/ReactNativeVersion.js +2 -2
  78. package/Libraries/Core/setUpReactDevTools.js +2 -0
  79. package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
  80. package/Libraries/Image/Image.android.js +1 -1
  81. package/Libraries/Image/Image.js.flow +27 -0
  82. package/Libraries/Image/ImageBackground.js +1 -1
  83. package/Libraries/Image/ImageProps.js +97 -30
  84. package/Libraries/Image/ImageTypes.flow.js +16 -6
  85. package/Libraries/Image/ImageViewNativeComponent.js +3 -5
  86. package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
  87. package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
  88. package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
  89. package/Libraries/Interaction/InteractionManager.js +9 -1
  90. package/Libraries/Interaction/PanResponder.js +11 -11
  91. package/Libraries/Interaction/TaskQueue.js +3 -2
  92. package/Libraries/Lists/FlatList.js +8 -7
  93. package/Libraries/LogBox/LogBox.js +1 -1
  94. package/Libraries/Modal/Modal.js +30 -4
  95. package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
  96. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  97. package/Libraries/Network/RCTNetworking.js.flow +44 -0
  98. package/Libraries/Network/XMLHttpRequest_new.js +3 -0
  99. package/Libraries/Network/XMLHttpRequest_old.js +3 -0
  100. package/Libraries/Pressability/HoverState.js +1 -0
  101. package/Libraries/Pressability/HoverState.win32.js +1 -0
  102. package/Libraries/Pressability/Pressability.js +2 -2
  103. package/Libraries/Pressability/Pressability.win32.js +3 -3
  104. package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
  105. package/Libraries/ReactNative/AppRegistry.js +2 -322
  106. package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
  107. package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
  108. package/Libraries/ReactNative/FabricUIManager.js +5 -3
  109. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
  110. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
  111. package/Libraries/ReactNative/RendererImplementation.js +3 -5
  112. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  113. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
  114. package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
  115. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
  116. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
  117. package/Libraries/StyleSheet/StyleSheet.js +5 -197
  118. package/Libraries/StyleSheet/StyleSheet.js.flow +166 -0
  119. package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
  120. package/Libraries/StyleSheet/StyleSheetExports.js.flow +110 -0
  121. package/Libraries/StyleSheet/StyleSheetTypes.js +42 -18
  122. package/Libraries/Text/Text.d.ts +1 -1
  123. package/Libraries/Text/Text.js +3 -1
  124. package/Libraries/Text/Text.win32.js +3 -1
  125. package/Libraries/Text/TextNativeComponent.js +1 -1
  126. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  127. package/Libraries/Text/TextProps.js +124 -84
  128. package/Libraries/Text/TextProps.win32.js +124 -84
  129. package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
  130. package/Libraries/Types/CodegenTypesNamespace.js +14 -0
  131. package/Libraries/Types/CoreEventTypes.js +1 -1
  132. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  133. package/Libraries/Types/ReactDevToolsTypes.js +4 -8
  134. package/Libraries/Utilities/BackHandler.js.flow +25 -0
  135. package/Libraries/Utilities/DevSettings.js +14 -0
  136. package/Libraries/Utilities/Dimensions.js +5 -0
  137. package/Libraries/Utilities/Dimensions.win32.js +5 -0
  138. package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
  139. package/Libraries/Utilities/PlatformTypes.js +97 -7
  140. package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
  141. package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
  142. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  143. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
  144. package/Libraries/vendor/emitter/EventEmitter.js +6 -2
  145. package/flow/global.js +1 -0
  146. package/flow/jest.js +4 -2
  147. package/index.js +47 -43
  148. package/index.win32.js +63 -59
  149. package/overrides.json +27 -35
  150. package/package.json +18 -18
  151. package/src/private/animated/NativeAnimatedHelper.js +18 -7
  152. package/src/private/animated/NativeAnimatedHelper.win32.js +18 -7
  153. package/src/private/animated/createAnimatedPropsHook.js +34 -15
  154. package/src/private/components/HScrollViewNativeComponents.js +1 -1
  155. package/src/private/components/VScrollViewNativeComponents.js +1 -1
  156. package/src/private/featureflags/ReactNativeFeatureFlags.js +24 -36
  157. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
  158. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -4
  159. package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
  160. package/src/private/setup/setUpDOM.js +36 -1
  161. package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
  162. package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
  163. package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
  164. package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
  165. package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
  166. package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
  167. package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
  168. package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
  169. package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
  170. package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
  171. package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
  172. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  173. package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
  174. package/src/private/types/HostComponent.js +16 -0
  175. package/src/private/types/HostInstance.js +50 -0
  176. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
  177. package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
  178. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
  179. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  180. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -19
  181. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
  182. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
  183. package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
  184. package/src/private/webapis/performance/PerformanceObserver.js +6 -6
  185. package/src/types/globals.d.ts +628 -0
  186. package/src/types/third_party/event-target-shim.d.ts +392 -0
  187. package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
  188. package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
  189. package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
  190. package/src-win/Libraries/Text/Text.d.ts +1 -1
  191. package/types/index.d.ts +5 -52
  192. package/types/modules/globals.d.ts +0 -599
@@ -1 +1 @@
1
- {"version":3,"file":"TextInputTest.js","sourceRoot":"","sources":["../../../../src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,kDAAyB;AACzB,+CAAiE;AAEjE,8EAA8E;AAE9E,MAAM,yBAAyB,GAAiB,GAAG,EAAE;IACnD,OAAO,CACL,8BAAC,mBAAI;QACH,8BAAC,mBAAI,sCAAmC;QACxC,8BAAC,wBAAS,IACR,SAAS,QACT,SAAS,EAAE,GAAG,EACd,SAAS,QACT,KAAK,EAAE,MAAM,CAAC,KAAK,GACnB,CACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAiB,GAAG,EAAE;IAClD,OAAO,CACL,8BAAC,mBAAI;QACH,8BAAC,mBAAI,mDAAgD;QACrD,8BAAC,wBAAS,IACR,SAAS,EAAE,GAAG,EACd,SAAS,QACT,WAAW,EAAC,2DAA2D,EACvE,oBAAoB,EAAC,MAAM,EAC3B,KAAK,EAAE,MAAM,CAAC,KAAK,GACnB,CACG,CACR,CAAC;AACJ,CAAC,CA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AAW,EAAE,8BAA8B;QAC3C,MAAM;YACJ,OAAO,CAAC,8BAAC,wBAAwB,OAAG,CAAC,CAAC;QACxC,CAAC;KACF;IACD;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,0BAA0B;QACvC,MAAM;YACJ,OAAO,CAAC,8BAAC,gCAAgC,OAAG,CAAC,CAAC;QAChD,CAAC;KACF;IACD;QACE,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,+BAA+B;QAC5C,MAAM;YACJ,OAAO,CAAC,8BAAC,4BAA4B,OAAG,CAAC,CAAC;QAC5C,CAAC;KACF;IACD;QACE,KAAK,EAAE,gCAAgC;QACvC,WAAW,EAAE,sBAAsB;QACnC,MAAM;YACJ,OAAO,CAAC,8BAAC,8BAA8B,OAAG,CAAC,CAAC;QAC9C,CAAC;KACF;IACD;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE,mBAAmB;QAChC,MAAM;YACJ,OAAO,CAAC,8BAAC,kBAAkB,OAAG,CAAC,CAAC;QAClC,CAAC;KACF;CACF,CAAC;AAEJ,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE;QACL,MAAM,EAAE,EAAE;KACX;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,EAAE;KACX;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,EAAE;KACX;IACD,UAAU,EAAE;QACV,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,iBAAiB;QAC7B,MAAM,EAAE,GAAG;KACZ;CACF,CAAC,CAAC","sourcesContent":["'use strict';\nimport React from 'react'\nimport { StyleSheet, Text, TextInput, View } from 'react-native';\n\n// Disabling no-jsx-lambda so functional components are more convenient to use\n\nconst AutoFocusingTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput auto focuses</Text>\n <TextInput\n autoFocus\n maxLength={140}\n multiline\n style={styles.input}\n />\n </View>\n );\n};\n\nconst PlaceholderTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput demonstrates placeholders</Text>\n <TextInput\n maxLength={140}\n multiline\n placeholder=\"I am a blue placeholder, type in me for something magical\"\n placeholderTextColor=\"blue\"\n style={styles.green}\n />\n </View>\n );\n};\n\nconst ControllingTextInputTest: React.FC<{}> = () => {\n const [value, setValue] = React.useState('');\n\n return (\n <View>\n <Text>This TextInput inserts spaces between characters</Text>\n <TextInput\n multiline\n onChangeText={(text) => setValue(text.endsWith(' ') ? value : (text + ' '))}\n style={styles.blue}\n value={value}\n />\n </View>\n );\n};\n\nconst BlurringAndFocusingTextInputTest: React.FC<{}> = () => {\n const [isFocused, setIsFocused] = React.useState(false);\n return (\n <View>\n <Text>This TextInput is currently focused: + {isFocused ? 'true' : 'false'}</Text>\n <TextInput\n multiline\n onBlur={() => setIsFocused(false)}\n onFocus={() => setIsFocused(true)}\n style={styles.input}\n />\n </View>\n );\n};\n\nconst LayoutListeningTextInputTest: React.FC<{}> = () => {\n const [eventCounter, setEventCounter] = React.useState(0);\n\n return (\n <View>\n <Text>The number of onContentSizeChanges is listed here + {eventCounter}</Text>\n <TextInput\n multiline\n onContentSizeChange={() => setEventCounter(eventCounter + 1)}\n style={styles.input}\n />\n </View>\n );\n};\n\nconst KeyPressListeningTextInputTest: React.FC<{}> = () => {\n const [value, setValue] = React.useState('');\n\n return (\n <View>\n <Text>This TextInput uses onKeyPress to maintain state: it is slow</Text>\n <TextInput\n multiline\n onKeyPress={(e) => setValue(value + e.nativeEvent.key)}\n style={styles.input}\n value={value}\n />\n </View>\n );\n};\n\nconst StyleTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput is styled differently</Text>\n <TextInput\n multiline\n style={styles.superInput}\n />\n </View>\n );\n};\n\nexport const title = 'TextInput';\nexport const displayName = 'TextInput';\nexport const description = 'TextInput Examples and Tests';\nexport const examples = [\n {\n title: 'Autofocus Example',\n description: 'autoFocus in action',\n render(): JSX.Element {\n return (<AutoFocusingTextInputTest />);\n },\n },\n {\n title: 'Placeholders Example',\n description: 'placeholder in action',\n render(): JSX.Element {\n return (<PlaceholderTextInputTest />);\n },\n },\n {\n title: 'Controlled Example',\n description: 'Controlling inputs in action',\n render(): JSX.Element {\n return (<ControllingTextInputTest />);\n },\n },\n {\n title: 'Focus and Blur Example',\n description: 'onFocus/onBlur in action',\n render(): JSX.Element {\n return (<BlurringAndFocusingTextInputTest />);\n },\n },\n {\n title: 'ContentSizeChange Example',\n description: 'onContentSizeChange in action',\n render(): JSX.Element {\n return (<LayoutListeningTextInputTest />);\n },\n },\n {\n title: 'Control via onKeyPress Example',\n description: 'onKeyPress in action',\n render(): JSX.Element {\n return (<KeyPressListeningTextInputTest />);\n },\n },\n {\n title: 'Super Styling Example',\n description: 'Styling in action',\n render(): JSX.Element {\n return (<StyleTextInputTest />);\n },\n },\n ];\n\nconst styles = StyleSheet.create({\n input: {\n height: 20,\n },\n blue: {\n color: 'blue',\n height: 20,\n },\n green: {\n color: 'green',\n height: 20,\n },\n superInput: {\n color: 'purple',\n fontSize: 24,\n fontStyle: 'italic',\n fontWeight: 'bold',\n fontFamily: 'times-new-roman',\n height: 100,\n },\n});\n"]}
1
+ {"version":3,"file":"TextInputTest.js","sourceRoot":"","sources":["../../../../src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,kDAAyB;AACzB,+CAAiE;AAEjE,8EAA8E;AAE9E,MAAM,yBAAyB,GAAiB,GAAG,EAAE;IACnD,OAAO,CACL,8BAAC,mBAAI;QACH,8BAAC,mBAAI,sCAAmC;QACxC,8BAAC,wBAAS,IACR,SAAS,QACT,SAAS,EAAE,GAAG,EACd,SAAS,QACT,KAAK,EAAE,MAAM,CAAC,KAAK,GACnB,CACG,CACR,CAAC;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AQ;QACf,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,iBAAiB;QAC7B,MAAM,EAAE,GAAG;KACZ;CACF,CAAC,CAAC","sourcesContent":["'use strict';\nimport React from 'react'\nimport { StyleSheet, Text, TextInput, View } from 'react-native';\n\n// Disabling no-jsx-lambda so functional components are more convenient to use\n\nconst AutoFocusingTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput auto focuses</Text>\n <TextInput\n autoFocus\n maxLength={140}\n multiline\n style={styles.input}\n />\n </View>\n );\n};\n\nconst PlaceholderTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput demonstrates placeholders</Text>\n <TextInput\n maxLength={140}\n multiline\n placeholder=\"I am a blue placeholder, type in me for something magical\"\n placeholderTextColor=\"blue\"\n style={styles.green}\n />\n </View>\n );\n};\n\nconst ControllingTextInputTest: React.FC<{}> = () => {\n const [value, setValue] = React.useState('');\n\n return (\n <View>\n <Text>This TextInput inserts spaces between characters</Text>\n <TextInput\n multiline\n onChangeText={(text) => setValue(text.endsWith(' ') ? value : (text + ' '))}\n style={styles.blue}\n value={value}\n />\n </View>\n );\n};\n\nconst BlurringAndFocusingTextInputTest: React.FC<{}> = () => {\n const [isFocused, setIsFocused] = React.useState(false);\n return (\n <View>\n <Text>This TextInput is currently focused: + {isFocused ? 'true' : 'false'}</Text>\n <TextInput\n multiline\n onBlur={() => setIsFocused(false)}\n onFocus={() => setIsFocused(true)}\n style={styles.input}\n />\n </View>\n );\n};\n\nconst LayoutListeningTextInputTest: React.FC<{}> = () => {\n const [eventCounter, setEventCounter] = React.useState(0);\n\n return (\n <View>\n <Text>The number of onContentSizeChanges is listed here + {eventCounter}</Text>\n <TextInput\n multiline\n onContentSizeChange={() => setEventCounter(eventCounter + 1)}\n style={styles.input}\n />\n </View>\n );\n};\n\nconst KeyPressListeningTextInputTest: React.FC<{}> = () => {\n const [value, setValue] = React.useState('');\n\n return (\n <View>\n <Text>This TextInput uses onKeyPress to maintain state: it is slow</Text>\n <TextInput\n multiline\n onKeyPress={(e) => setValue(value + e.nativeEvent.key)}\n style={styles.input}\n value={value}\n />\n </View>\n );\n};\n\nconst StyleTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput is styled differently</Text>\n <TextInput\n multiline\n style={styles.superInput}\n />\n </View>\n );\n};\n\nexport const title = 'TextInput';\nexport const displayName = 'TextInput';\nexport const description = 'TextInput Examples and Tests';\nexport const examples = [\n {\n title: 'Autofocus Example',\n description: 'autoFocus in action',\n render() {\n return (<AutoFocusingTextInputTest />);\n },\n },\n {\n title: 'Placeholders Example',\n description: 'placeholder in action',\n render() {\n return (<PlaceholderTextInputTest />);\n },\n },\n {\n title: 'Controlled Example',\n description: 'Controlling inputs in action',\n render() {\n return (<ControllingTextInputTest />);\n },\n },\n {\n title: 'Focus and Blur Example',\n description: 'onFocus/onBlur in action',\n render() {\n return (<BlurringAndFocusingTextInputTest />);\n },\n },\n {\n title: 'ContentSizeChange Example',\n description: 'onContentSizeChange in action',\n render() {\n return (<LayoutListeningTextInputTest />);\n },\n },\n {\n title: 'Control via onKeyPress Example',\n description: 'onKeyPress in action',\n render() {\n return (<KeyPressListeningTextInputTest />);\n },\n },\n {\n title: 'Super Styling Example',\n description: 'Styling in action',\n render() {\n return (<StyleTextInputTest />);\n },\n },\n ];\n\nconst styles = StyleSheet.create({\n input: {\n height: 20,\n },\n blue: {\n color: 'blue',\n height: 20,\n },\n green: {\n color: 'green',\n height: 20,\n },\n superInput: {\n color: 'purple',\n fontSize: 24,\n fontStyle: 'italic',\n fontWeight: 'bold',\n fontFamily: 'times-new-roman',\n height: 100,\n },\n});\n"]}
@@ -930,6 +930,12 @@ export interface TextInputProps
930
930
  */
931
931
  inputAccessoryViewID?: string | undefined;
932
932
 
933
+ /**
934
+ * An optional label that overrides the default input accessory view button label.
935
+ * @platform ios
936
+ */
937
+ inputAccessoryViewButtonLabel?: string | undefined;
938
+
933
939
  /**
934
940
  * The value to show for the text input. TextInput is a controlled component,
935
941
  * which means the native value will be forced to match this value prop if provided.
@@ -8,11 +8,11 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
11
+ import type {HostInstance} from '../../../src/private/types/HostInstance';
12
12
  import type {
13
13
  GestureResponderEvent,
14
- ScrollEvent,
15
14
  NativeSyntheticEvent,
15
+ ScrollEvent,
16
16
  } from '../../Types/CoreEventTypes';
17
17
  import type {ViewProps} from '../View/ViewPropTypes';
18
18
 
@@ -23,8 +23,6 @@ import {
23
23
  } from '../../StyleSheet/StyleSheet';
24
24
  import * as React from 'react';
25
25
 
26
- type ReactRefSetter<T> = {current: null | T, ...} | ((ref: null | T) => mixed);
27
-
28
26
  export type TextInputChangeEventData = $ReadOnly<{
29
27
  eventCount: number,
30
28
  target: number,
@@ -90,12 +88,30 @@ export type TextInputKeyPressEventData = $ReadOnly<{
90
88
  export type TextInputKeyPressEvent =
91
89
  NativeSyntheticEvent<TextInputKeyPressEventData>;
92
90
 
91
+ /**
92
+ * @see TextInputProps.onEndEditing
93
+ */
93
94
  export type TextInputEndEditingEventData = $ReadOnly<{
94
95
  ...TargetEvent,
95
96
  eventCount: number,
96
97
  text: string,
97
98
  }>;
98
99
 
100
+ export type TextInputEndEditingEvent =
101
+ NativeSyntheticEvent<TextInputEndEditingEventData>;
102
+
103
+ /**
104
+ * @see TextInputProps.onSubmitEditing
105
+ */
106
+ export type TextInputSubmitEditingEventData = $ReadOnly<{
107
+ ...TargetEvent,
108
+ eventCount: number,
109
+ text: string,
110
+ }>;
111
+
112
+ export type TextInputSubmitEditingEvent =
113
+ NativeSyntheticEvent<TextInputSubmitEditingEventData>;
114
+
99
115
  export type TextInputEditingEvent =
100
116
  NativeSyntheticEvent<TextInputEndEditingEventData>;
101
117
 
@@ -391,6 +407,21 @@ export type TextInputAndroidProps = $ReadOnly<{
391
407
  */
392
408
  disableFullscreenUI?: ?boolean,
393
409
 
410
+ /**
411
+ * Determines whether the individual fields in your app should be included in a
412
+ * view structure for autofill purposes on Android API Level 26+. Defaults to auto.
413
+ * To disable auto complete, use `off`.
414
+ *
415
+ * *Android Only*
416
+ *
417
+ * The following values work on Android only:
418
+ *
419
+ * - `auto` - let Android decide
420
+ * - `no` - not important for autofill
421
+ * - `noExcludeDescendants` - this view and its children aren't important for autofill
422
+ * - `yes` - is important for autofill
423
+ * - `yesExcludeDescendants` - this view is important for autofill but its children aren't
424
+ */
394
425
  importantForAutofill?: ?(
395
426
  | 'auto'
396
427
  | 'no'
@@ -649,7 +680,7 @@ export type TextInputProps = $ReadOnly<{
649
680
  */
650
681
  editable?: ?boolean,
651
682
 
652
- forwardedRef?: ?ReactRefSetter<HostInstance & ImperativeMethods>,
683
+ forwardedRef?: ?React.RefSetter<TextInputInstance>,
653
684
 
654
685
  /**
655
686
  * `enterKeyHint` defines what action label (or icon) to present for the enter key on virtual keyboards.
@@ -785,7 +816,7 @@ export type TextInputProps = $ReadOnly<{
785
816
  /**
786
817
  * Callback that is called when text input ends.
787
818
  */
788
- onEndEditing?: ?(e: TextInputEditingEvent) => mixed,
819
+ onEndEditing?: ?(e: TextInputEndEditingEvent) => mixed,
789
820
 
790
821
  /**
791
822
  * Callback that is called when the text input is focused.
@@ -842,7 +873,7 @@ export type TextInputProps = $ReadOnly<{
842
873
  * Callback that is called when the text input's submit button is pressed.
843
874
  * Invalid if `multiline={true}` is specified.
844
875
  */
845
- onSubmitEditing?: ?(e: TextInputEditingEvent) => mixed,
876
+ onSubmitEditing?: ?(e: TextInputSubmitEditingEvent) => mixed,
846
877
 
847
878
  /**
848
879
  * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
@@ -992,12 +1023,12 @@ export type TextInputProps = $ReadOnly<{
992
1023
  value?: ?Stringish,
993
1024
  }>;
994
1025
 
995
- type ImperativeMethods = $ReadOnly<{
996
- clear: () => void,
997
- isFocused: () => boolean,
998
- getNativeRef: () => ?HostInstance,
999
- setSelection: (start: number, end: number) => void,
1000
- }>;
1026
+ export interface TextInputInstance extends HostInstance {
1027
+ +clear: () => void;
1028
+ +isFocused: () => boolean;
1029
+ +getNativeRef: () => ?HostInstance;
1030
+ +setSelection: (start: number, end: number) => void;
1031
+ }
1001
1032
 
1002
1033
  /**
1003
1034
  * A foundational component for inputting text into the app via a
@@ -1111,7 +1142,7 @@ type ImperativeMethods = $ReadOnly<{
1111
1142
  *
1112
1143
  */
1113
1144
  type InternalTextInput = component(
1114
- ref: React.RefSetter<$ReadOnly<{...HostInstance, ...ImperativeMethods}>>,
1145
+ ref?: React.RefSetter<TextInputInstance>,
1115
1146
  ...TextInputProps
1116
1147
  );
1117
1148
 
@@ -8,17 +8,16 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
11
+ import type {HostInstance} from '../../../src/private/types/HostInstance';
12
12
  import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes';
13
13
  import type {
14
14
  GestureResponderEvent,
15
- ScrollEvent,
16
15
  NativeSyntheticEvent,
16
+ ScrollEvent,
17
17
  } from '../../Types/CoreEventTypes';
18
18
  import type {ViewProps} from '../View/ViewPropTypes';
19
- import type {TextInputType} from './TextInput.flow';
19
+ import type {TextInputInstance, TextInputType} from './TextInput.flow';
20
20
 
21
- import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
22
21
  import usePressability from '../../Pressability/usePressability';
23
22
  import flattenStyle from '../../StyleSheet/flattenStyle';
24
23
  import StyleSheet, {
@@ -36,14 +35,6 @@ import nullthrows from 'nullthrows';
36
35
  import * as React from 'react';
37
36
  import {useCallback, useLayoutEffect, useRef, useState} from 'react';
38
37
 
39
- type ReactRefSetter<T> = {current: null | T, ...} | ((ref: null | T) => mixed);
40
- type TextInputInstance = HostInstance & {
41
- +clear: () => void,
42
- +isFocused: () => boolean,
43
- +getNativeRef: () => ?HostInstance,
44
- +setSelection: (start: number, end: number) => void,
45
- };
46
-
47
38
  let AndroidTextInput;
48
39
  let AndroidTextInputCommands;
49
40
  let RCTSinglelineTextInputView;
@@ -66,6 +57,9 @@ if (Platform.OS === 'android') {
66
57
  require('./RCTMultilineTextInputNativeComponent').Commands;
67
58
  }
68
59
 
60
+ /**
61
+ * @see TextInputProps.onChange
62
+ */
69
63
  export type TextInputChangeEventData = $ReadOnly<{
70
64
  eventCount: number,
71
65
  target: number,
@@ -88,6 +82,9 @@ export type TextInputEvent = NativeSyntheticEvent<
88
82
  }>,
89
83
  >;
90
84
 
85
+ /**
86
+ * @see TextInputProps.onContentSizeChange
87
+ */
91
88
  export type TextInputContentSizeChangeEventData = $ReadOnly<{
92
89
  target: number,
93
90
  contentSize: $ReadOnly<{
@@ -103,16 +100,29 @@ export type TargetEvent = $ReadOnly<{
103
100
  target: number,
104
101
  }>;
105
102
 
103
+ /**
104
+ * @see TextInputProps.onFocus
105
+ */
106
106
  export type TextInputFocusEventData = TargetEvent;
107
107
 
108
108
  export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
109
109
  export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
110
110
 
111
+ /**
112
+ * @see TextInputProps.onScroll
113
+ */
114
+ export type TextInputScrollEventData = {
115
+ contentOffset: {x: number, y: number},
116
+ };
117
+
111
118
  type Selection = $ReadOnly<{
112
119
  start: number,
113
120
  end: number,
114
121
  }>;
115
122
 
123
+ /**
124
+ * @see TextInputProps.onSelectionChange
125
+ */
116
126
  export type TextInputSelectionChangeEventData = $ReadOnly<{
117
127
  ...TargetEvent,
118
128
  selection: Selection,
@@ -121,7 +131,10 @@ export type TextInputSelectionChangeEventData = $ReadOnly<{
121
131
  export type TextInputSelectionChangeEvent =
122
132
  NativeSyntheticEvent<TextInputSelectionChangeEventData>;
123
133
 
124
- type TextInputKeyPressEventData = $ReadOnly<{
134
+ /**
135
+ * @see TextInputProps.onKeyPress
136
+ */
137
+ export type TextInputKeyPressEventData = $ReadOnly<{
125
138
  ...TargetEvent,
126
139
  key: string,
127
140
  target?: ?number,
@@ -131,12 +144,30 @@ type TextInputKeyPressEventData = $ReadOnly<{
131
144
  export type TextInputKeyPressEvent =
132
145
  NativeSyntheticEvent<TextInputKeyPressEventData>;
133
146
 
147
+ /**
148
+ * @see TextInputProps.onEndEditing
149
+ */
134
150
  export type TextInputEndEditingEventData = $ReadOnly<{
135
151
  ...TargetEvent,
136
152
  eventCount: number,
137
153
  text: string,
138
154
  }>;
139
155
 
156
+ export type TextInputEndEditingEvent =
157
+ NativeSyntheticEvent<TextInputEndEditingEventData>;
158
+
159
+ /**
160
+ * @see TextInputProps.onSubmitEditing
161
+ */
162
+ export type TextInputSubmitEditingEventData = $ReadOnly<{
163
+ ...TargetEvent,
164
+ eventCount: number,
165
+ text: string,
166
+ }>;
167
+
168
+ export type TextInputSubmitEditingEvent =
169
+ NativeSyntheticEvent<TextInputSubmitEditingEventData>;
170
+
140
171
  export type TextInputEditingEvent =
141
172
  NativeSyntheticEvent<TextInputEndEditingEventData>;
142
173
 
@@ -427,6 +458,21 @@ export type TextInputAndroidProps = $ReadOnly<{
427
458
  */
428
459
  disableFullscreenUI?: ?boolean,
429
460
 
461
+ /**
462
+ * Determines whether the individual fields in your app should be included in a
463
+ * view structure for autofill purposes on Android API Level 26+. Defaults to auto.
464
+ * To disable auto complete, use `off`.
465
+ *
466
+ * *Android Only*
467
+ *
468
+ * The following values work on Android only:
469
+ *
470
+ * - `auto` - let Android decide
471
+ * - `no` - not important for autofill
472
+ * - `noExcludeDescendants` - this view and its children aren't important for autofill
473
+ * - `yes` - is important for autofill
474
+ * - `yesExcludeDescendants` - this view is important for autofill but its children aren't
475
+ */
430
476
  importantForAutofill?: ?(
431
477
  | 'auto'
432
478
  | 'no'
@@ -494,11 +540,7 @@ export type TextInputAndroidProps = $ReadOnly<{
494
540
  underlineColorAndroid?: ?ColorValue,
495
541
  }>;
496
542
 
497
- export type TextInputProps = $ReadOnly<{
498
- ...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
499
- ...TextInputIOSProps,
500
- ...TextInputAndroidProps,
501
-
543
+ type TextInputBaseProps = $ReadOnly<{
502
544
  /**
503
545
  * Can tell `TextInput` to automatically capitalize certain characters.
504
546
  *
@@ -685,7 +727,7 @@ export type TextInputProps = $ReadOnly<{
685
727
  */
686
728
  editable?: ?boolean,
687
729
 
688
- forwardedRef?: ?ReactRefSetter<TextInputInstance>,
730
+ forwardedRef?: ?React.RefSetter<TextInputInstance>,
689
731
 
690
732
  /**
691
733
  * `enterKeyHint` defines what action label (or icon) to present for the enter key on virtual keyboards.
@@ -800,7 +842,7 @@ export type TextInputProps = $ReadOnly<{
800
842
  /**
801
843
  * Callback that is called when text input ends.
802
844
  */
803
- onEndEditing?: ?(e: TextInputEditingEvent) => mixed,
845
+ onEndEditing?: ?(e: TextInputEndEditingEvent) => mixed,
804
846
 
805
847
  /**
806
848
  * Callback that is called when the text input is focused.
@@ -842,7 +884,7 @@ export type TextInputProps = $ReadOnly<{
842
884
  * Callback that is called when the text input's submit button is pressed.
843
885
  * Invalid if `multiline={true}` is specified.
844
886
  */
845
- onSubmitEditing?: ?(e: TextInputEditingEvent) => mixed,
887
+ onSubmitEditing?: ?(e: TextInputSubmitEditingEvent) => mixed,
846
888
 
847
889
  /**
848
890
  * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
@@ -923,7 +965,9 @@ export type TextInputProps = $ReadOnly<{
923
965
  selectionColor?: ?ColorValue,
924
966
 
925
967
  /**
926
- * The text selection handle color.
968
+ * When provided it will set the color of the selection handles when highlighting text.
969
+ * Unlike the behavior of `selectionColor` the handle color will be set independently
970
+ * from the color of the text selection box.
927
971
  * @platform android
928
972
  */
929
973
  selectionHandleColor?: ?ColorValue,
@@ -998,6 +1042,42 @@ export type TextInputProps = $ReadOnly<{
998
1042
  value?: ?Stringish,
999
1043
  }>;
1000
1044
 
1045
+ export type TextInputProps = $ReadOnly<{
1046
+ ...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
1047
+ ...TextInputIOSProps,
1048
+ ...TextInputAndroidProps,
1049
+ ...TextInputBaseProps,
1050
+ }>;
1051
+
1052
+ type TextInputStateType = $ReadOnly<{
1053
+ /**
1054
+ * @deprecated Use currentlyFocusedInput
1055
+ * Returns the ID of the currently focused text field, if one exists
1056
+ * If no text field is focused it returns null
1057
+ */
1058
+ currentlyFocusedField: () => ?number,
1059
+
1060
+ /**
1061
+ * Returns the ref of the currently focused text field, if one exists
1062
+ * If no text field is focused it returns null
1063
+ */
1064
+ currentlyFocusedInput: () => ?HostInstance,
1065
+
1066
+ /**
1067
+ * @param textField ref of the text field to focus
1068
+ * Focuses the specified text field
1069
+ * noop if the text field was already focused
1070
+ */
1071
+ focusTextInput: (textField: ?HostInstance) => void,
1072
+
1073
+ /**
1074
+ * @param textField ref of the text field to focus
1075
+ * Unfocuses the specified text field
1076
+ * noop if it wasn't focused
1077
+ */
1078
+ blurTextInput: (textField: ?HostInstance) => void,
1079
+ }>;
1080
+
1001
1081
  type ViewCommands = $NonMaybeType<
1002
1082
  | typeof AndroidTextInputCommands
1003
1083
  | typeof RCTMultilineTextInputNativeCommands
@@ -1016,7 +1096,7 @@ const emptyFunctionThatReturnsTrue = () => true;
1016
1096
  * in native and in JavaScript. This is necessary due to the asynchronous nature
1017
1097
  * of text input events.
1018
1098
  */
1019
- function useTextInputStateSynchronization_STATE({
1099
+ function useTextInputStateSynchronization({
1020
1100
  props,
1021
1101
  mostRecentEventCount,
1022
1102
  selection,
@@ -1027,8 +1107,8 @@ function useTextInputStateSynchronization_STATE({
1027
1107
  props: TextInputProps,
1028
1108
  mostRecentEventCount: number,
1029
1109
  selection: ?Selection,
1030
- inputRef: React.RefObject<null | HostInstance>,
1031
- text: string,
1110
+ inputRef: React.RefObject<null | TextInputInstance>,
1111
+ text?: string,
1032
1112
  viewCommands: ViewCommands,
1033
1113
  }): {
1034
1114
  setLastNativeText: string => void,
@@ -1092,94 +1172,6 @@ function useTextInputStateSynchronization_STATE({
1092
1172
  return {setLastNativeText, setLastNativeSelection};
1093
1173
  }
1094
1174
 
1095
- /**
1096
- * This hook handles the synchronization between the state of the text input
1097
- * in native and in JavaScript. This is necessary due to the asynchronous nature
1098
- * of text input events.
1099
- */
1100
- function useTextInputStateSynchronization_REFS({
1101
- props,
1102
- mostRecentEventCount,
1103
- selection,
1104
- inputRef,
1105
- text,
1106
- viewCommands,
1107
- }: {
1108
- props: TextInputProps,
1109
- mostRecentEventCount: number,
1110
- selection: ?Selection,
1111
- inputRef: React.RefObject<null | HostInstance>,
1112
- text: string,
1113
- viewCommands: ViewCommands,
1114
- }): {
1115
- setLastNativeText: string => void,
1116
- setLastNativeSelection: LastNativeSelection => void,
1117
- } {
1118
- const lastNativeTextRef = useRef<?Stringish>(props.value);
1119
- const lastNativeSelectionRef = useRef<LastNativeSelection>({
1120
- selection: {start: -1, end: -1},
1121
- mostRecentEventCount: mostRecentEventCount,
1122
- });
1123
-
1124
- // This is necessary in case native updates the text and JS decides
1125
- // that the update should be ignored and we should stick with the value
1126
- // that we have in JS.
1127
- useLayoutEffect(() => {
1128
- const nativeUpdate: {text?: string, selection?: Selection} = {};
1129
-
1130
- const lastNativeSelection = lastNativeSelectionRef.current.selection;
1131
-
1132
- if (
1133
- lastNativeTextRef.current !== props.value &&
1134
- typeof props.value === 'string'
1135
- ) {
1136
- nativeUpdate.text = props.value;
1137
- lastNativeTextRef.current = props.value;
1138
- }
1139
-
1140
- if (
1141
- selection &&
1142
- lastNativeSelection &&
1143
- (lastNativeSelection.start !== selection.start ||
1144
- lastNativeSelection.end !== selection.end)
1145
- ) {
1146
- nativeUpdate.selection = selection;
1147
- lastNativeSelectionRef.current = {selection, mostRecentEventCount};
1148
- }
1149
-
1150
- if (Object.keys(nativeUpdate).length === 0) {
1151
- return;
1152
- }
1153
-
1154
- if (inputRef.current != null) {
1155
- viewCommands.setTextAndSelection(
1156
- inputRef.current,
1157
- mostRecentEventCount,
1158
- text,
1159
- selection?.start ?? -1,
1160
- selection?.end ?? -1,
1161
- );
1162
- }
1163
- }, [
1164
- mostRecentEventCount,
1165
- inputRef,
1166
- props.value,
1167
- props.defaultValue,
1168
- selection,
1169
- text,
1170
- viewCommands,
1171
- ]);
1172
-
1173
- return {
1174
- setLastNativeText: lastNativeText => {
1175
- lastNativeTextRef.current = lastNativeText;
1176
- },
1177
- setLastNativeSelection: lastNativeSelection => {
1178
- lastNativeSelectionRef.current = lastNativeSelection;
1179
- },
1180
- };
1181
- }
1182
-
1183
1175
  /**
1184
1176
  * A foundational component for inputting text into the app via a
1185
1177
  * keyboard. Props provide configurability for several features, such as
@@ -1308,7 +1300,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
1308
1300
  ...otherProps
1309
1301
  } = props;
1310
1302
 
1311
- const inputRef = useRef<null | HostInstance>(null);
1303
+ const inputRef = useRef<null | TextInputInstance>(null);
1312
1304
 
1313
1305
  const selection: ?Selection =
1314
1306
  propsSelection == null
@@ -1323,7 +1315,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
1323
1315
  ? props.value
1324
1316
  : typeof props.defaultValue === 'string'
1325
1317
  ? props.defaultValue
1326
- : '';
1318
+ : undefined;
1327
1319
 
1328
1320
  const viewCommands =
1329
1321
  AndroidTextInputCommands ||
@@ -1332,10 +1324,6 @@ function InternalTextInput(props: TextInputProps): React.Node {
1332
1324
  : RCTSinglelineTextInputNativeCommands);
1333
1325
 
1334
1326
  const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
1335
- const useTextInputStateSynchronization =
1336
- ReactNativeFeatureFlags.useRefsForTextInputState()
1337
- ? useTextInputStateSynchronization_REFS
1338
- : useTextInputStateSynchronization_STATE;
1339
1327
  const {setLastNativeText, setLastNativeSelection} =
1340
1328
  useTextInputStateSynchronization({
1341
1329
  props,
@@ -1363,7 +1351,8 @@ function InternalTextInput(props: TextInputProps): React.Node {
1363
1351
  }, []);
1364
1352
 
1365
1353
  const setLocalRef = useCallback(
1366
- (instance: TextInputInstance | null) => {
1354
+ (instance: HostInstance | null) => {
1355
+ // $FlowExpectedError[incompatible-type]
1367
1356
  inputRef.current = instance;
1368
1357
 
1369
1358
  /*
@@ -1389,7 +1378,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
1389
1378
  before we can get to the long term breaking change.
1390
1379
  */
1391
1380
  if (instance != null) {
1392
- // $FlowFixMe[incompatible-use] - See the explanation above.
1381
+ // $FlowFixMe[prop-missing] - See the explanation above.
1393
1382
  Object.assign(instance, {
1394
1383
  clear(): void {
1395
1384
  if (inputRef.current != null) {
@@ -1406,7 +1395,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
1406
1395
  isFocused(): boolean {
1407
1396
  return TextInputState.currentlyFocusedInput() === inputRef.current;
1408
1397
  },
1409
- getNativeRef(): ?HostInstance {
1398
+ getNativeRef(): ?TextInputInstance {
1410
1399
  return inputRef.current;
1411
1400
  },
1412
1401
  setSelection(start: number, end: number): void {
@@ -1426,7 +1415,8 @@ function InternalTextInput(props: TextInputProps): React.Node {
1426
1415
  [mostRecentEventCount, viewCommands],
1427
1416
  );
1428
1417
 
1429
- const ref = useMergeRefs<TextInputInstance>(setLocalRef, props.forwardedRef);
1418
+ // $FlowExpectedError[incompatible-call]
1419
+ const ref = useMergeRefs<HostInstance>(setLocalRef, props.forwardedRef);
1430
1420
 
1431
1421
  const _onChange = (event: TextInputChangeEvent) => {
1432
1422
  const currentText = event.nativeEvent.text;
@@ -1614,8 +1604,8 @@ function InternalTextInput(props: TextInputProps): React.Node {
1614
1604
 
1615
1605
  textInput = (
1616
1606
  <RCTTextInputView
1617
- // $FlowFixMe[incompatible-type] - Figure out imperative + forward refs.
1618
- ref={ref}
1607
+ // Figure out imperative + forward refs.
1608
+ ref={(ref: $FlowFixMe)}
1619
1609
  {...otherProps}
1620
1610
  {...eventHandlers}
1621
1611
  accessibilityState={_accessibilityState}
@@ -1626,6 +1616,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
1626
1616
  focusable={tabIndex !== undefined ? !tabIndex : focusable}
1627
1617
  mostRecentEventCount={mostRecentEventCount}
1628
1618
  nativeID={id ?? props.nativeID}
1619
+ numberOfLines={props.rows ?? props.numberOfLines}
1629
1620
  onBlur={_onBlur}
1630
1621
  onChange={_onChange}
1631
1622
  onContentSizeChange={props.onContentSizeChange}
@@ -1675,8 +1666,8 @@ function InternalTextInput(props: TextInputProps): React.Node {
1675
1666
  * match up exactly with the props for TextInput. This will need to get
1676
1667
  * fixed */
1677
1668
  <AndroidTextInput
1678
- // $FlowFixMe[incompatible-type] - Figure out imperative + forward refs.
1679
- ref={ref}
1669
+ // Figure out imperative + forward refs.
1670
+ ref={(ref: $FlowFixMe)}
1680
1671
  {...otherProps}
1681
1672
  {...colorProps}
1682
1673
  {...eventHandlers}
@@ -1811,9 +1802,8 @@ const autoCompleteWebToTextContentTypeMap = {
1811
1802
  };
1812
1803
 
1813
1804
  const ExportedForwardRef: component(
1814
- ref: React.RefSetter<TextInputInstance>,
1805
+ ref?: React.RefSetter<TextInputInstance>,
1815
1806
  ...props: React.ElementConfig<typeof InternalTextInput>
1816
- // $FlowFixMe[incompatible-call]
1817
1807
  ) = React.forwardRef(function TextInput(
1818
1808
  {
1819
1809
  allowFontScaling = true,
@@ -1830,7 +1820,7 @@ const ExportedForwardRef: component(
1830
1820
  keyboardType,
1831
1821
  ...restProps
1832
1822
  },
1833
- forwardedRef: ReactRefSetter<TextInputInstance>,
1823
+ forwardedRef: React.RefSetter<TextInputInstance>,
1834
1824
  ) {
1835
1825
  return (
1836
1826
  <InternalTextInput
@@ -1884,12 +1874,7 @@ ExportedForwardRef.State = {
1884
1874
  };
1885
1875
 
1886
1876
  export type TextInputComponentStatics = $ReadOnly<{
1887
- State: $ReadOnly<{
1888
- currentlyFocusedInput: typeof TextInputState.currentlyFocusedInput,
1889
- currentlyFocusedField: typeof TextInputState.currentlyFocusedField,
1890
- focusTextInput: typeof TextInputState.focusTextInput,
1891
- blurTextInput: typeof TextInputState.blurTextInput,
1892
- }>,
1877
+ State: TextInputStateType,
1893
1878
  }>;
1894
1879
 
1895
1880
  const styles = StyleSheet.create({