@office-iss/react-native-win32 0.76.2 → 0.77.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/.eslintignore +1 -1
- package/.flowconfig +5 -1
- package/CHANGELOG.json +164 -53
- package/CHANGELOG.md +74 -28
- package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/NativeAnimatedAllowlist.js +20 -9
- package/Libraries/Animated/animations/Animation.js +60 -25
- package/Libraries/Animated/animations/DecayAnimation.js +26 -38
- package/Libraries/Animated/animations/SpringAnimation.js +33 -39
- package/Libraries/Animated/animations/TimingAnimation.js +34 -42
- package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
- package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
- package/Libraries/Animated/createAnimatedComponent.js +60 -33
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +1 -1
- package/Libraries/Animated/nodes/AnimatedNode.js +39 -45
- package/Libraries/Animated/nodes/AnimatedObject.js +13 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +96 -46
- package/Libraries/Animated/nodes/AnimatedStyle.js +108 -39
- package/Libraries/Animated/nodes/AnimatedTransform.js +56 -23
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -3
- package/Libraries/Animated/useAnimatedProps.js +41 -35
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +77 -5
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +82 -5
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +4 -4
- package/Libraries/Components/Button.js +9 -4
- package/Libraries/Components/Button.win32.js +12 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -0
- package/Libraries/Components/Pressable/Pressable.js +4 -4
- package/Libraries/Components/Pressable/Pressable.win32.js +4 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +13 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +3 -2
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +4 -4
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -4
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
- package/Libraries/Components/ScrollView/ScrollView.js +49 -88
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
- package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +8 -9
- package/Libraries/Components/Switch/Switch.js +8 -6
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +4 -4
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +6 -4
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +27 -4
- package/Libraries/Components/TextInput/TextInput.flow.js +36 -19
- package/Libraries/Components/TextInput/TextInput.js +37 -13
- package/Libraries/Components/TextInput/TextInput.win32.js +40 -15
- package/Libraries/Components/TextInput/TextInputState.js +11 -13
- package/Libraries/Components/TextInput/TextInputState.win32.js +13 -16
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +3 -0
- package/Libraries/Components/Touchable/BoundingDimensions.js +11 -3
- package/Libraries/Components/Touchable/Position.js +7 -2
- package/Libraries/Components/Touchable/Touchable.js +4 -0
- package/Libraries/Components/Touchable/Touchable.win32.js +4 -0
- package/Libraries/Components/Touchable/TouchableBounce.js +6 -2
- package/Libraries/Components/Touchable/TouchableHighlight.js +5 -5
- package/Libraries/Components/Touchable/TouchableOpacity.js +6 -5
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -1
- package/Libraries/Components/View/View.js +4 -4
- package/Libraries/Components/View/View.win32.js +4 -4
- package/Libraries/Components/View/ViewNativeComponent.js +6 -98
- package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/Libraries/Components/View/ViewPropTypes.js +0 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +0 -3
- package/Libraries/Components/View/ViewWin32.js +1 -0
- package/Libraries/Core/ExceptionsManager.js +50 -29
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -1
- package/Libraries/Core/setUpBatchedBridge.js +1 -10
- package/Libraries/Core/setUpDeveloperTools.js +1 -5
- package/Libraries/Core/setUpErrorHandling.js +20 -18
- package/Libraries/Core/setUpReactDevTools.js +107 -8
- package/Libraries/Core/setUpSegmentFetcher.js +1 -0
- package/Libraries/Core/setUpTimers.js +21 -18
- package/Libraries/Debugging/DebuggingOverlay.js +4 -5
- package/Libraries/Image/AssetSourceResolver.js +12 -1
- package/Libraries/Image/Image.android.js +1 -5
- package/Libraries/Image/Image.d.ts +20 -29
- package/Libraries/Image/Image.ios.js +0 -2
- package/Libraries/Image/Image.win32.js +0 -2
- package/Libraries/Image/ImageBackground.js +2 -5
- package/Libraries/Image/ImageProps.js +7 -6
- package/Libraries/Image/ImageResizeMode.d.ts +8 -1
- package/Libraries/Image/ImageResizeMode.js +4 -1
- package/Libraries/Image/ImageSource.d.ts +0 -2
- package/Libraries/Image/ImageSource.js +0 -2
- package/Libraries/Image/ImageTypes.flow.js +11 -9
- package/Libraries/Image/ImageUtils.js +6 -3
- package/Libraries/Image/ImageViewNativeComponent.js +5 -3
- package/Libraries/Inspector/Inspector.js +1 -0
- package/Libraries/Inspector/Inspector.win32.js +2 -1
- package/Libraries/Inspector/NetworkOverlay.js +4 -0
- package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -14
- package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +3 -5
- package/Libraries/Interaction/InteractionManager.js +6 -1
- package/Libraries/Interaction/InteractionManagerStub.js +176 -0
- package/Libraries/Interaction/TouchHistoryMath.js +22 -19
- package/Libraries/JSInspector/NetworkAgent.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +1 -2
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +7 -7
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +2 -2
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +3 -3
- package/Libraries/LogBox/LogBox.js +18 -5
- package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
- package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +1 -1
- package/Libraries/LogBox/UI/LogBoxMessage.js +2 -2
- package/Libraries/Modal/Modal.d.ts +12 -0
- package/Libraries/Modal/Modal.js +31 -4
- package/Libraries/NativeComponent/BaseViewConfig.android.js +72 -1
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -1
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +3 -11
- package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -3
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -1
- package/Libraries/Network/XHRInterceptor.js +63 -14
- package/Libraries/Network/XMLHttpRequest.js +26 -1
- package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -4
- package/Libraries/Pressability/HoverState.js +2 -0
- package/Libraries/Pressability/HoverState.win32.js +2 -0
- package/Libraries/Pressability/Pressability.js +2 -3
- package/Libraries/Pressability/Pressability.win32.js +2 -3
- package/Libraries/Pressability/usePressability.js +4 -1
- package/Libraries/ReactNative/AppContainer.js +1 -1
- package/Libraries/ReactNative/AppRegistry.js +1 -11
- package/Libraries/ReactNative/DisplayMode.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -3
- package/Libraries/ReactNative/RendererImplementation.js +18 -17
- package/Libraries/ReactNative/getCachedComponentWithDebugName.js +1 -3
- package/Libraries/ReactNative/renderApplication.js +9 -8
- package/Libraries/ReactNative/requireNativeComponent.js +5 -2
- package/Libraries/Renderer/shims/ReactFabric.js +3 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +3 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +22 -35
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +5 -6
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/StyleSheet/StyleSheet.js +7 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +7 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +13 -2
- package/Libraries/StyleSheet/StyleSheetTypes.js +24 -6
- package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
- package/Libraries/StyleSheet/processTransform.js +3 -34
- package/Libraries/Text/Text.js +248 -249
- package/Libraries/Text/Text.win32.js +282 -295
- package/Libraries/Text/TextNativeComponent.js +0 -1
- package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
- package/Libraries/Types/CoreEventTypes.d.ts +3 -10
- package/Libraries/Types/CoreEventTypes.js +4 -6
- package/Libraries/Types/CoreEventTypes.win32.js +4 -6
- package/Libraries/Utilities/Appearance.js +3 -1
- package/Libraries/Utilities/BackHandler.android.js +6 -18
- package/Libraries/Utilities/BackHandler.d.ts +0 -4
- package/Libraries/Utilities/BackHandler.ios.js +0 -7
- package/Libraries/Utilities/BackHandler.win32.js +6 -18
- package/Libraries/Utilities/FocusManager.win32.js +1 -1
- package/Libraries/Utilities/HMRClient.js +3 -4
- package/Libraries/Utilities/Platform.flow.js +2 -2
- package/Libraries/Utilities/Platform.flow.win32.js +3 -2
- package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/useMergeRefs.js +26 -7
- package/Libraries/WebSocket/WebSocketEvent.js +4 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +6 -5
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/index.js +10 -3
- package/index.win32.js +10 -3
- package/jest/setup.js +36 -1
- package/overrides.json +37 -37
- package/package.json +20 -20
- package/src/private/animated/NativeAnimatedHelper.js +18 -16
- package/src/private/animated/NativeAnimatedHelper.win32.js +18 -15
- package/src/private/animated/useAnimatedPropsMemo.js +348 -0
- package/src/private/components/HScrollViewNativeComponents.js +1 -27
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +11 -8
- package/src/private/components/VScrollViewNativeComponents.js +2 -25
- package/src/private/debugging/ReactDevToolsSettingsManager.android.js +20 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.ios.js +30 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.win32.js +20 -0
- package/src/private/{fusebox → debugging}/setUpFuseboxReactDevToolsDispatcher.js +6 -0
- package/src/private/devmenu/DevMenu.d.ts +20 -0
- package/src/private/devmenu/DevMenu.js +31 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +95 -86
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +8 -2
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -19
- package/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js +34 -0
- package/src/private/setup/setUpDOM.js +14 -6
- package/src/private/setup/setUpMutationObserver.js +5 -0
- package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
- package/src/private/specs/modules/NativeAccessibilityInfo.js +9 -0
- package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +9 -0
- package/src/private/specs/modules/NativeAccessibilityManager.js +4 -0
- package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
- package/src/private/specs/modules/NativeAppearance.js +4 -10
- package/src/private/specs/modules/NativeExceptionsManager.js +0 -12
- package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
- package/src/private/webapis/dom/geometry/DOMRect.js +2 -2
- package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +2 -2
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -3
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +102 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
- package/src/private/webapis/performance/EventTiming.js +13 -8
- package/src/private/webapis/performance/Performance.js +66 -73
- package/src/private/webapis/performance/PerformanceEntry.js +2 -5
- package/src/private/webapis/performance/PerformanceObserver.js +65 -164
- package/src/private/webapis/performance/RawPerformanceEntry.js +1 -1
- package/src/private/webapis/performance/UserTiming.js +11 -7
- package/src/private/webapis/performance/Utilities.js +18 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +71 -2
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +267 -0
- package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/types/index.d.ts +1 -1
- package/types/public/ReactNativeTypes.d.ts +4 -8
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +0 -35
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +0 -20
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +0 -49
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +0 -35
- package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +0 -13
- package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
- package/src/private/components/useSyncOnScroll.js +0 -48
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +0 -61
- package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +0 -67
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +0 -127
- package/types/experimental.d.ts +0 -59
- /package/src/private/{fusebox → debugging}/FuseboxSessionObserver.js +0 -0
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
12
|
import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes';
|
|
13
13
|
import type {
|
|
14
14
|
PressEvent,
|
|
@@ -37,10 +37,10 @@ import * as React from 'react';
|
|
|
37
37
|
import {useCallback, useLayoutEffect, useRef, useState} from 'react';
|
|
38
38
|
|
|
39
39
|
type ReactRefSetter<T> = {current: null | T, ...} | ((ref: null | T) => mixed);
|
|
40
|
-
type TextInputInstance =
|
|
40
|
+
type TextInputInstance = HostInstance & {
|
|
41
41
|
+clear: () => void,
|
|
42
42
|
+isFocused: () => boolean,
|
|
43
|
-
+getNativeRef: () => ?
|
|
43
|
+
+getNativeRef: () => ?HostInstance,
|
|
44
44
|
+setSelection: (start: number, end: number) => void,
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -238,7 +238,12 @@ export type TextContentType =
|
|
|
238
238
|
| 'birthdate'
|
|
239
239
|
| 'birthdateDay'
|
|
240
240
|
| 'birthdateMonth'
|
|
241
|
-
| 'birthdateYear'
|
|
241
|
+
| 'birthdateYear'
|
|
242
|
+
| 'cellularEID'
|
|
243
|
+
| 'cellularIMEI'
|
|
244
|
+
| 'dateTime'
|
|
245
|
+
| 'flightNumber'
|
|
246
|
+
| 'shipmentTrackingNumber';
|
|
242
247
|
|
|
243
248
|
export type enterKeyHintType =
|
|
244
249
|
// Cross Platform
|
|
@@ -305,6 +310,12 @@ type IOSProps = $ReadOnly<{|
|
|
|
305
310
|
*/
|
|
306
311
|
inputAccessoryViewID?: ?string,
|
|
307
312
|
|
|
313
|
+
/**
|
|
314
|
+
* An optional label that overrides the default input accessory view button label.
|
|
315
|
+
* @platform ios
|
|
316
|
+
*/
|
|
317
|
+
inputAccessoryViewButtonLabel?: ?string,
|
|
318
|
+
|
|
308
319
|
/**
|
|
309
320
|
* Determines the color of the keyboard.
|
|
310
321
|
* @platform ios
|
|
@@ -358,6 +369,19 @@ type IOSProps = $ReadOnly<{|
|
|
|
358
369
|
*/
|
|
359
370
|
lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
|
|
360
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Set line break mode on iOS.
|
|
374
|
+
* @platform ios
|
|
375
|
+
*/
|
|
376
|
+
lineBreakModeIOS?: ?(
|
|
377
|
+
| 'wordWrapping'
|
|
378
|
+
| 'char'
|
|
379
|
+
| 'clip'
|
|
380
|
+
| 'head'
|
|
381
|
+
| 'middle'
|
|
382
|
+
| 'tail'
|
|
383
|
+
),
|
|
384
|
+
|
|
361
385
|
/**
|
|
362
386
|
* If `false`, the iOS system will not insert an extra space after a paste operation
|
|
363
387
|
* neither delete one or two spaces after a cut or delete operation.
|
|
@@ -988,7 +1012,7 @@ function useTextInputStateSynchronization_STATE({
|
|
|
988
1012
|
props: Props,
|
|
989
1013
|
mostRecentEventCount: number,
|
|
990
1014
|
selection: ?Selection,
|
|
991
|
-
inputRef: React.RefObject<null |
|
|
1015
|
+
inputRef: React.RefObject<null | HostInstance>,
|
|
992
1016
|
text: string,
|
|
993
1017
|
viewCommands: ViewCommands,
|
|
994
1018
|
}): {
|
|
@@ -1069,7 +1093,7 @@ function useTextInputStateSynchronization_REFS({
|
|
|
1069
1093
|
props: Props,
|
|
1070
1094
|
mostRecentEventCount: number,
|
|
1071
1095
|
selection: ?Selection,
|
|
1072
|
-
inputRef: React.RefObject<null |
|
|
1096
|
+
inputRef: React.RefObject<null | HostInstance>,
|
|
1073
1097
|
text: string,
|
|
1074
1098
|
viewCommands: ViewCommands,
|
|
1075
1099
|
}): {
|
|
@@ -1269,7 +1293,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1269
1293
|
...otherProps
|
|
1270
1294
|
} = props;
|
|
1271
1295
|
|
|
1272
|
-
const inputRef = useRef<null |
|
|
1296
|
+
const inputRef = useRef<null | HostInstance>(null);
|
|
1273
1297
|
|
|
1274
1298
|
const selection: ?Selection =
|
|
1275
1299
|
propsSelection == null
|
|
@@ -1367,7 +1391,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1367
1391
|
isFocused(): boolean {
|
|
1368
1392
|
return TextInputState.currentlyFocusedInput() === inputRef.current;
|
|
1369
1393
|
},
|
|
1370
|
-
getNativeRef(): ?
|
|
1394
|
+
getNativeRef(): ?HostInstance {
|
|
1371
1395
|
return inputRef.current;
|
|
1372
1396
|
},
|
|
1373
1397
|
setSelection(start: number, end: number): void {
|
|
@@ -1515,7 +1539,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1515
1539
|
|
|
1516
1540
|
// TextInput handles onBlur and onFocus events
|
|
1517
1541
|
// so omitting onBlur and onFocus pressability handlers here.
|
|
1518
|
-
const {onBlur, onFocus, ...eventHandlers} = usePressability(config)
|
|
1542
|
+
const {onBlur, onFocus, ...eventHandlers} = usePressability(config);
|
|
1519
1543
|
|
|
1520
1544
|
let _accessibilityState;
|
|
1521
1545
|
if (
|
|
@@ -1771,11 +1795,11 @@ const autoCompleteWebToTextContentTypeMap = {
|
|
|
1771
1795
|
username: 'username',
|
|
1772
1796
|
};
|
|
1773
1797
|
|
|
1774
|
-
const ExportedForwardRef:
|
|
1775
|
-
React.
|
|
1776
|
-
|
|
1798
|
+
const ExportedForwardRef: component(
|
|
1799
|
+
ref: React.RefSetter<TextInputInstance>,
|
|
1800
|
+
...props: React.ElementConfig<typeof InternalTextInput>
|
|
1777
1801
|
// $FlowFixMe[incompatible-call]
|
|
1778
|
-
|
|
1802
|
+
) = React.forwardRef(function TextInput(
|
|
1779
1803
|
{
|
|
1780
1804
|
allowFontScaling = true,
|
|
1781
1805
|
rejectResponderTermination = true,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
12
|
import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes';
|
|
13
13
|
import type {
|
|
14
14
|
PressEvent,
|
|
@@ -37,10 +37,10 @@ import * as React from 'react';
|
|
|
37
37
|
import {useCallback, useLayoutEffect, useRef, useState} from 'react';
|
|
38
38
|
|
|
39
39
|
type ReactRefSetter<T> = {current: null | T, ...} | ((ref: null | T) => mixed);
|
|
40
|
-
type TextInputInstance =
|
|
40
|
+
type TextInputInstance = HostInstance & {
|
|
41
41
|
+clear: () => void,
|
|
42
42
|
+isFocused: () => boolean,
|
|
43
|
-
+getNativeRef: () => ?
|
|
43
|
+
+getNativeRef: () => ?HostInstance,
|
|
44
44
|
+setSelection: (start: number, end: number) => void,
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -249,7 +249,12 @@ export type TextContentType =
|
|
|
249
249
|
| 'birthdate'
|
|
250
250
|
| 'birthdateDay'
|
|
251
251
|
| 'birthdateMonth'
|
|
252
|
-
| 'birthdateYear'
|
|
252
|
+
| 'birthdateYear'
|
|
253
|
+
| 'cellularEID'
|
|
254
|
+
| 'cellularIMEI'
|
|
255
|
+
| 'dateTime'
|
|
256
|
+
| 'flightNumber'
|
|
257
|
+
| 'shipmentTrackingNumber';
|
|
253
258
|
|
|
254
259
|
export type enterKeyHintType =
|
|
255
260
|
// Cross Platform
|
|
@@ -316,6 +321,12 @@ type IOSProps = $ReadOnly<{|
|
|
|
316
321
|
*/
|
|
317
322
|
inputAccessoryViewID?: ?string,
|
|
318
323
|
|
|
324
|
+
/**
|
|
325
|
+
* An optional label that overrides the default input accessory view button label.
|
|
326
|
+
* @platform ios
|
|
327
|
+
*/
|
|
328
|
+
inputAccessoryViewButtonLabel?: ?string,
|
|
329
|
+
|
|
319
330
|
/**
|
|
320
331
|
* Determines the color of the keyboard.
|
|
321
332
|
* @platform ios
|
|
@@ -366,6 +377,19 @@ type IOSProps = $ReadOnly<{|
|
|
|
366
377
|
*/
|
|
367
378
|
lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
|
|
368
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Set line break mode on iOS.
|
|
382
|
+
* @platform ios
|
|
383
|
+
*/
|
|
384
|
+
lineBreakModeIOS?: ?(
|
|
385
|
+
| 'wordWrapping'
|
|
386
|
+
| 'char'
|
|
387
|
+
| 'clip'
|
|
388
|
+
| 'head'
|
|
389
|
+
| 'middle'
|
|
390
|
+
| 'tail'
|
|
391
|
+
),
|
|
392
|
+
|
|
369
393
|
/**
|
|
370
394
|
* If `false`, the iOS system will not insert an extra space after a paste operation
|
|
371
395
|
* neither delete one or two spaces after a cut or delete operation.
|
|
@@ -1031,7 +1055,7 @@ function useTextInputStateSynchronization_STATE({
|
|
|
1031
1055
|
props: Props,
|
|
1032
1056
|
mostRecentEventCount: number,
|
|
1033
1057
|
selection: ?Selection,
|
|
1034
|
-
inputRef: React.RefObject<null |
|
|
1058
|
+
inputRef: React.RefObject<null | HostInstance>,
|
|
1035
1059
|
text: string,
|
|
1036
1060
|
viewCommands: ViewCommands,
|
|
1037
1061
|
}): {
|
|
@@ -1112,7 +1136,7 @@ function useTextInputStateSynchronization_REFS({
|
|
|
1112
1136
|
props: Props,
|
|
1113
1137
|
mostRecentEventCount: number,
|
|
1114
1138
|
selection: ?Selection,
|
|
1115
|
-
inputRef: React.RefObject<null |
|
|
1139
|
+
inputRef: React.RefObject<null | HostInstance>,
|
|
1116
1140
|
text: string,
|
|
1117
1141
|
viewCommands: ViewCommands,
|
|
1118
1142
|
}): {
|
|
@@ -1314,7 +1338,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1314
1338
|
...otherProps
|
|
1315
1339
|
} = props;
|
|
1316
1340
|
|
|
1317
|
-
const inputRef = useRef<null |
|
|
1341
|
+
const inputRef = useRef<null | HostInstance>(null);
|
|
1318
1342
|
|
|
1319
1343
|
const selection: ?Selection =
|
|
1320
1344
|
propsSelection == null
|
|
@@ -1332,8 +1356,8 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1332
1356
|
: '';
|
|
1333
1357
|
|
|
1334
1358
|
const viewCommands =
|
|
1335
|
-
WindowsTextInputCommands ||
|
|
1336
|
-
AndroidTextInputCommands ||
|
|
1359
|
+
WindowsTextInputCommands || // [Windows]
|
|
1360
|
+
AndroidTextInputCommands ||
|
|
1337
1361
|
(props.multiline === true
|
|
1338
1362
|
? RCTMultilineTextInputNativeCommands
|
|
1339
1363
|
: RCTSinglelineTextInputNativeCommands);
|
|
@@ -1350,6 +1374,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1350
1374
|
mostRecentEventCount,
|
|
1351
1375
|
selection,
|
|
1352
1376
|
text,
|
|
1377
|
+
// $FlowFixMe[incompatible-call]
|
|
1353
1378
|
viewCommands,
|
|
1354
1379
|
});
|
|
1355
1380
|
|
|
@@ -1417,7 +1442,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1417
1442
|
currentlyFocusedInput === inputRef.current
|
|
1418
1443
|
);
|
|
1419
1444
|
},
|
|
1420
|
-
getNativeRef(): ?
|
|
1445
|
+
getNativeRef(): ?HostInstance {
|
|
1421
1446
|
return inputRef.current;
|
|
1422
1447
|
},
|
|
1423
1448
|
setSelection(start: number, end: number): void {
|
|
@@ -1571,7 +1596,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1571
1596
|
|
|
1572
1597
|
// TextInput handles onBlur and onFocus events
|
|
1573
1598
|
// so omitting onBlur and onFocus pressability handlers here.
|
|
1574
|
-
const {onBlur, onFocus, ...eventHandlers} = usePressability(config)
|
|
1599
|
+
const {onBlur, onFocus, ...eventHandlers} = usePressability(config);
|
|
1575
1600
|
const eventPhase = Object.freeze({Capturing: 1, Bubbling: 3});
|
|
1576
1601
|
const _keyDown = (event: KeyEvent) => {
|
|
1577
1602
|
if (props.keyDownEvents && event.isPropagationStopped() !== true) {
|
|
@@ -1911,11 +1936,11 @@ const autoCompleteWebToTextContentTypeMap = {
|
|
|
1911
1936
|
username: 'username',
|
|
1912
1937
|
};
|
|
1913
1938
|
|
|
1914
|
-
const ExportedForwardRef:
|
|
1915
|
-
React.
|
|
1916
|
-
|
|
1939
|
+
const ExportedForwardRef: component(
|
|
1940
|
+
ref: React.RefSetter<TextInputInstance>,
|
|
1941
|
+
...props: React.ElementConfig<typeof InternalTextInput>
|
|
1917
1942
|
// $FlowFixMe[incompatible-call]
|
|
1918
|
-
|
|
1943
|
+
) = React.forwardRef(function TextInput(
|
|
1919
1944
|
{
|
|
1920
1945
|
allowFontScaling = true,
|
|
1921
1946
|
rejectResponderTermination = true,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// through here.
|
|
14
14
|
|
|
15
15
|
import type {
|
|
16
|
-
|
|
16
|
+
HostInstance,
|
|
17
17
|
MeasureInWindowOnSuccessCallback,
|
|
18
18
|
MeasureLayoutOnSuccessCallback,
|
|
19
19
|
MeasureOnSuccessCallback,
|
|
@@ -24,24 +24,22 @@ import {Commands as iOSTextInputCommands} from '../../Components/TextInput/RCTSi
|
|
|
24
24
|
|
|
25
25
|
const {findNodeHandle} = require('../../ReactNative/RendererProxy');
|
|
26
26
|
const Platform = require('../../Utilities/Platform');
|
|
27
|
-
const React = require('react');
|
|
28
|
-
type ComponentRef = React.ElementRef<HostComponent<mixed>>;
|
|
29
27
|
|
|
30
|
-
let currentlyFocusedInputRef: ?
|
|
28
|
+
let currentlyFocusedInputRef: ?HostInstance = null;
|
|
31
29
|
const inputs = new Set<{
|
|
32
30
|
blur(): void,
|
|
33
31
|
focus(): void,
|
|
34
32
|
measure(callback: MeasureOnSuccessCallback): void,
|
|
35
33
|
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void,
|
|
36
34
|
measureLayout(
|
|
37
|
-
relativeToNativeNode: number |
|
|
35
|
+
relativeToNativeNode: number | HostInstance,
|
|
38
36
|
onSuccess: MeasureLayoutOnSuccessCallback,
|
|
39
37
|
onFail?: () => void,
|
|
40
38
|
): void,
|
|
41
39
|
setNativeProps(nativeProps: {...}): void,
|
|
42
40
|
}>();
|
|
43
41
|
|
|
44
|
-
function currentlyFocusedInput(): ?
|
|
42
|
+
function currentlyFocusedInput(): ?HostInstance {
|
|
45
43
|
return currentlyFocusedInputRef;
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -59,13 +57,13 @@ function currentlyFocusedField(): ?number {
|
|
|
59
57
|
return findNodeHandle(currentlyFocusedInputRef);
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
function focusInput(textField: ?
|
|
60
|
+
function focusInput(textField: ?HostInstance): void {
|
|
63
61
|
if (currentlyFocusedInputRef !== textField && textField != null) {
|
|
64
62
|
currentlyFocusedInputRef = textField;
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
function blurInput(textField: ?
|
|
66
|
+
function blurInput(textField: ?HostInstance): void {
|
|
69
67
|
if (currentlyFocusedInputRef === textField && textField != null) {
|
|
70
68
|
currentlyFocusedInputRef = null;
|
|
71
69
|
}
|
|
@@ -92,7 +90,7 @@ function blurField(textFieldID: ?number) {
|
|
|
92
90
|
* Focuses the specified text field
|
|
93
91
|
* noop if the text field was already focused or if the field is not editable
|
|
94
92
|
*/
|
|
95
|
-
function focusTextInput(textField: ?
|
|
93
|
+
function focusTextInput(textField: ?HostInstance) {
|
|
96
94
|
if (typeof textField === 'number') {
|
|
97
95
|
if (__DEV__) {
|
|
98
96
|
console.error(
|
|
@@ -131,7 +129,7 @@ function focusTextInput(textField: ?ComponentRef) {
|
|
|
131
129
|
* Unfocuses the specified text field
|
|
132
130
|
* noop if it wasn't focused
|
|
133
131
|
*/
|
|
134
|
-
function blurTextInput(textField: ?
|
|
132
|
+
function blurTextInput(textField: ?HostInstance) {
|
|
135
133
|
if (typeof textField === 'number') {
|
|
136
134
|
if (__DEV__) {
|
|
137
135
|
console.error(
|
|
@@ -157,7 +155,7 @@ function blurTextInput(textField: ?ComponentRef) {
|
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
|
|
160
|
-
function registerInput(textField:
|
|
158
|
+
function registerInput(textField: HostInstance) {
|
|
161
159
|
if (typeof textField === 'number') {
|
|
162
160
|
if (__DEV__) {
|
|
163
161
|
console.error(
|
|
@@ -171,7 +169,7 @@ function registerInput(textField: ComponentRef) {
|
|
|
171
169
|
inputs.add(textField);
|
|
172
170
|
}
|
|
173
171
|
|
|
174
|
-
function unregisterInput(textField:
|
|
172
|
+
function unregisterInput(textField: HostInstance) {
|
|
175
173
|
if (typeof textField === 'number') {
|
|
176
174
|
if (__DEV__) {
|
|
177
175
|
console.error(
|
|
@@ -184,7 +182,7 @@ function unregisterInput(textField: ComponentRef) {
|
|
|
184
182
|
inputs.delete(textField);
|
|
185
183
|
}
|
|
186
184
|
|
|
187
|
-
function isTextInput(textField:
|
|
185
|
+
function isTextInput(textField: HostInstance): boolean {
|
|
188
186
|
if (typeof textField === 'number') {
|
|
189
187
|
if (__DEV__) {
|
|
190
188
|
console.error(
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// through here.
|
|
14
14
|
|
|
15
15
|
import type {
|
|
16
|
-
|
|
16
|
+
HostInstance,
|
|
17
17
|
MeasureInWindowOnSuccessCallback,
|
|
18
18
|
MeasureLayoutOnSuccessCallback,
|
|
19
19
|
MeasureOnSuccessCallback,
|
|
@@ -25,25 +25,22 @@ import {Commands as Win32TextInputCommands} from '../../Components/TextInput/Win
|
|
|
25
25
|
|
|
26
26
|
const {findNodeHandle} = require('../../ReactNative/RendererProxy');
|
|
27
27
|
const Platform = require('../../Utilities/Platform');
|
|
28
|
-
const React = require('react');
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let currentlyFocusedInputRef: ?ComponentRef = null;
|
|
29
|
+
let currentlyFocusedInputRef: ?HostInstance = null;
|
|
33
30
|
const inputs = new Set<{
|
|
34
31
|
blur(): void,
|
|
35
32
|
focus(): void,
|
|
36
33
|
measure(callback: MeasureOnSuccessCallback): void,
|
|
37
34
|
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void,
|
|
38
35
|
measureLayout(
|
|
39
|
-
relativeToNativeNode: number |
|
|
36
|
+
relativeToNativeNode: number | HostInstance,
|
|
40
37
|
onSuccess: MeasureLayoutOnSuccessCallback,
|
|
41
38
|
onFail?: () => void,
|
|
42
39
|
): void,
|
|
43
40
|
setNativeProps(nativeProps: {...}): void,
|
|
44
41
|
}>();
|
|
45
42
|
|
|
46
|
-
function currentlyFocusedInput(): ?
|
|
43
|
+
function currentlyFocusedInput(): ?HostInstance {
|
|
47
44
|
return currentlyFocusedInputRef;
|
|
48
45
|
}
|
|
49
46
|
|
|
@@ -61,13 +58,13 @@ function currentlyFocusedField(): ?number {
|
|
|
61
58
|
return findNodeHandle(currentlyFocusedInputRef);
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
function focusInput(textField: ?
|
|
61
|
+
function focusInput(textField: ?HostInstance): void {
|
|
65
62
|
if (currentlyFocusedInputRef !== textField && textField != null) {
|
|
66
63
|
currentlyFocusedInputRef = textField;
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
function blurInput(textField: ?
|
|
67
|
+
function blurInput(textField: ?HostInstance): void {
|
|
71
68
|
if (currentlyFocusedInputRef === textField && textField != null) {
|
|
72
69
|
currentlyFocusedInputRef = null;
|
|
73
70
|
}
|
|
@@ -94,7 +91,7 @@ function blurField(textFieldID: ?number) {
|
|
|
94
91
|
* Focuses the specified text field
|
|
95
92
|
* noop if the text field was already focused or if the field is not editable
|
|
96
93
|
*/
|
|
97
|
-
function focusTextInput(textField: ?
|
|
94
|
+
function focusTextInput(textField: ?HostInstance) {
|
|
98
95
|
if (typeof textField === 'number') {
|
|
99
96
|
if (__DEV__) {
|
|
100
97
|
console.error(
|
|
@@ -142,7 +139,7 @@ function focusTextInput(textField: ?ComponentRef) {
|
|
|
142
139
|
* Unfocuses the specified text field
|
|
143
140
|
* noop if it wasn't focused
|
|
144
141
|
*/
|
|
145
|
-
function blurTextInput(textField: ?
|
|
142
|
+
function blurTextInput(textField: ?HostInstance) {
|
|
146
143
|
if (typeof textField === 'number') {
|
|
147
144
|
if (__DEV__) {
|
|
148
145
|
console.error(
|
|
@@ -179,7 +176,7 @@ function blurTextInput(textField: ?ComponentRef) {
|
|
|
179
176
|
* Should be called after the view has received focus and fired the onFocus event
|
|
180
177
|
* noop if the focused text field is same
|
|
181
178
|
*/
|
|
182
|
-
function setFocusedTextInput(textField:
|
|
179
|
+
function setFocusedTextInput(textField: HostInstance) {
|
|
183
180
|
if (currentlyFocusedInputRef !== textField && textField !== null) {
|
|
184
181
|
currentlyFocusedInputRef = textField;
|
|
185
182
|
}
|
|
@@ -190,14 +187,14 @@ function setFocusedTextInput(textField: ComponentRef) {
|
|
|
190
187
|
* Should be called after the view has cleared focus and fired the onFocus event
|
|
191
188
|
* noop if the focused text field is not same
|
|
192
189
|
*/
|
|
193
|
-
function clearFocusedTextInput(textField:
|
|
190
|
+
function clearFocusedTextInput(textField: HostInstance) {
|
|
194
191
|
if (currentlyFocusedInputRef === textField && textField !== null) {
|
|
195
192
|
currentlyFocusedInputRef = null;
|
|
196
193
|
}
|
|
197
194
|
}
|
|
198
195
|
// Win32]
|
|
199
196
|
|
|
200
|
-
function registerInput(textField:
|
|
197
|
+
function registerInput(textField: HostInstance) {
|
|
201
198
|
if (typeof textField === 'number') {
|
|
202
199
|
if (__DEV__) {
|
|
203
200
|
console.error(
|
|
@@ -211,7 +208,7 @@ function registerInput(textField: ComponentRef) {
|
|
|
211
208
|
inputs.add(textField);
|
|
212
209
|
}
|
|
213
210
|
|
|
214
|
-
function unregisterInput(textField:
|
|
211
|
+
function unregisterInput(textField: HostInstance) {
|
|
215
212
|
if (typeof textField === 'number') {
|
|
216
213
|
if (__DEV__) {
|
|
217
214
|
console.error(
|
|
@@ -224,7 +221,7 @@ function unregisterInput(textField: ComponentRef) {
|
|
|
224
221
|
inputs.delete(textField);
|
|
225
222
|
}
|
|
226
223
|
|
|
227
|
-
function isTextInput(textField:
|
|
224
|
+
function isTextInput(textField: HostInstance): boolean {
|
|
228
225
|
if (typeof textField === 'number') {
|
|
229
226
|
if (__DEV__) {
|
|
230
227
|
console.error(
|
|
@@ -8,6 +8,8 @@ import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
|
8
8
|
import requireNativeComponent from '../../ReactNative/requireNativeComponent';
|
|
9
9
|
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
|
|
10
10
|
import type {TextInputNativeCommands} from './TextInputNativeCommands';
|
|
11
|
+
|
|
12
|
+
// $FlowFixMe[incompatible-type-arg]
|
|
11
13
|
type NativeType = HostComponent<mixed>;
|
|
12
14
|
|
|
13
15
|
type NativeCommands = TextInputNativeCommands<NativeType>;
|
|
@@ -17,6 +19,7 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
17
19
|
});
|
|
18
20
|
|
|
19
21
|
const WindowsTextInputComponent: NativeType =
|
|
22
|
+
// $FlowFixMe[incompatible-call]
|
|
20
23
|
requireNativeComponent<mixed>('RCTTextInput');
|
|
21
24
|
|
|
22
25
|
export default WindowsTextInputComponent;
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
+
* @flow strict-local
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
'use strict';
|
|
12
|
+
|
|
11
13
|
import PooledClass from './PooledClass';
|
|
12
14
|
|
|
13
15
|
const twoArgumentPooler = PooledClass.twoArgumentPooler;
|
|
@@ -19,11 +21,14 @@ const twoArgumentPooler = PooledClass.twoArgumentPooler;
|
|
|
19
21
|
* @param {number} height Height of bounding rectangle.
|
|
20
22
|
* @constructor BoundingDimensions
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
// $FlowFixMe[missing-this-annot]
|
|
25
|
+
function BoundingDimensions(width: number, height: number) {
|
|
23
26
|
this.width = width;
|
|
24
27
|
this.height = height;
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
// $FlowFixMe[prop-missing]
|
|
31
|
+
// $FlowFixMe[missing-this-annot]
|
|
27
32
|
BoundingDimensions.prototype.destructor = function () {
|
|
28
33
|
this.width = null;
|
|
29
34
|
this.height = null;
|
|
@@ -33,13 +38,16 @@ BoundingDimensions.prototype.destructor = function () {
|
|
|
33
38
|
* @param {HTMLElement} element Element to return `BoundingDimensions` for.
|
|
34
39
|
* @return {BoundingDimensions} Bounding dimensions of `element`.
|
|
35
40
|
*/
|
|
36
|
-
BoundingDimensions.getPooledFromElement = function (
|
|
41
|
+
BoundingDimensions.getPooledFromElement = function (
|
|
42
|
+
element: HTMLElement,
|
|
43
|
+
): typeof BoundingDimensions {
|
|
44
|
+
// $FlowFixMe[prop-missing]
|
|
37
45
|
return BoundingDimensions.getPooled(
|
|
38
46
|
element.offsetWidth,
|
|
39
47
|
element.offsetHeight,
|
|
40
48
|
);
|
|
41
49
|
};
|
|
42
50
|
|
|
43
|
-
PooledClass.addPoolingTo(BoundingDimensions, twoArgumentPooler);
|
|
51
|
+
PooledClass.addPoolingTo(BoundingDimensions as $FlowFixMe, twoArgumentPooler);
|
|
44
52
|
|
|
45
53
|
module.exports = BoundingDimensions;
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
+
* @flow strict-local
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
'use strict';
|
|
12
|
+
|
|
11
13
|
import PooledClass from './PooledClass';
|
|
12
14
|
|
|
13
15
|
const twoArgumentPooler = PooledClass.twoArgumentPooler;
|
|
@@ -20,16 +22,19 @@ const twoArgumentPooler = PooledClass.twoArgumentPooler;
|
|
|
20
22
|
* @param {number} windowStartKey Key that window starts at.
|
|
21
23
|
* @param {number} windowEndKey Key that window ends at.
|
|
22
24
|
*/
|
|
23
|
-
|
|
25
|
+
// $FlowFixMe[missing-this-annot]
|
|
26
|
+
function Position(left: number, top: number) {
|
|
24
27
|
this.left = left;
|
|
25
28
|
this.top = top;
|
|
26
29
|
}
|
|
27
30
|
|
|
31
|
+
// $FlowFixMe[prop-missing]
|
|
32
|
+
// $FlowFixMe[missing-this-annot]
|
|
28
33
|
Position.prototype.destructor = function () {
|
|
29
34
|
this.left = null;
|
|
30
35
|
this.top = null;
|
|
31
36
|
};
|
|
32
37
|
|
|
33
|
-
PooledClass.addPoolingTo(Position, twoArgumentPooler);
|
|
38
|
+
PooledClass.addPoolingTo(Position as $FlowFixMe, twoArgumentPooler);
|
|
34
39
|
|
|
35
40
|
module.exports = Position;
|
|
@@ -713,13 +713,17 @@ const TouchableMixin = {
|
|
|
713
713
|
return;
|
|
714
714
|
}
|
|
715
715
|
this.state.touchable.positionOnActivate &&
|
|
716
|
+
// $FlowFixMe[prop-missing]
|
|
716
717
|
Position.release(this.state.touchable.positionOnActivate);
|
|
717
718
|
this.state.touchable.dimensionsOnActivate &&
|
|
719
|
+
// $FlowFixMe[prop-missing]
|
|
718
720
|
BoundingDimensions.release(this.state.touchable.dimensionsOnActivate);
|
|
721
|
+
// $FlowFixMe[prop-missing]
|
|
719
722
|
this.state.touchable.positionOnActivate = Position.getPooled(
|
|
720
723
|
globalX,
|
|
721
724
|
globalY,
|
|
722
725
|
);
|
|
726
|
+
// $FlowFixMe[prop-missing]
|
|
723
727
|
this.state.touchable.dimensionsOnActivate = BoundingDimensions.getPooled(
|
|
724
728
|
w,
|
|
725
729
|
h,
|
|
@@ -718,13 +718,17 @@ const TouchableMixin = {
|
|
|
718
718
|
return;
|
|
719
719
|
}
|
|
720
720
|
this.state.touchable.positionOnActivate &&
|
|
721
|
+
// $FlowFixMe[prop-missing]
|
|
721
722
|
Position.release(this.state.touchable.positionOnActivate);
|
|
722
723
|
this.state.touchable.dimensionsOnActivate &&
|
|
724
|
+
// $FlowFixMe[prop-missing]
|
|
723
725
|
BoundingDimensions.release(this.state.touchable.dimensionsOnActivate);
|
|
726
|
+
// $FlowFixMe[prop-missing]
|
|
724
727
|
this.state.touchable.positionOnActivate = Position.getPooled(
|
|
725
728
|
globalX,
|
|
726
729
|
globalY,
|
|
727
730
|
);
|
|
731
|
+
// $FlowFixMe[prop-missing]
|
|
728
732
|
this.state.touchable.dimensionsOnActivate = BoundingDimensions.getPooled(
|
|
729
733
|
w,
|
|
730
734
|
h,
|
|
@@ -28,7 +28,7 @@ type Props = $ReadOnly<{|
|
|
|
28
28
|
releaseVelocity?: ?number,
|
|
29
29
|
style?: ?ViewStyleProp,
|
|
30
30
|
|
|
31
|
-
hostRef: React.
|
|
31
|
+
hostRef: React.RefSetter<React.ElementRef<typeof Animated.View>>,
|
|
32
32
|
|}>;
|
|
33
33
|
|
|
34
34
|
type State = $ReadOnly<{|
|
|
@@ -189,6 +189,7 @@ class TouchableBounce extends React.Component<Props, State> {
|
|
|
189
189
|
this.props.onPress !== undefined &&
|
|
190
190
|
!this.props.disabled
|
|
191
191
|
}
|
|
192
|
+
// $FlowFixMe[prop-missing]
|
|
192
193
|
ref={this.props.hostRef}
|
|
193
194
|
{...eventHandlersWithoutBlurAndFocus}>
|
|
194
195
|
{this.props.children}
|
|
@@ -215,4 +216,7 @@ class TouchableBounce extends React.Component<Props, State> {
|
|
|
215
216
|
|
|
216
217
|
module.exports = (React.forwardRef((props, hostRef) => (
|
|
217
218
|
<TouchableBounce {...props} hostRef={hostRef} />
|
|
218
|
-
)):
|
|
219
|
+
)): component(
|
|
220
|
+
ref: React.RefSetter<mixed>,
|
|
221
|
+
...props: $ReadOnly<$Diff<Props, {|hostRef: mixed|}>>
|
|
222
|
+
));
|
|
@@ -44,7 +44,7 @@ type Props = $ReadOnly<{|
|
|
|
44
44
|
onHideUnderlay?: ?() => void,
|
|
45
45
|
testOnly_pressed?: ?boolean,
|
|
46
46
|
|
|
47
|
-
hostRef: React.
|
|
47
|
+
hostRef: React.RefSetter<React.ElementRef<typeof View>>,
|
|
48
48
|
|}>;
|
|
49
49
|
|
|
50
50
|
type ExtraStyles = $ReadOnly<{|
|
|
@@ -381,10 +381,10 @@ class TouchableHighlight extends React.Component<Props, State> {
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
const Touchable:
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
384
|
+
const Touchable: component(
|
|
385
|
+
ref: React.RefSetter<React.ElementRef<typeof View>>,
|
|
386
|
+
...props: $ReadOnly<$Diff<Props, {|+hostRef: mixed|}>>
|
|
387
|
+
) = React.forwardRef((props, hostRef) => (
|
|
388
388
|
<TouchableHighlight {...props} hostRef={hostRef} />
|
|
389
389
|
));
|
|
390
390
|
|