@office-iss/react-native-win32 0.79.0-preview.2 → 0.80.0-preview.1
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.
- package/.flowconfig +10 -3
- package/CHANGELOG.json +120 -12
- package/CHANGELOG.md +50 -7
- package/IntegrationTests/ImageCachePolicyTest.js +1 -1
- package/IntegrationTests/LayoutEventsTest.js +1 -4
- package/Libraries/Alert/Alert.d.ts +4 -1
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Alert/RCTAlertManager.js +17 -0
- package/Libraries/Animated/Animated.js.flow +1 -3
- package/Libraries/Animated/AnimatedEvent.js +4 -3
- package/Libraries/Animated/AnimatedExports.js +2 -2
- package/Libraries/Animated/AnimatedExports.js.flow +140 -0
- package/Libraries/Animated/AnimatedImplementation.js +2 -123
- package/Libraries/Animated/Easing.js +13 -15
- package/Libraries/Animated/animations/Animation.js +8 -4
- package/Libraries/Animated/components/AnimatedFlatList.js +7 -6
- package/Libraries/Animated/components/AnimatedScrollView.js +48 -42
- package/Libraries/Animated/components/AnimatedSectionList.js +11 -7
- package/Libraries/Animated/createAnimatedComponent.js +105 -57
- package/Libraries/Animated/nodes/AnimatedNode.js +4 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +46 -26
- package/Libraries/Animated/nodes/AnimatedValue.js +16 -7
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/AppState/AppState.js +7 -2
- package/Libraries/BatchedBridge/MessageQueue.js +2 -2
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/BlobManager.js +1 -0
- package/Libraries/Blob/FileReader.js +219 -8
- package/Libraries/Blob/URL.js +37 -12
- package/Libraries/Blob/URLSearchParams.js +106 -31
- package/Libraries/Blob/URLSearchParams.js.flow +12 -7
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -0
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.win32.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
- package/Libraries/{NewAppScreen/components/Colors.js → Components/DrawerAndroid/DrawerLayoutAndroid.ios.js} +6 -10
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
- package/Libraries/Components/Keyboard/Keyboard.js +5 -3
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
- package/Libraries/Components/Pressable/Pressable.js +20 -4
- package/Libraries/Components/Pressable/Pressable.win32.js +20 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +25 -3
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.d.ts +3 -3
- package/Libraries/Components/ScrollView/ScrollView.js +132 -122
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/Switch/Switch.d.ts +3 -0
- package/Libraries/Components/Switch/Switch.js +8 -4
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -4
- package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
- package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +70 -33
- package/Libraries/Components/TextInput/TextInput.flow.js +100 -51
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +1208 -0
- package/Libraries/Components/TextInput/TextInput.js +88 -1027
- package/Libraries/Components/TextInput/TextInput.win32.js +89 -1059
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
- package/Libraries/{Modal/ModalInjection.js → Components/ToastAndroid/ToastAndroid.ios.js} +3 -5
- package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/Touchable.js +5 -5
- package/Libraries/Components/Touchable/Touchable.win32.js +5 -5
- package/Libraries/Components/Touchable/TouchableBounce.js +14 -7
- package/Libraries/Components/Touchable/TouchableHighlight.js +10 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -6
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +6 -6
- package/Libraries/Components/Touchable/TouchableOpacity.js +13 -6
- package/Libraries/Components/View/View.js +18 -21
- package/Libraries/Components/View/View.win32.js +21 -24
- package/Libraries/Components/View/ViewAccessibility.js +25 -1
- package/Libraries/Components/View/ViewAccessibility.win32.js +9 -1
- package/Libraries/Components/View/ViewPropTypes.js +49 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +49 -3
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpReactDevTools.js +5 -5
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +3 -3
- package/Libraries/EventEmitter/NativeEventEmitter.js +9 -4
- package/Libraries/Image/AssetSourceResolver.js +17 -4
- package/Libraries/Image/Image.d.ts +26 -10
- package/Libraries/Image/Image.js +17 -0
- package/Libraries/Image/Image.js.flow +5 -5
- package/Libraries/Image/ImageBackground.js +2 -0
- package/Libraries/Image/ImageInjection.js +1 -1
- package/Libraries/Image/ImageProps.js +22 -17
- package/Libraries/Image/ImageSource.js +3 -1
- package/Libraries/Image/ImageSourceUtils.js +4 -2
- package/Libraries/Image/ImageTypes.flow.js +1 -1
- package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
- package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
- package/Libraries/Interaction/InteractionManager.d.ts +13 -0
- package/Libraries/Interaction/InteractionManager.js +1 -1
- package/Libraries/Interaction/PanResponder.js +3 -3
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -2
- package/Libraries/Lists/FlatList.js +8 -11
- package/Libraries/Lists/SectionList.js +39 -42
- package/Libraries/Lists/SectionListModern.js +25 -34
- package/Libraries/Lists/VirtualizedList.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +1 -0
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +140 -0
- package/Libraries/Modal/Modal.js +33 -7
- package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +1 -0
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
- package/Libraries/NativeModules/specs/NativeDevMenu.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.js +17 -0
- package/Libraries/Network/RCTNetworking.js.flow +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +781 -10
- package/Libraries/Performance/Systrace.js +7 -7
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.win32.js +1 -1
- package/Libraries/ReactNative/AppContainer-dev.js +5 -4
- package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
- package/Libraries/ReactNative/AppRegistry.js +2 -322
- package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
- package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
- package/Libraries/ReactNative/FabricUIManager.js +10 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -4
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
- package/Libraries/ReactNative/RendererImplementation.js +10 -5
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -0
- package/Libraries/ReactNative/renderApplication.js +9 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +3 -3
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +51 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4840 -4748
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +4947 -4829
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3998 -3888
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5005 -4948
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2744 -2652
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5020 -4933
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -3
- package/Libraries/Settings/Settings.ios.js +1 -0
- package/Libraries/Settings/Settings.js +13 -19
- package/Libraries/Settings/Settings.win32.js +19 -20
- package/Libraries/Settings/SettingsFallback.js +33 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
- package/Libraries/StyleSheet/Rect.js +1 -0
- package/Libraries/StyleSheet/StyleSheet.js +31 -200
- package/Libraries/StyleSheet/StyleSheet.js.flow +188 -0
- package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +112 -0
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +130 -52
- package/Libraries/StyleSheet/flattenStyle.js +14 -4
- package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
- package/Libraries/StyleSheet/processBackgroundImage.js +670 -214
- package/Libraries/Text/Text.d.ts +2 -5
- package/Libraries/Text/Text.js +3 -3
- package/Libraries/Text/Text.win32.js +3 -3
- package/Libraries/Text/TextNativeComponent.js +0 -4
- package/Libraries/Text/TextNativeComponent.win32.js +0 -4
- package/Libraries/Text/TextProps.js +5 -33
- package/Libraries/Text/TextProps.win32.js +5 -30
- package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
- package/Libraries/{Blob/__mocks__/BlobModule.js → Types/CodegenTypesNamespace.js} +4 -6
- package/Libraries/Types/CoreEventTypes.d.ts +6 -1
- package/Libraries/Types/CoreEventTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.win32.js +1 -1
- package/Libraries/Utilities/Appearance.js +2 -0
- package/Libraries/Utilities/BackHandler.js +17 -0
- package/Libraries/Utilities/DeviceInfo.js +2 -0
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/Dimensions.win32.js +1 -1
- package/Libraries/Utilities/Platform.js +17 -0
- package/Libraries/Utilities/PlatformTypes.js +11 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +2 -2
- package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
- package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
- package/Libraries/WebSocket/WebSocket.js +313 -8
- package/Libraries/vendor/core/ErrorUtils.js +28 -2
- package/Libraries/vendor/emitter/EventEmitter.js +6 -2
- package/flow/global.js +1 -0
- package/index.js +51 -331
- package/index.win32.js +71 -352
- package/interface.js +0 -4
- package/jest/resolver.js +31 -0
- package/overrides.json +45 -47
- package/package.json +24 -24
- package/src/private/animated/NativeAnimatedHelper.js +21 -8
- package/src/private/animated/NativeAnimatedHelper.win32.js +21 -8
- package/src/private/animated/createAnimatedPropsHook.js +11 -16
- package/src/private/animated/createAnimatedPropsMemoHook.js +1 -2
- package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
- package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
- package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
- package/src/private/{devmenu → devsupport/devmenu}/DevMenu.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BorderBox.js +3 -3
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BoxInspector.js +6 -5
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementBox.js +8 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementProperties.js +11 -10
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/Inspector.js +14 -12
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorOverlay.js +5 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorPanel.js +9 -8
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/NetworkOverlay.js +10 -9
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ReactDevToolsOverlay.js +7 -7
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/StyleInspector.js +7 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/XHRInterceptor.js +2 -2
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/getInspectorDataForViewAtPoint.js +4 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/resolveBoxStyle.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/perfmonitor}/PerformanceOverlay.js +6 -5
- package/src/private/{specs_DEPRECATED/modules → devsupport/devmenu/specs}/NativeDevMenu.js +2 -2
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.android.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.ios.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.win32.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/setUpFuseboxReactDevToolsDispatcher.js +1 -1
- package/src/private/{fusebox → devsupport/rndevtools}/specs/NativeReactDevToolsRuntimeSettingsModule.js +2 -2
- package/src/private/{specs_DEPRECATED/modules → devsupport/rndevtools/specs}/NativeReactDevToolsSettingsManager.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +82 -80
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -13
- package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +3 -0
- package/src/private/styles/composeStyles.js +12 -5
- package/src/private/types/HostComponent.js +1 -1
- package/src/private/types/HostInstance.js +67 -1
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -5
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
- package/src/private/webapis/performance/Performance.js +1 -3
- package/src/private/webapis/performance/PerformanceEntry.js +6 -1
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +10 -1
- package/src/types/globals.d.ts +42 -0
- package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
- package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
- package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
- package/src-win/Libraries/Text/Text.d.ts +2 -5
- package/types/index.d.ts +6 -3
- package/types/public/ReactNativeTypes.d.ts +2 -2
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +0 -38
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +0 -22
- package/Libraries/Blob/FileReader_new.js +0 -231
- package/Libraries/Blob/FileReader_old.js +0 -186
- package/Libraries/Blob/__mocks__/FileReaderModule.js +0 -20
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +0 -32
- package/Libraries/Core/__mocks__/ErrorUtils.js +0 -33
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -19
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +0 -49
- package/Libraries/Events/CustomEvent.js +0 -32
- package/Libraries/Events/EventPolyfill.js +0 -239
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +0 -118
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +0 -134
- package/Libraries/Network/XMLHttpRequest_new.js +0 -794
- package/Libraries/Network/XMLHttpRequest_old.js +0 -701
- package/Libraries/NewAppScreen/components/DebugInstructions.js +0 -41
- package/Libraries/NewAppScreen/components/Header.js +0 -77
- package/Libraries/NewAppScreen/components/HermesBadge.js +0 -53
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +0 -148
- package/Libraries/NewAppScreen/components/ReloadInstructions.js +0 -39
- package/Libraries/NewAppScreen/components/logo.png +0 -0
- package/Libraries/NewAppScreen/index.js +0 -25
- package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +0 -58
- package/Libraries/Utilities/DeviceInfo.win32.js +0 -19
- package/Libraries/Utilities/__mocks__/BackHandler.js +0 -45
- package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +0 -16
- package/Libraries/Utilities/__mocks__/PixelRatio.js +0 -25
- package/Libraries/WebSocket/WebSocketEvent.js +0 -30
- package/Libraries/WebSocket/WebSocket_new.js +0 -325
- package/Libraries/WebSocket/WebSocket_old.js +0 -297
- package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +0 -30
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +0 -81
- package/flow/jest.js +0 -1287
- package/jest/__tests__/setup-test.js +0 -18
- package/src/private/components/VScrollViewNativeComponents.js +0 -25
- package/src/private/utilities/ensureInstance.js +0 -21
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +0 -267
- package/types/modules/LaunchScreen.d.ts +0 -18
- /package/src/private/{devmenu → devsupport/devmenu}/DevMenu.d.ts +0 -0
- /package/src/private/{debugging → devsupport/rndevtools}/FuseboxSessionObserver.js +0 -0
|
@@ -12,20 +12,46 @@ 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
|
-
NativeSyntheticEvent,
|
|
16
15
|
ScrollEvent,
|
|
17
16
|
} from '../../Types/CoreEventTypes';
|
|
18
|
-
import type {
|
|
19
|
-
|
|
17
|
+
import type {
|
|
18
|
+
AutoCapitalize,
|
|
19
|
+
EnterKeyHintType,
|
|
20
|
+
EnterKeyHintTypeAndroid,
|
|
21
|
+
EnterKeyHintTypeIOS,
|
|
22
|
+
EnterKeyHintTypeOptions,
|
|
23
|
+
InputModeOptions,
|
|
24
|
+
KeyboardType,
|
|
25
|
+
KeyboardTypeAndroid,
|
|
26
|
+
KeyboardTypeIOS,
|
|
27
|
+
KeyboardTypeOptions,
|
|
28
|
+
ReturnKeyType,
|
|
29
|
+
ReturnKeyTypeAndroid,
|
|
30
|
+
ReturnKeyTypeIOS,
|
|
31
|
+
ReturnKeyTypeOptions,
|
|
32
|
+
Selection,
|
|
33
|
+
SubmitBehavior,
|
|
34
|
+
TextContentType,
|
|
35
|
+
TextInputAndroidProps,
|
|
36
|
+
TextInputBlurEvent,
|
|
37
|
+
TextInputChangeEvent,
|
|
38
|
+
TextInputContentSizeChangeEvent,
|
|
39
|
+
TextInputEditingEvent,
|
|
40
|
+
TextInputEndEditingEvent,
|
|
41
|
+
TextInputEvent,
|
|
42
|
+
TextInputFocusEvent,
|
|
43
|
+
TextInputInstance,
|
|
44
|
+
TextInputIOSProps,
|
|
45
|
+
TextInputKeyPressEvent,
|
|
46
|
+
TextInputProps,
|
|
47
|
+
TextInputSelectionChangeEvent,
|
|
48
|
+
TextInputSubmitEditingEvent,
|
|
49
|
+
TextInputType,
|
|
50
|
+
} from './TextInput.flow';
|
|
20
51
|
|
|
21
|
-
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
|
|
22
52
|
import usePressability from '../../Pressability/usePressability';
|
|
23
53
|
import flattenStyle from '../../StyleSheet/flattenStyle';
|
|
24
|
-
import StyleSheet, {
|
|
25
|
-
type ColorValue,
|
|
26
|
-
type TextStyleProp,
|
|
27
|
-
type ViewStyleProp,
|
|
28
|
-
} from '../../StyleSheet/StyleSheet';
|
|
54
|
+
import StyleSheet, {type TextStyleProp} from '../../StyleSheet/StyleSheet';
|
|
29
55
|
import Text from '../../Text/Text';
|
|
30
56
|
import TextAncestor from '../../Text/TextAncestor';
|
|
31
57
|
import Platform from '../../Utilities/Platform';
|
|
@@ -58,936 +84,65 @@ if (Platform.OS === 'android') {
|
|
|
58
84
|
require('./RCTMultilineTextInputNativeComponent').Commands;
|
|
59
85
|
}
|
|
60
86
|
|
|
61
|
-
export type
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
|
|
93
|
-
|
|
94
|
-
export type TargetEvent = $ReadOnly<{
|
|
95
|
-
target: number,
|
|
96
|
-
}>;
|
|
97
|
-
|
|
98
|
-
export type TextInputFocusEventData = TargetEvent;
|
|
99
|
-
|
|
100
|
-
export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
|
101
|
-
export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
|
102
|
-
|
|
103
|
-
type Selection = $ReadOnly<{
|
|
104
|
-
start: number,
|
|
105
|
-
end: number,
|
|
106
|
-
}>;
|
|
107
|
-
|
|
108
|
-
export type TextInputSelectionChangeEventData = $ReadOnly<{
|
|
109
|
-
...TargetEvent,
|
|
110
|
-
selection: Selection,
|
|
111
|
-
}>;
|
|
112
|
-
|
|
113
|
-
export type TextInputSelectionChangeEvent =
|
|
114
|
-
NativeSyntheticEvent<TextInputSelectionChangeEventData>;
|
|
115
|
-
|
|
116
|
-
type TextInputKeyPressEventData = $ReadOnly<{
|
|
117
|
-
...TargetEvent,
|
|
118
|
-
key: string,
|
|
119
|
-
target?: ?number,
|
|
120
|
-
eventCount?: ?number,
|
|
121
|
-
}>;
|
|
122
|
-
|
|
123
|
-
export type TextInputKeyPressEvent =
|
|
124
|
-
NativeSyntheticEvent<TextInputKeyPressEventData>;
|
|
125
|
-
|
|
126
|
-
export type TextInputEndEditingEventData = $ReadOnly<{
|
|
127
|
-
...TargetEvent,
|
|
128
|
-
eventCount: number,
|
|
129
|
-
text: string,
|
|
130
|
-
}>;
|
|
131
|
-
|
|
132
|
-
export type TextInputEditingEvent =
|
|
133
|
-
NativeSyntheticEvent<TextInputEndEditingEventData>;
|
|
134
|
-
|
|
135
|
-
type DataDetectorTypesType =
|
|
136
|
-
| 'phoneNumber'
|
|
137
|
-
| 'link'
|
|
138
|
-
| 'address'
|
|
139
|
-
| 'calendarEvent'
|
|
140
|
-
| 'trackingNumber'
|
|
141
|
-
| 'flightNumber'
|
|
142
|
-
| 'lookupSuggestion'
|
|
143
|
-
| 'none'
|
|
144
|
-
| 'all';
|
|
145
|
-
|
|
146
|
-
export type KeyboardType =
|
|
147
|
-
| 'default'
|
|
148
|
-
| 'email-address'
|
|
149
|
-
| 'numeric'
|
|
150
|
-
| 'phone-pad'
|
|
151
|
-
| 'number-pad'
|
|
152
|
-
| 'decimal-pad'
|
|
153
|
-
| 'url';
|
|
154
|
-
|
|
155
|
-
export type KeyboardTypeIOS =
|
|
156
|
-
| 'ascii-capable'
|
|
157
|
-
| 'numbers-and-punctuation'
|
|
158
|
-
| 'name-phone-pad'
|
|
159
|
-
| 'twitter'
|
|
160
|
-
| 'web-search'
|
|
161
|
-
// iOS 10+ only
|
|
162
|
-
| 'ascii-capable-number-pad';
|
|
163
|
-
|
|
164
|
-
export type KeyboardTypeAndroid = 'visible-password';
|
|
165
|
-
|
|
166
|
-
export type KeyboardTypeOptions =
|
|
167
|
-
| KeyboardType
|
|
168
|
-
| KeyboardTypeIOS
|
|
169
|
-
| KeyboardTypeAndroid;
|
|
170
|
-
|
|
171
|
-
export type InputModeOptions =
|
|
172
|
-
| 'none'
|
|
173
|
-
| 'text'
|
|
174
|
-
| 'decimal'
|
|
175
|
-
| 'numeric'
|
|
176
|
-
| 'tel'
|
|
177
|
-
| 'search'
|
|
178
|
-
| 'email'
|
|
179
|
-
| 'url';
|
|
180
|
-
|
|
181
|
-
export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send';
|
|
182
|
-
|
|
183
|
-
export type ReturnKeyTypeIOS =
|
|
184
|
-
| 'default'
|
|
185
|
-
| 'emergency-call'
|
|
186
|
-
| 'google'
|
|
187
|
-
| 'join'
|
|
188
|
-
| 'route'
|
|
189
|
-
| 'yahoo';
|
|
190
|
-
|
|
191
|
-
export type ReturnKeyTypeAndroid = 'none' | 'previous';
|
|
192
|
-
|
|
193
|
-
export type ReturnKeyTypeOptions =
|
|
194
|
-
| ReturnKeyType
|
|
195
|
-
| ReturnKeyTypeIOS
|
|
196
|
-
| ReturnKeyTypeAndroid;
|
|
197
|
-
|
|
198
|
-
export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
|
|
199
|
-
|
|
200
|
-
export type AutoCapitalize = 'none' | 'sentences' | 'words' | 'characters';
|
|
201
|
-
|
|
202
|
-
export type TextContentType =
|
|
203
|
-
| 'none'
|
|
204
|
-
| 'URL'
|
|
205
|
-
| 'addressCity'
|
|
206
|
-
| 'addressCityAndState'
|
|
207
|
-
| 'addressState'
|
|
208
|
-
| 'countryName'
|
|
209
|
-
| 'creditCardNumber'
|
|
210
|
-
| 'creditCardExpiration'
|
|
211
|
-
| 'creditCardExpirationMonth'
|
|
212
|
-
| 'creditCardExpirationYear'
|
|
213
|
-
| 'creditCardSecurityCode'
|
|
214
|
-
| 'creditCardType'
|
|
215
|
-
| 'creditCardName'
|
|
216
|
-
| 'creditCardGivenName'
|
|
217
|
-
| 'creditCardMiddleName'
|
|
218
|
-
| 'creditCardFamilyName'
|
|
219
|
-
| 'emailAddress'
|
|
220
|
-
| 'familyName'
|
|
221
|
-
| 'fullStreetAddress'
|
|
222
|
-
| 'givenName'
|
|
223
|
-
| 'jobTitle'
|
|
224
|
-
| 'location'
|
|
225
|
-
| 'middleName'
|
|
226
|
-
| 'name'
|
|
227
|
-
| 'namePrefix'
|
|
228
|
-
| 'nameSuffix'
|
|
229
|
-
| 'nickname'
|
|
230
|
-
| 'organizationName'
|
|
231
|
-
| 'postalCode'
|
|
232
|
-
| 'streetAddressLine1'
|
|
233
|
-
| 'streetAddressLine2'
|
|
234
|
-
| 'sublocality'
|
|
235
|
-
| 'telephoneNumber'
|
|
236
|
-
| 'username'
|
|
237
|
-
| 'password'
|
|
238
|
-
| 'newPassword'
|
|
239
|
-
| 'oneTimeCode'
|
|
240
|
-
| 'birthdate'
|
|
241
|
-
| 'birthdateDay'
|
|
242
|
-
| 'birthdateMonth'
|
|
243
|
-
| 'birthdateYear'
|
|
244
|
-
| 'cellularEID'
|
|
245
|
-
| 'cellularIMEI'
|
|
246
|
-
| 'dateTime'
|
|
247
|
-
| 'flightNumber'
|
|
248
|
-
| 'shipmentTrackingNumber';
|
|
249
|
-
|
|
250
|
-
export type EnterKeyHintTypeAndroid = 'previous';
|
|
251
|
-
|
|
252
|
-
export type EnterKeyHintTypeIOS = 'enter';
|
|
253
|
-
|
|
254
|
-
export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send';
|
|
255
|
-
|
|
256
|
-
export type EnterKeyHintTypeOptions =
|
|
257
|
-
| EnterKeyHintType
|
|
258
|
-
| EnterKeyHintTypeAndroid
|
|
259
|
-
| EnterKeyHintTypeIOS;
|
|
260
|
-
|
|
261
|
-
type PasswordRules = string;
|
|
262
|
-
|
|
263
|
-
export type TextInputIOSProps = $ReadOnly<{
|
|
264
|
-
/**
|
|
265
|
-
* If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false.
|
|
266
|
-
* @platform ios
|
|
267
|
-
*/
|
|
268
|
-
disableKeyboardShortcuts?: ?boolean,
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* When the clear button should appear on the right side of the text view.
|
|
272
|
-
* This property is supported only for single-line TextInput component.
|
|
273
|
-
* @platform ios
|
|
274
|
-
*/
|
|
275
|
-
clearButtonMode?: ?('never' | 'while-editing' | 'unless-editing' | 'always'),
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* If `true`, clears the text field automatically when editing begins.
|
|
279
|
-
* @platform ios
|
|
280
|
-
*/
|
|
281
|
-
clearTextOnFocus?: ?boolean,
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Determines the types of data converted to clickable URLs in the text input.
|
|
285
|
-
* Only valid if `multiline={true}` and `editable={false}`.
|
|
286
|
-
* By default no data types are detected.
|
|
287
|
-
*
|
|
288
|
-
* You can provide one type or an array of many types.
|
|
289
|
-
*
|
|
290
|
-
* Possible values for `dataDetectorTypes` are:
|
|
291
|
-
*
|
|
292
|
-
* - `'phoneNumber'`
|
|
293
|
-
* - `'link'`
|
|
294
|
-
* - `'address'`
|
|
295
|
-
* - `'calendarEvent'`
|
|
296
|
-
* - `'none'`
|
|
297
|
-
* - `'all'`
|
|
298
|
-
*
|
|
299
|
-
* @platform ios
|
|
300
|
-
*/
|
|
301
|
-
dataDetectorTypes?:
|
|
302
|
-
| ?DataDetectorTypesType
|
|
303
|
-
| $ReadOnlyArray<DataDetectorTypesType>,
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* If `true`, the keyboard disables the return key when there is no text and
|
|
307
|
-
* automatically enables it when there is text. The default value is `false`.
|
|
308
|
-
* @platform ios
|
|
309
|
-
*/
|
|
310
|
-
enablesReturnKeyAutomatically?: ?boolean,
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* An optional identifier which links a custom InputAccessoryView to
|
|
314
|
-
* this text input. The InputAccessoryView is rendered above the
|
|
315
|
-
* keyboard when this text input is focused.
|
|
316
|
-
* @platform ios
|
|
317
|
-
*/
|
|
318
|
-
inputAccessoryViewID?: ?string,
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* An optional label that overrides the default input accessory view button label.
|
|
322
|
-
* @platform ios
|
|
323
|
-
*/
|
|
324
|
-
inputAccessoryViewButtonLabel?: ?string,
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Determines the color of the keyboard.
|
|
328
|
-
* @platform ios
|
|
329
|
-
*/
|
|
330
|
-
keyboardAppearance?: ?('default' | 'light' | 'dark'),
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Provide rules for your password.
|
|
334
|
-
* For example, say you want to require a password with at least eight characters consisting of a mix of uppercase and lowercase letters, at least one number, and at most two consecutive characters.
|
|
335
|
-
* "required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8;"
|
|
336
|
-
* @platform ios
|
|
337
|
-
*/
|
|
338
|
-
passwordRules?: ?PasswordRules,
|
|
339
|
-
|
|
340
|
-
/*
|
|
341
|
-
* If `true`, allows TextInput to pass touch events to the parent component.
|
|
342
|
-
* This allows components to be swipeable from the TextInput on iOS,
|
|
343
|
-
* as is the case on Android by default.
|
|
344
|
-
* If `false`, TextInput always asks to handle the input (except when disabled).
|
|
345
|
-
* @platform ios
|
|
346
|
-
*/
|
|
347
|
-
rejectResponderTermination?: ?boolean,
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* If `false`, scrolling of the text view will be disabled.
|
|
351
|
-
* The default value is `true`. Does only work with 'multiline={true}'.
|
|
352
|
-
* @platform ios
|
|
353
|
-
*/
|
|
354
|
-
scrollEnabled?: ?boolean,
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* If `false`, disables spell-check style (i.e. red underlines).
|
|
358
|
-
* The default value is inherited from `autoCorrect`.
|
|
359
|
-
* @platform ios
|
|
360
|
-
*/
|
|
361
|
-
spellCheck?: ?boolean,
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Give the keyboard and the system information about the
|
|
365
|
-
* expected semantic meaning for the content that users enter.
|
|
366
|
-
* `autoComplete` property accomplishes same behavior and is recommended as its supported by both platforms.
|
|
367
|
-
* Avoid using both `autoComplete` and `textContentType`, you can use `Platform.select` for differing platform behaviors.
|
|
368
|
-
* For backwards compatibility, when both set, `textContentType` takes precedence on iOS.
|
|
369
|
-
* @platform ios
|
|
370
|
-
*/
|
|
371
|
-
textContentType?: ?TextContentType,
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Set line break strategy on iOS.
|
|
375
|
-
* @platform ios
|
|
376
|
-
*/
|
|
377
|
-
lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Set line break mode on iOS.
|
|
381
|
-
* @platform ios
|
|
382
|
-
*/
|
|
383
|
-
lineBreakModeIOS?: ?(
|
|
384
|
-
| 'wordWrapping'
|
|
385
|
-
| 'char'
|
|
386
|
-
| 'clip'
|
|
387
|
-
| 'head'
|
|
388
|
-
| 'middle'
|
|
389
|
-
| 'tail'
|
|
390
|
-
),
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* If `false`, the iOS system will not insert an extra space after a paste operation
|
|
394
|
-
* neither delete one or two spaces after a cut or delete operation.
|
|
395
|
-
*
|
|
396
|
-
* The default value is `true`.
|
|
397
|
-
*
|
|
398
|
-
* @platform ios
|
|
399
|
-
*/
|
|
400
|
-
smartInsertDelete?: ?boolean,
|
|
401
|
-
}>;
|
|
402
|
-
|
|
403
|
-
export type TextInputAndroidProps = $ReadOnly<{
|
|
404
|
-
/**
|
|
405
|
-
* When provided it will set the color of the cursor (or "caret") in the component.
|
|
406
|
-
* Unlike the behavior of `selectionColor` the cursor color will be set independently
|
|
407
|
-
* from the color of the text selection box.
|
|
408
|
-
* @platform android
|
|
409
|
-
*/
|
|
410
|
-
cursorColor?: ?ColorValue,
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* When `false`, if there is a small amount of space available around a text input
|
|
414
|
-
* (e.g. landscape orientation on a phone), the OS may choose to have the user edit
|
|
415
|
-
* the text inside of a full screen text input mode. When `true`, this feature is
|
|
416
|
-
* disabled and users will always edit the text directly inside of the text input.
|
|
417
|
-
* Defaults to `false`.
|
|
418
|
-
* @platform android
|
|
419
|
-
*/
|
|
420
|
-
disableFullscreenUI?: ?boolean,
|
|
421
|
-
|
|
422
|
-
importantForAutofill?: ?(
|
|
423
|
-
| 'auto'
|
|
424
|
-
| 'no'
|
|
425
|
-
| 'noExcludeDescendants'
|
|
426
|
-
| 'yes'
|
|
427
|
-
| 'yesExcludeDescendants'
|
|
428
|
-
),
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* If defined, the provided image resource will be rendered on the left.
|
|
432
|
-
* The image resource must be inside `/android/app/src/main/res/drawable` and referenced
|
|
433
|
-
* like
|
|
434
|
-
* ```
|
|
435
|
-
* <TextInput
|
|
436
|
-
* inlineImageLeft='search_icon'
|
|
437
|
-
* />
|
|
438
|
-
* ```
|
|
439
|
-
* @platform android
|
|
440
|
-
*/
|
|
441
|
-
inlineImageLeft?: ?string,
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Padding between the inline image, if any, and the text input itself.
|
|
445
|
-
* @platform android
|
|
446
|
-
*/
|
|
447
|
-
inlineImagePadding?: ?number,
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Sets the number of lines for a `TextInput`. Use it with multiline set to
|
|
451
|
-
* `true` to be able to fill the lines.
|
|
452
|
-
* @platform android
|
|
453
|
-
*/
|
|
454
|
-
numberOfLines?: ?number,
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Sets the return key to the label. Use it instead of `returnKeyType`.
|
|
458
|
-
* @platform android
|
|
459
|
-
*/
|
|
460
|
-
returnKeyLabel?: ?string,
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Sets the number of rows for a `TextInput`. Use it with multiline set to
|
|
464
|
-
* `true` to be able to fill the lines.
|
|
465
|
-
* @platform android
|
|
466
|
-
*/
|
|
467
|
-
rows?: ?number,
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* When `false`, it will prevent the soft keyboard from showing when the field is focused.
|
|
471
|
-
* Defaults to `true`.
|
|
472
|
-
*/
|
|
473
|
-
showSoftInputOnFocus?: ?boolean,
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced`
|
|
477
|
-
* The default value is `simple`.
|
|
478
|
-
* @platform android
|
|
479
|
-
*/
|
|
480
|
-
textBreakStrategy?: ?('simple' | 'highQuality' | 'balanced'),
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* The color of the `TextInput` underline.
|
|
484
|
-
* @platform android
|
|
485
|
-
*/
|
|
486
|
-
underlineColorAndroid?: ?ColorValue,
|
|
487
|
-
}>;
|
|
488
|
-
|
|
489
|
-
export type TextInputProps = $ReadOnly<{
|
|
490
|
-
...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
|
|
491
|
-
...TextInputIOSProps,
|
|
492
|
-
...TextInputAndroidProps,
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* Can tell `TextInput` to automatically capitalize certain characters.
|
|
496
|
-
*
|
|
497
|
-
* - `characters`: all characters.
|
|
498
|
-
* - `words`: first letter of each word.
|
|
499
|
-
* - `sentences`: first letter of each sentence (*default*).
|
|
500
|
-
* - `none`: don't auto capitalize anything.
|
|
501
|
-
*/
|
|
502
|
-
autoCapitalize?: ?AutoCapitalize,
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Specifies autocomplete hints for the system, so it can provide autofill.
|
|
506
|
-
* On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
|
|
507
|
-
* To disable autocomplete, set autoComplete to off.
|
|
508
|
-
*
|
|
509
|
-
* The following values work across platforms:
|
|
510
|
-
*
|
|
511
|
-
* - `additional-name`
|
|
512
|
-
* - `address-line1`
|
|
513
|
-
* - `address-line2`
|
|
514
|
-
* - `birthdate-day` (iOS 17+)
|
|
515
|
-
* - `birthdate-full` (iOS 17+)
|
|
516
|
-
* - `birthdate-month` (iOS 17+)
|
|
517
|
-
* - `birthdate-year` (iOS 17+)
|
|
518
|
-
* - `cc-number`
|
|
519
|
-
* - `cc-csc` (iOS 17+)
|
|
520
|
-
* - `cc-exp` (iOS 17+)
|
|
521
|
-
* - `cc-exp-day` (iOS 17+)
|
|
522
|
-
* - `cc-exp-month` (iOS 17+)
|
|
523
|
-
* - `cc-exp-year` (iOS 17+)
|
|
524
|
-
* - `country`
|
|
525
|
-
* - `current-password`
|
|
526
|
-
* - `email`
|
|
527
|
-
* - `family-name`
|
|
528
|
-
* - `given-name`
|
|
529
|
-
* - `honorific-prefix`
|
|
530
|
-
* - `honorific-suffix`
|
|
531
|
-
* - `name`
|
|
532
|
-
* - `new-password`
|
|
533
|
-
* - `off`
|
|
534
|
-
* - `one-time-code`
|
|
535
|
-
* - `postal-code`
|
|
536
|
-
* - `street-address`
|
|
537
|
-
* - `tel`
|
|
538
|
-
* - `username`
|
|
539
|
-
*
|
|
540
|
-
* The following values work on iOS only:
|
|
541
|
-
*
|
|
542
|
-
* - `cc-name` (iOS 17+)
|
|
543
|
-
* - `cc-given-name` (iOS 17+)
|
|
544
|
-
* - `cc-middle-name` (iOS 17+)
|
|
545
|
-
* - `cc-family-name` (iOS 17+)
|
|
546
|
-
* - `cc-type` (iOS 17+)
|
|
547
|
-
* - `nickname`
|
|
548
|
-
* - `organization`
|
|
549
|
-
* - `organization-title`
|
|
550
|
-
* - `url`
|
|
551
|
-
*
|
|
552
|
-
* The following values work on Android only:
|
|
553
|
-
*
|
|
554
|
-
* - `gender`
|
|
555
|
-
* - `name-family`
|
|
556
|
-
* - `name-given`
|
|
557
|
-
* - `name-middle`
|
|
558
|
-
* - `name-middle-initial`
|
|
559
|
-
* - `name-prefix`
|
|
560
|
-
* - `name-suffix`
|
|
561
|
-
* - `password`
|
|
562
|
-
* - `password-new`
|
|
563
|
-
* - `postal-address`
|
|
564
|
-
* - `postal-address-country`
|
|
565
|
-
* - `postal-address-extended`
|
|
566
|
-
* - `postal-address-extended-postal-code`
|
|
567
|
-
* - `postal-address-locality`
|
|
568
|
-
* - `postal-address-region`
|
|
569
|
-
* - `sms-otp`
|
|
570
|
-
* - `tel-country-code`
|
|
571
|
-
* - `tel-national`
|
|
572
|
-
* - `tel-device`
|
|
573
|
-
* - `username-new`
|
|
574
|
-
*/
|
|
575
|
-
autoComplete?: ?(
|
|
576
|
-
| 'additional-name'
|
|
577
|
-
| 'address-line1'
|
|
578
|
-
| 'address-line2'
|
|
579
|
-
| 'birthdate-day'
|
|
580
|
-
| 'birthdate-full'
|
|
581
|
-
| 'birthdate-month'
|
|
582
|
-
| 'birthdate-year'
|
|
583
|
-
| 'cc-csc'
|
|
584
|
-
| 'cc-exp'
|
|
585
|
-
| 'cc-exp-day'
|
|
586
|
-
| 'cc-exp-month'
|
|
587
|
-
| 'cc-exp-year'
|
|
588
|
-
| 'cc-number'
|
|
589
|
-
| 'cc-name'
|
|
590
|
-
| 'cc-given-name'
|
|
591
|
-
| 'cc-middle-name'
|
|
592
|
-
| 'cc-family-name'
|
|
593
|
-
| 'cc-type'
|
|
594
|
-
| 'country'
|
|
595
|
-
| 'current-password'
|
|
596
|
-
| 'email'
|
|
597
|
-
| 'family-name'
|
|
598
|
-
| 'gender'
|
|
599
|
-
| 'given-name'
|
|
600
|
-
| 'honorific-prefix'
|
|
601
|
-
| 'honorific-suffix'
|
|
602
|
-
| 'name'
|
|
603
|
-
| 'name-family'
|
|
604
|
-
| 'name-given'
|
|
605
|
-
| 'name-middle'
|
|
606
|
-
| 'name-middle-initial'
|
|
607
|
-
| 'name-prefix'
|
|
608
|
-
| 'name-suffix'
|
|
609
|
-
| 'new-password'
|
|
610
|
-
| 'nickname'
|
|
611
|
-
| 'one-time-code'
|
|
612
|
-
| 'organization'
|
|
613
|
-
| 'organization-title'
|
|
614
|
-
| 'password'
|
|
615
|
-
| 'password-new'
|
|
616
|
-
| 'postal-address'
|
|
617
|
-
| 'postal-address-country'
|
|
618
|
-
| 'postal-address-extended'
|
|
619
|
-
| 'postal-address-extended-postal-code'
|
|
620
|
-
| 'postal-address-locality'
|
|
621
|
-
| 'postal-address-region'
|
|
622
|
-
| 'postal-code'
|
|
623
|
-
| 'street-address'
|
|
624
|
-
| 'sms-otp'
|
|
625
|
-
| 'tel'
|
|
626
|
-
| 'tel-country-code'
|
|
627
|
-
| 'tel-national'
|
|
628
|
-
| 'tel-device'
|
|
629
|
-
| 'url'
|
|
630
|
-
| 'username'
|
|
631
|
-
| 'username-new'
|
|
632
|
-
| 'off'
|
|
633
|
-
),
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* If `false`, disables auto-correct. The default value is `true`.
|
|
637
|
-
*/
|
|
638
|
-
autoCorrect?: ?boolean,
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* If `true`, focuses the input on `componentDidMount`.
|
|
642
|
-
* The default value is `false`.
|
|
643
|
-
*/
|
|
644
|
-
autoFocus?: ?boolean,
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Specifies whether fonts should scale to respect Text Size accessibility settings. The
|
|
648
|
-
* default is `true`.
|
|
649
|
-
*/
|
|
650
|
-
allowFontScaling?: ?boolean,
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* If `true`, caret is hidden. The default value is `false`.
|
|
654
|
-
*
|
|
655
|
-
* On Android devices manufactured by Xiaomi with Android Q,
|
|
656
|
-
* when keyboardType equals 'email-address'this will be set
|
|
657
|
-
* in native to 'true' to prevent a system related crash. This
|
|
658
|
-
* will cause cursor to be disabled as a side-effect.
|
|
659
|
-
*
|
|
660
|
-
*/
|
|
661
|
-
caretHidden?: ?boolean,
|
|
662
|
-
|
|
663
|
-
/*
|
|
664
|
-
* If `true`, contextMenuHidden is hidden. The default value is `false`.
|
|
665
|
-
*/
|
|
666
|
-
contextMenuHidden?: ?boolean,
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
* Provides an initial value that will change when the user starts typing.
|
|
670
|
-
* Useful for simple use-cases where you do not want to deal with listening
|
|
671
|
-
* to events and updating the value prop to keep the controlled state in sync.
|
|
672
|
-
*/
|
|
673
|
-
defaultValue?: ?Stringish,
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* If `false`, text is not editable. The default value is `true`.
|
|
677
|
-
*/
|
|
678
|
-
editable?: ?boolean,
|
|
679
|
-
|
|
680
|
-
forwardedRef?: ?React.RefSetter<TextInputInstance>,
|
|
681
|
-
|
|
682
|
-
/**
|
|
683
|
-
* `enterKeyHint` defines what action label (or icon) to present for the enter key on virtual keyboards.
|
|
684
|
-
*
|
|
685
|
-
* The following values is supported:
|
|
686
|
-
*
|
|
687
|
-
* - `enter`
|
|
688
|
-
* - `done`
|
|
689
|
-
* - `go`
|
|
690
|
-
* - `next`
|
|
691
|
-
* - `previous`
|
|
692
|
-
* - `search`
|
|
693
|
-
* - `send`
|
|
694
|
-
*/
|
|
695
|
-
enterKeyHint?: ?EnterKeyHintTypeOptions,
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* `inputMode` works like the `inputmode` attribute in HTML, it determines which
|
|
699
|
-
* keyboard to open, e.g.`numeric` and has precedence over keyboardType
|
|
700
|
-
*
|
|
701
|
-
* Support the following values:
|
|
702
|
-
*
|
|
703
|
-
* - `none`
|
|
704
|
-
* - `text`
|
|
705
|
-
* - `decimal`
|
|
706
|
-
* - `numeric`
|
|
707
|
-
* - `tel`
|
|
708
|
-
* - `search`
|
|
709
|
-
* - `email`
|
|
710
|
-
* - `url`
|
|
711
|
-
*/
|
|
712
|
-
inputMode?: ?InputModeOptions,
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Determines which keyboard to open, e.g.`numeric`.
|
|
716
|
-
*
|
|
717
|
-
* The following values work across platforms:
|
|
718
|
-
*
|
|
719
|
-
* - `default`
|
|
720
|
-
* - `numeric`
|
|
721
|
-
* - `number-pad`
|
|
722
|
-
* - `decimal-pad`
|
|
723
|
-
* - `email-address`
|
|
724
|
-
* - `phone-pad`
|
|
725
|
-
* - `url`
|
|
726
|
-
*
|
|
727
|
-
* *iOS Only*
|
|
728
|
-
*
|
|
729
|
-
* The following values work on iOS only:
|
|
730
|
-
*
|
|
731
|
-
* - `ascii-capable`
|
|
732
|
-
* - `numbers-and-punctuation`
|
|
733
|
-
* - `name-phone-pad`
|
|
734
|
-
* - `twitter`
|
|
735
|
-
* - `web-search`
|
|
736
|
-
*
|
|
737
|
-
* *Android Only*
|
|
738
|
-
*
|
|
739
|
-
* The following values work on Android only:
|
|
740
|
-
*
|
|
741
|
-
* - `visible-password`
|
|
742
|
-
*
|
|
743
|
-
*/
|
|
744
|
-
keyboardType?: ?KeyboardTypeOptions,
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* Specifies largest possible scale a font can reach when `allowFontScaling` is enabled.
|
|
748
|
-
* Possible values:
|
|
749
|
-
* `null/undefined` (default): inherit from the parent node or the global default (0)
|
|
750
|
-
* `0`: no max, ignore parent/global default
|
|
751
|
-
* `>= 1`: sets the maxFontSizeMultiplier of this node to this value
|
|
752
|
-
*/
|
|
753
|
-
maxFontSizeMultiplier?: ?number,
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* Limits the maximum number of characters that can be entered. Use this
|
|
757
|
-
* instead of implementing the logic in JS to avoid flicker.
|
|
758
|
-
*/
|
|
759
|
-
maxLength?: ?number,
|
|
760
|
-
|
|
761
|
-
/**
|
|
762
|
-
* If `true`, the text input can be multiple lines.
|
|
763
|
-
* The default value is `false`.
|
|
764
|
-
*/
|
|
765
|
-
multiline?: ?boolean,
|
|
766
|
-
|
|
767
|
-
/**
|
|
768
|
-
* Callback that is called when the text input is blurred.
|
|
769
|
-
*/
|
|
770
|
-
onBlur?: ?(e: TextInputBlurEvent) => mixed,
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* Callback that is called when the text input's text changes.
|
|
774
|
-
*/
|
|
775
|
-
onChange?: ?(e: TextInputChangeEvent) => mixed,
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* Callback that is called when the text input's text changes.
|
|
779
|
-
* Changed text is passed as an argument to the callback handler.
|
|
780
|
-
*/
|
|
781
|
-
onChangeText?: ?(text: string) => mixed,
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Callback that is called when the text input's content size changes.
|
|
785
|
-
* This will be called with
|
|
786
|
-
* `{ nativeEvent: { contentSize: { width, height } } }`.
|
|
787
|
-
*
|
|
788
|
-
* Only called for multiline text inputs.
|
|
789
|
-
*/
|
|
790
|
-
onContentSizeChange?: ?(e: TextInputContentSizeChangeEvent) => mixed,
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* Callback that is called when text input ends.
|
|
794
|
-
*/
|
|
795
|
-
onEndEditing?: ?(e: TextInputEditingEvent) => mixed,
|
|
796
|
-
|
|
797
|
-
/**
|
|
798
|
-
* Callback that is called when the text input is focused.
|
|
799
|
-
*/
|
|
800
|
-
onFocus?: ?(e: TextInputFocusEvent) => mixed,
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Callback that is called when a key is pressed.
|
|
804
|
-
* This will be called with `{ nativeEvent: { key: keyValue } }`
|
|
805
|
-
* where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and
|
|
806
|
-
* the typed-in character otherwise including `' '` for space.
|
|
807
|
-
* Fires before `onChange` callbacks.
|
|
808
|
-
*/
|
|
809
|
-
onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed,
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* Called when a single tap gesture is detected.
|
|
813
|
-
*/
|
|
814
|
-
onPress?: ?(event: GestureResponderEvent) => mixed,
|
|
815
|
-
|
|
816
|
-
/**
|
|
817
|
-
* Called when a touch is engaged.
|
|
818
|
-
*/
|
|
819
|
-
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
|
820
|
-
|
|
821
|
-
/**
|
|
822
|
-
* Called when a touch is released.
|
|
823
|
-
*/
|
|
824
|
-
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
|
825
|
-
|
|
826
|
-
/**
|
|
827
|
-
* Callback that is called when the text input selection is changed.
|
|
828
|
-
* This will be called with
|
|
829
|
-
* `{ nativeEvent: { selection: { start, end } } }`.
|
|
830
|
-
*/
|
|
831
|
-
onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => mixed,
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* Callback that is called when the text input's submit button is pressed.
|
|
835
|
-
* Invalid if `multiline={true}` is specified.
|
|
836
|
-
*/
|
|
837
|
-
onSubmitEditing?: ?(e: TextInputEditingEvent) => mixed,
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
|
|
841
|
-
* May also contain other properties from ScrollEvent but on Android contentSize
|
|
842
|
-
* is not provided for performance reasons.
|
|
843
|
-
*/
|
|
844
|
-
onScroll?: ?(e: ScrollEvent) => mixed,
|
|
845
|
-
|
|
846
|
-
/**
|
|
847
|
-
* The string that will be rendered before text input has been entered.
|
|
848
|
-
*/
|
|
849
|
-
placeholder?: ?Stringish,
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* The text color of the placeholder string.
|
|
853
|
-
*/
|
|
854
|
-
placeholderTextColor?: ?ColorValue,
|
|
855
|
-
|
|
856
|
-
/** `readOnly` works like the `readonly` attribute in HTML.
|
|
857
|
-
* If `true`, text is not editable. The default value is `false`.
|
|
858
|
-
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
|
|
859
|
-
* for more details.
|
|
860
|
-
*/
|
|
861
|
-
readOnly?: ?boolean,
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* Determines how the return key should look. On Android you can also use
|
|
865
|
-
* `returnKeyLabel`.
|
|
866
|
-
*
|
|
867
|
-
* *Cross platform*
|
|
868
|
-
*
|
|
869
|
-
* The following values work across platforms:
|
|
870
|
-
*
|
|
871
|
-
* - `done`
|
|
872
|
-
* - `go`
|
|
873
|
-
* - `next`
|
|
874
|
-
* - `search`
|
|
875
|
-
* - `send`
|
|
876
|
-
*
|
|
877
|
-
* *Android Only*
|
|
878
|
-
*
|
|
879
|
-
* The following values work on Android only:
|
|
880
|
-
*
|
|
881
|
-
* - `none`
|
|
882
|
-
* - `previous`
|
|
883
|
-
*
|
|
884
|
-
* *iOS Only*
|
|
885
|
-
*
|
|
886
|
-
* The following values work on iOS only:
|
|
887
|
-
*
|
|
888
|
-
* - `default`
|
|
889
|
-
* - `emergency-call`
|
|
890
|
-
* - `google`
|
|
891
|
-
* - `join`
|
|
892
|
-
* - `route`
|
|
893
|
-
* - `yahoo`
|
|
894
|
-
*/
|
|
895
|
-
returnKeyType?: ?ReturnKeyTypeOptions,
|
|
896
|
-
|
|
897
|
-
/**
|
|
898
|
-
* If `true`, the text input obscures the text entered so that sensitive text
|
|
899
|
-
* like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'.
|
|
900
|
-
*/
|
|
901
|
-
secureTextEntry?: ?boolean,
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* The start and end of the text input's selection. Set start and end to
|
|
905
|
-
* the same value to position the cursor.
|
|
906
|
-
*/
|
|
907
|
-
selection?: ?$ReadOnly<{
|
|
908
|
-
start: number,
|
|
909
|
-
end?: ?number,
|
|
910
|
-
}>,
|
|
911
|
-
|
|
912
|
-
/**
|
|
913
|
-
* The highlight and cursor color of the text input.
|
|
914
|
-
*/
|
|
915
|
-
selectionColor?: ?ColorValue,
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* The text selection handle color.
|
|
919
|
-
* @platform android
|
|
920
|
-
*/
|
|
921
|
-
selectionHandleColor?: ?ColorValue,
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* If `true`, all text will automatically be selected on focus.
|
|
925
|
-
*/
|
|
926
|
-
selectTextOnFocus?: ?boolean,
|
|
87
|
+
export type {
|
|
88
|
+
AutoCapitalize,
|
|
89
|
+
EnterKeyHintType,
|
|
90
|
+
EnterKeyHintTypeAndroid,
|
|
91
|
+
EnterKeyHintTypeIOS,
|
|
92
|
+
EnterKeyHintTypeOptions,
|
|
93
|
+
InputModeOptions,
|
|
94
|
+
KeyboardType,
|
|
95
|
+
KeyboardTypeAndroid,
|
|
96
|
+
KeyboardTypeIOS,
|
|
97
|
+
KeyboardTypeOptions,
|
|
98
|
+
ReturnKeyType,
|
|
99
|
+
ReturnKeyTypeAndroid,
|
|
100
|
+
ReturnKeyTypeIOS,
|
|
101
|
+
ReturnKeyTypeOptions,
|
|
102
|
+
SubmitBehavior,
|
|
103
|
+
TextContentType,
|
|
104
|
+
TextInputAndroidProps,
|
|
105
|
+
TextInputBlurEvent,
|
|
106
|
+
TextInputChangeEvent,
|
|
107
|
+
TextInputContentSizeChangeEvent,
|
|
108
|
+
TextInputEditingEvent,
|
|
109
|
+
TextInputEndEditingEvent,
|
|
110
|
+
TextInputEvent,
|
|
111
|
+
TextInputFocusEvent,
|
|
112
|
+
TextInputIOSProps,
|
|
113
|
+
TextInputKeyPressEvent,
|
|
114
|
+
TextInputProps,
|
|
115
|
+
TextInputSelectionChangeEvent,
|
|
116
|
+
TextInputSubmitEditingEvent,
|
|
117
|
+
};
|
|
927
118
|
|
|
119
|
+
type TextInputStateType = $ReadOnly<{
|
|
928
120
|
/**
|
|
929
|
-
*
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
* to `true` means that pressing return will blur the field and trigger the
|
|
933
|
-
* `onSubmitEditing` event instead of inserting a newline into the field.
|
|
934
|
-
*
|
|
935
|
-
* @deprecated
|
|
936
|
-
* Note that `submitBehavior` now takes the place of `blurOnSubmit` and will
|
|
937
|
-
* override any behavior defined by `blurOnSubmit`.
|
|
938
|
-
* @see submitBehavior
|
|
121
|
+
* @deprecated Use currentlyFocusedInput
|
|
122
|
+
* Returns the ID of the currently focused text field, if one exists
|
|
123
|
+
* If no text field is focused it returns null
|
|
939
124
|
*/
|
|
940
|
-
|
|
125
|
+
currentlyFocusedField: () => ?number,
|
|
941
126
|
|
|
942
127
|
/**
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
* For single line inputs:
|
|
946
|
-
*
|
|
947
|
-
* - `'newline`' defaults to `'blurAndSubmit'`
|
|
948
|
-
* - `undefined` defaults to `'blurAndSubmit'`
|
|
949
|
-
*
|
|
950
|
-
* For multiline inputs:
|
|
951
|
-
*
|
|
952
|
-
* - `'newline'` adds a newline
|
|
953
|
-
* - `undefined` defaults to `'newline'`
|
|
954
|
-
*
|
|
955
|
-
* For both single line and multiline inputs:
|
|
956
|
-
*
|
|
957
|
-
* - `'submit'` will only send a submit event and not blur the input
|
|
958
|
-
* - `'blurAndSubmit`' will both blur the input and send a submit event
|
|
128
|
+
* Returns the ref of the currently focused text field, if one exists
|
|
129
|
+
* If no text field is focused it returns null
|
|
959
130
|
*/
|
|
960
|
-
|
|
131
|
+
currentlyFocusedInput: () => ?HostInstance,
|
|
961
132
|
|
|
962
133
|
/**
|
|
963
|
-
*
|
|
964
|
-
*
|
|
965
|
-
*
|
|
966
|
-
* - `borderTopWidth`
|
|
967
|
-
* - `borderRightWidth`
|
|
968
|
-
* - `borderBottomWidth`
|
|
969
|
-
* - `borderTopLeftRadius`
|
|
970
|
-
* - `borderTopRightRadius`
|
|
971
|
-
* - `borderBottomRightRadius`
|
|
972
|
-
* - `borderBottomLeftRadius`
|
|
973
|
-
*
|
|
974
|
-
* see [Issue#7070](https://github.com/facebook/react-native/issues/7070)
|
|
975
|
-
* for more detail.
|
|
976
|
-
*
|
|
977
|
-
* [Styles](docs/style.html)
|
|
134
|
+
* @param textField ref of the text field to focus
|
|
135
|
+
* Focuses the specified text field
|
|
136
|
+
* noop if the text field was already focused
|
|
978
137
|
*/
|
|
979
|
-
|
|
138
|
+
focusTextInput: (textField: ?HostInstance) => void,
|
|
980
139
|
|
|
981
140
|
/**
|
|
982
|
-
*
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
* cases this may cause flickering - one common cause is preventing edits
|
|
986
|
-
* by keeping value the same. In addition to simply setting the same value,
|
|
987
|
-
* either set `editable={false}`, or set/update `maxLength` to prevent
|
|
988
|
-
* unwanted edits without flicker.
|
|
141
|
+
* @param textField ref of the text field to focus
|
|
142
|
+
* Unfocuses the specified text field
|
|
143
|
+
* noop if it wasn't focused
|
|
989
144
|
*/
|
|
990
|
-
|
|
145
|
+
blurTextInput: (textField: ?HostInstance) => void,
|
|
991
146
|
}>;
|
|
992
147
|
|
|
993
148
|
type ViewCommands = $NonMaybeType<
|
|
@@ -1008,7 +163,7 @@ const emptyFunctionThatReturnsTrue = () => true;
|
|
|
1008
163
|
* in native and in JavaScript. This is necessary due to the asynchronous nature
|
|
1009
164
|
* of text input events.
|
|
1010
165
|
*/
|
|
1011
|
-
function
|
|
166
|
+
function useTextInputStateSynchronization({
|
|
1012
167
|
props,
|
|
1013
168
|
mostRecentEventCount,
|
|
1014
169
|
selection,
|
|
@@ -1084,94 +239,6 @@ function useTextInputStateSynchronization_STATE({
|
|
|
1084
239
|
return {setLastNativeText, setLastNativeSelection};
|
|
1085
240
|
}
|
|
1086
241
|
|
|
1087
|
-
/**
|
|
1088
|
-
* This hook handles the synchronization between the state of the text input
|
|
1089
|
-
* in native and in JavaScript. This is necessary due to the asynchronous nature
|
|
1090
|
-
* of text input events.
|
|
1091
|
-
*/
|
|
1092
|
-
function useTextInputStateSynchronization_REFS({
|
|
1093
|
-
props,
|
|
1094
|
-
mostRecentEventCount,
|
|
1095
|
-
selection,
|
|
1096
|
-
inputRef,
|
|
1097
|
-
text,
|
|
1098
|
-
viewCommands,
|
|
1099
|
-
}: {
|
|
1100
|
-
props: TextInputProps,
|
|
1101
|
-
mostRecentEventCount: number,
|
|
1102
|
-
selection: ?Selection,
|
|
1103
|
-
inputRef: React.RefObject<null | TextInputInstance>,
|
|
1104
|
-
text?: string,
|
|
1105
|
-
viewCommands: ViewCommands,
|
|
1106
|
-
}): {
|
|
1107
|
-
setLastNativeText: string => void,
|
|
1108
|
-
setLastNativeSelection: LastNativeSelection => void,
|
|
1109
|
-
} {
|
|
1110
|
-
const lastNativeTextRef = useRef<?Stringish>(props.value);
|
|
1111
|
-
const lastNativeSelectionRef = useRef<LastNativeSelection>({
|
|
1112
|
-
selection: {start: -1, end: -1},
|
|
1113
|
-
mostRecentEventCount: mostRecentEventCount,
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1116
|
-
// This is necessary in case native updates the text and JS decides
|
|
1117
|
-
// that the update should be ignored and we should stick with the value
|
|
1118
|
-
// that we have in JS.
|
|
1119
|
-
useLayoutEffect(() => {
|
|
1120
|
-
const nativeUpdate: {text?: string, selection?: Selection} = {};
|
|
1121
|
-
|
|
1122
|
-
const lastNativeSelection = lastNativeSelectionRef.current.selection;
|
|
1123
|
-
|
|
1124
|
-
if (
|
|
1125
|
-
lastNativeTextRef.current !== props.value &&
|
|
1126
|
-
typeof props.value === 'string'
|
|
1127
|
-
) {
|
|
1128
|
-
nativeUpdate.text = props.value;
|
|
1129
|
-
lastNativeTextRef.current = props.value;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
if (
|
|
1133
|
-
selection &&
|
|
1134
|
-
lastNativeSelection &&
|
|
1135
|
-
(lastNativeSelection.start !== selection.start ||
|
|
1136
|
-
lastNativeSelection.end !== selection.end)
|
|
1137
|
-
) {
|
|
1138
|
-
nativeUpdate.selection = selection;
|
|
1139
|
-
lastNativeSelectionRef.current = {selection, mostRecentEventCount};
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
if (Object.keys(nativeUpdate).length === 0) {
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
if (inputRef.current != null) {
|
|
1147
|
-
viewCommands.setTextAndSelection(
|
|
1148
|
-
inputRef.current,
|
|
1149
|
-
mostRecentEventCount,
|
|
1150
|
-
text,
|
|
1151
|
-
selection?.start ?? -1,
|
|
1152
|
-
selection?.end ?? -1,
|
|
1153
|
-
);
|
|
1154
|
-
}
|
|
1155
|
-
}, [
|
|
1156
|
-
mostRecentEventCount,
|
|
1157
|
-
inputRef,
|
|
1158
|
-
props.value,
|
|
1159
|
-
props.defaultValue,
|
|
1160
|
-
selection,
|
|
1161
|
-
text,
|
|
1162
|
-
viewCommands,
|
|
1163
|
-
]);
|
|
1164
|
-
|
|
1165
|
-
return {
|
|
1166
|
-
setLastNativeText: lastNativeText => {
|
|
1167
|
-
lastNativeTextRef.current = lastNativeText;
|
|
1168
|
-
},
|
|
1169
|
-
setLastNativeSelection: lastNativeSelection => {
|
|
1170
|
-
lastNativeSelectionRef.current = lastNativeSelection;
|
|
1171
|
-
},
|
|
1172
|
-
};
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
242
|
/**
|
|
1176
243
|
* A foundational component for inputting text into the app via a
|
|
1177
244
|
* keyboard. Props provide configurability for several features, such as
|
|
@@ -1324,10 +391,6 @@ function InternalTextInput(props: TextInputProps): React.Node {
|
|
|
1324
391
|
: RCTSinglelineTextInputNativeCommands);
|
|
1325
392
|
|
|
1326
393
|
const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
|
|
1327
|
-
const useTextInputStateSynchronization =
|
|
1328
|
-
ReactNativeFeatureFlags.useRefsForTextInputState()
|
|
1329
|
-
? useTextInputStateSynchronization_REFS
|
|
1330
|
-
: useTextInputStateSynchronization_STATE;
|
|
1331
394
|
const {setLastNativeText, setLastNativeSelection} =
|
|
1332
395
|
useTextInputStateSynchronization({
|
|
1333
396
|
props,
|
|
@@ -1383,6 +446,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
|
|
|
1383
446
|
*/
|
|
1384
447
|
if (instance != null) {
|
|
1385
448
|
// $FlowFixMe[prop-missing] - See the explanation above.
|
|
449
|
+
// $FlowFixMe[unsafe-object-assign]
|
|
1386
450
|
Object.assign(instance, {
|
|
1387
451
|
clear(): void {
|
|
1388
452
|
if (inputRef.current != null) {
|
|
@@ -1612,6 +676,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
|
|
|
1612
676
|
ref={(ref: $FlowFixMe)}
|
|
1613
677
|
{...otherProps}
|
|
1614
678
|
{...eventHandlers}
|
|
679
|
+
acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
|
|
1615
680
|
accessibilityState={_accessibilityState}
|
|
1616
681
|
accessible={accessible}
|
|
1617
682
|
submitBehavior={submitBehavior}
|
|
@@ -1678,6 +743,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
|
|
|
1678
743
|
accessibilityState={_accessibilityState}
|
|
1679
744
|
accessibilityLabelledBy={_accessibilityLabelledBy}
|
|
1680
745
|
accessible={accessible}
|
|
746
|
+
acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
|
|
1681
747
|
autoCapitalize={autoCapitalize}
|
|
1682
748
|
submitBehavior={submitBehavior}
|
|
1683
749
|
caretHidden={caretHidden}
|
|
@@ -1806,7 +872,7 @@ const autoCompleteWebToTextContentTypeMap = {
|
|
|
1806
872
|
};
|
|
1807
873
|
|
|
1808
874
|
const ExportedForwardRef: component(
|
|
1809
|
-
ref
|
|
875
|
+
ref?: React.RefSetter<TextInputInstance>,
|
|
1810
876
|
...props: React.ElementConfig<typeof InternalTextInput>
|
|
1811
877
|
) = React.forwardRef(function TextInput(
|
|
1812
878
|
{
|
|
@@ -1878,12 +944,7 @@ ExportedForwardRef.State = {
|
|
|
1878
944
|
};
|
|
1879
945
|
|
|
1880
946
|
export type TextInputComponentStatics = $ReadOnly<{
|
|
1881
|
-
State:
|
|
1882
|
-
currentlyFocusedInput: typeof TextInputState.currentlyFocusedInput,
|
|
1883
|
-
currentlyFocusedField: typeof TextInputState.currentlyFocusedField,
|
|
1884
|
-
focusTextInput: typeof TextInputState.focusTextInput,
|
|
1885
|
-
blurTextInput: typeof TextInputState.blurTextInput,
|
|
1886
|
-
}>,
|
|
947
|
+
State: TextInputStateType,
|
|
1887
948
|
}>;
|
|
1888
949
|
|
|
1889
950
|
const styles = StyleSheet.create({
|