From f36bfe5dfa5220a4b533a9818161ce558a065a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Wed, 15 Jan 2025 07:07:01 -0800 Subject: [PATCH] Remove redundant `{||}` syntax (#48686) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48686 Changelog: [Internal] - Removed redundant `{||}` syntax Reviewed By: javache Differential Revision: D68205038 fbshipit-source-id: f7d3271142b6443a5859c3b668b7aebd3ce3ef3f --- .../components/ArrayPropsNativeComponent.js | 8 +- .../components/BooleanPropNativeComponent.js | 4 +- .../components/ColorPropNativeComponent.js | 4 +- .../DimensionPropNativeComponent.js | 4 +- .../EdgeInsetsPropNativeComponent.js | 4 +- .../components/EnumPropNativeComponent.js | 4 +- .../EventNestedObjectPropsNativeComponent.js | 8 +- .../components/EventPropsNativeComponent.js | 16 +- .../components/FloatPropsNativeComponent.js | 4 +- .../components/ImagePropNativeComponent.js | 4 +- .../components/IntegerPropNativeComponent.js | 4 +- .../InterfaceOnlyNativeComponent.js | 6 +- .../components/MixedPropNativeComponent.js | 4 +- .../MultiNativePropNativeComponent.js | 4 +- .../NoPropsNoEventsNativeComponent.js | 4 +- .../components/ObjectPropsNativeComponent.js | 16 +- .../components/PointPropNativeComponent.js | 4 +- .../components/StringPropNativeComponent.js | 4 +- .../modules/NativeEnumTurboModule.js | 8 +- .../modules/NativeObjectTurboModule.js | 36 +- .../NativeOptionalObjectTurboModule.js | 16 +- .../NativePartialAnnotationTurboModule.js | 4 +- .../modules/NativeSampleTurboModule.js | 10 +- .../modules/NativeSampleTurboModuleArrays.js | 12 +- .../NativeSampleTurboModuleNullable.js | 10 +- ...iveSampleTurboModuleNullableAndOptional.js | 10 +- .../NativeSampleTurboModuleOptional.js | 10 +- .../src/SampleNativeComponent.js | 6 +- .../ActionSheetIOS/ActionSheetIOS.js | 4 +- .../ActivityIndicator/ActivityIndicator.js | 8 +- .../Libraries/Components/Button.js | 4 +- .../DrawerLayoutAndroid.android.js | 12 +- .../Libraries/Components/Keyboard/Keyboard.js | 16 +- .../Keyboard/KeyboardAvoidingView.js | 8 +- .../Components/Pressable/Pressable.js | 8 +- .../Pressable/useAndroidRippleForView.js | 18 +- .../ProgressBarAndroid.android.js | 12 +- .../RefreshControl/RefreshControl.js | 12 +- .../Components/ScrollView/ScrollView.js | 40 +- .../ScrollView/ScrollViewCommands.js | 4 +- .../Libraries/Components/StaticRenderer.js | 4 +- .../Components/StatusBar/StatusBar.js | 12 +- .../Libraries/Components/Switch/Switch.js | 12 +- .../AndroidTextInputNativeComponent.js | 62 +- .../TextInput/InputAccessoryView.js | 4 +- .../Components/TextInput/TextInput.flow.js | 70 +- .../Components/TextInput/TextInput.js | 70 +- .../Components/Touchable/TouchableBounce.js | 10 +- .../Touchable/TouchableHighlight.js | 22 +- .../Touchable/TouchableNativeFeedback.js | 28 +- .../Components/Touchable/TouchableOpacity.js | 12 +- .../Touchable/TouchableWithoutFeedback.js | 4 +- .../Components/View/ViewAccessibility.js | 4 +- .../Components/View/ViewPropTypes.js | 44 +- .../Libraries/Core/RawEventEmitter.js | 4 +- .../Libraries/Core/Timers/JSTimers.js | 4 +- .../Libraries/Events/CustomEvent.js | 4 +- .../Libraries/Image/AssetSourceResolver.js | 4 +- .../Libraries/Image/ImageProps.js | 34 +- .../Libraries/Image/nativeImageSource.js | 4 +- .../Libraries/Inspector/ElementProperties.js | 4 +- .../Libraries/Inspector/InspectorOverlay.js | 4 +- .../Libraries/Inspector/InspectorPanel.js | 8 +- .../Libraries/Inspector/NetworkOverlay.js | 6 +- .../Libraries/Inspector/resolveBoxStyle.js | 4 +- .../Libraries/Interaction/PanResponder.js | 12 +- .../react-native/Libraries/Lists/FlatList.js | 12 +- .../Libraries/Lists/SectionList.js | 12 +- .../Libraries/Lists/SectionListModern.js | 12 +- .../Libraries/LogBox/Data/LogBoxData.js | 28 +- .../Libraries/LogBox/Data/LogBoxLog.js | 18 +- .../LogBox/Data/__tests__/LogBoxLog-test.js | 4 +- .../Libraries/LogBox/Data/parseLogBoxLog.js | 20 +- .../LogBox/LogBoxInspectorContainer.js | 6 +- .../LogBox/LogBoxNotificationContainer.js | 6 +- .../Libraries/LogBox/UI/LogBoxButton.js | 8 +- .../LogBox/UI/LogBoxInspectorCodeFrame.js | 4 +- .../LogBox/UI/LogBoxInspectorMessageHeader.js | 4 +- .../LogBox/UI/LogBoxInspectorReactFrames.js | 4 +- .../LogBox/UI/LogBoxInspectorSection.js | 4 +- .../UI/LogBoxInspectorSourceMapStatus.js | 4 +- .../LogBox/UI/LogBoxInspectorStackFrames.js | 4 +- .../react-native/Libraries/Modal/Modal.js | 10 +- .../PermissionsAndroid/PermissionsAndroid.js | 8 +- .../Libraries/Pressability/Pressability.js | 20 +- .../Pressability/PressabilityDebug.js | 4 +- .../PressabilityPerformanceEventEmitter.js | 4 +- .../__tests__/Pressability-test.js | 6 +- .../Libraries/ReactNative/AppContainer.js | 4 +- .../ReactNative/ReactNativeFeatureFlags.js | 4 +- .../ReactNativeRuntimeDiagnostics.js | 4 +- .../react-native/Libraries/StyleSheet/Rect.js | 4 +- .../StyleSheet/private/_TransformStyle.js | 36 +- .../Libraries/Types/CoreEventTypes.js | 80 +- .../react-native/Libraries/UTFSequence.js | 4 +- .../Utilities/BackHandler.android.js | 4 +- .../Libraries/Utilities/BackHandler.ios.js | 4 +- .../Libraries/Utilities/BackHandler.js.flow | 4 +- .../Libraries/Utilities/HMRClient.js | 4 +- .../Libraries/Utilities/Platform.android.js | 8 +- .../Libraries/Utilities/Platform.flow.js | 16 +- .../Libraries/Utilities/Platform.ios.js | 8 +- .../Utilities/codegenNativeCommands.js | 4 +- .../Utilities/codegenNativeComponent.js | 4 +- .../Libraries/Utilities/differ/deepDiffer.js | 6 +- .../Libraries/Utilities/stringifySafe.js | 4 +- .../YellowBox/YellowBoxDeprecated.js | 2 +- .../__snapshots__/public-api-test.js.snap | 908 +++++++++--------- packages/react-native/flow/jest.js | 28 +- .../ActivityIndicatorViewNativeComponent.js | 4 +- .../AndroidDrawerLayoutNativeComponent.js | 12 +- ...izontalScrollContentViewNativeComponent.js | 4 +- ...ndroidSwipeRefreshLayoutNativeComponent.js | 4 +- .../AndroidSwitchNativeComponent.js | 8 +- .../DebuggingOverlayNativeComponent.js | 4 +- .../ProgressBarAndroidNativeComponent.js | 4 +- .../PullToRefreshViewNativeComponent.js | 4 +- .../RCTInputAccessoryViewNativeComponent.js | 4 +- .../RCTModalHostViewNativeComponent.js | 8 +- .../RCTSafeAreaViewNativeComponent.js | 4 +- .../specs/components/SwitchNativeComponent.js | 8 +- .../UnimplementedNativeViewNativeComponent.js | 4 +- .../modules/NativeAccessibilityManager.js | 4 +- .../specs/modules/NativeActionSheetManager.js | 14 +- .../specs/modules/NativeAlertManager.js | 4 +- .../specs/modules/NativeAnimatedModule.js | 4 +- .../modules/NativeAnimatedTurboModule.js | 4 +- .../private/specs/modules/NativeAppState.js | 6 +- .../private/specs/modules/NativeBlobModule.js | 2 +- .../private/specs/modules/NativeClipboard.js | 2 +- .../private/specs/modules/NativeDeviceInfo.js | 16 +- .../modules/NativeDialogManagerAndroid.js | 8 +- .../specs/modules/NativeExceptionsManager.js | 4 +- .../specs/modules/NativeFrameRateLogger.js | 2 +- .../specs/modules/NativeI18nManager.js | 4 +- .../specs/modules/NativeImageEditor.js | 18 +- .../specs/modules/NativeImageLoaderAndroid.js | 2 +- .../specs/modules/NativeImageLoaderIOS.js | 2 +- .../specs/modules/NativeImageStoreAndroid.js | 2 +- .../specs/modules/NativeImageStoreIOS.js | 6 +- .../specs/modules/NativeNetworkingIOS.js | 4 +- .../modules/NativePlatformConstantsAndroid.js | 8 +- .../modules/NativePlatformConstantsIOS.js | 8 +- .../NativePushNotificationManagerIOS.js | 14 +- .../specs/modules/NativeSampleTurboModule.js | 4 +- .../specs/modules/NativeSettingsManager.js | 4 +- .../specs/modules/NativeShareModule.js | 6 +- .../private/specs/modules/NativeSourceCode.js | 4 +- .../modules/NativeStatusBarManagerAndroid.js | 8 +- .../modules/NativeStatusBarManagerIOS.js | 12 +- .../specs/modules/NativeToastAndroid.js | 4 +- .../private/specs/modules/NativeVibration.js | 2 +- .../specs/modules/NativeWebSocketModule.js | 2 +- .../IntegrationTests/LayoutEventsTest.js | 2 +- .../rn-tester/IntegrationTests/TimersTest.js | 6 +- .../js/MyLegacyViewNativeComponent.js | 4 +- .../js/MyNativeViewNativeComponent.js | 6 +- .../NativeScreenshotManager.js | 2 +- .../RCTTest/RCTSnapshotNativeComponent.js | 4 +- .../js/components/ListExampleShared.js | 2 +- .../js/components/RNTConfigurationBlock.js | 4 +- packages/rn-tester/js/components/RNTOption.js | 4 +- .../rn-tester/js/components/RNTesterBlock.js | 4 +- .../rn-tester/js/components/RNTesterButton.js | 4 +- .../js/components/RNTesterComponentTitle.js | 4 +- .../js/components/RNTesterDocumentationURL.js | 4 +- .../js/components/RNTesterListFilters.js | 2 +- .../rn-tester/js/components/RNTesterNavbar.js | 4 +- .../rn-tester/js/components/RNTesterPage.js | 4 +- .../js/components/RNTesterTextInput.js | 4 +- packages/rn-tester/js/components/UseCase.js | 4 +- .../Accessibility/AccessibilityIOSExample.js | 2 +- .../ActionSheetIOS/ActionSheetIOSExample.js | 4 +- .../js/examples/Animated/ComposingExample.js | 2 +- .../js/examples/Animated/EasingExample.js | 2 +- .../js/examples/Animated/MovingBoxExample.js | 2 +- .../examples/AnimatedGratuitousApp/AnExSet.js | 4 +- .../PlatformTest/RNTesterPlatformTest.js | 4 +- .../RNTesterPlatformTestInstructions.js | 4 +- ...RNTesterPlatformTestMinimizedResultView.js | 4 +- .../RNTesterPlatformTestResultView.js | 4 +- .../PlatformTest/RNTesterPlatformTestTypes.js | 28 +- .../PlatformTest/usePlatformTestHarness.js | 4 +- .../W3CPointerEventsEventfulView.js | 4 +- .../js/examples/FlatList/FlatList-basic.js | 6 +- .../examples/FlatList/FlatList-multiColumn.js | 4 +- .../examples/Image/ImageCapInsetsExample.js | 2 +- .../js/examples/Image/ImageExample.js | 60 +- .../InputAccessoryViewExample.js | 8 +- .../examples/Layout/LayoutAnimationExample.js | 20 +- .../js/examples/Layout/LayoutEventsExample.js | 6 +- .../js/examples/Linking/LinkingExample.js | 4 +- .../PointerEvents/PointerEventsExample.js | 16 +- .../rn-tester/js/examples/RTL/RTLExample.js | 4 +- .../SafeAreaView/SafeAreaViewExample.js | 4 +- .../examples/ScrollView/ScrollViewExample.js | 4 +- .../examples/Snapshot/SnapshotViewIOS.ios.js | 4 +- .../js/examples/Switch/SwitchExample.js | 15 +- .../js/examples/Text/TextExample.android.js | 8 +- .../js/examples/Text/TextExample.ios.js | 10 +- .../js/examples/TextInput/ExampleTextInput.js | 4 +- .../TextInput/TextInputExample.ios.js | 4 +- .../TextInput/TextInputSharedExamples.js | 4 +- .../js/examples/Timer/TimerExample.js | 14 +- .../js/examples/Touchable/TouchableExample.js | 2 +- .../NativeCxxModuleExampleExample.js | 6 +- .../TurboModule/SampleLegacyModuleExample.js | 6 +- .../TurboModule/SampleTurboModuleExample.js | 6 +- .../rn-tester/js/examples/View/ViewExample.js | 24 +- .../js/examples/XHR/XHRExampleBinaryUpload.js | 2 +- packages/rn-tester/js/types/RNTesterTypes.js | 16 +- .../Lists/ViewabilityHelper.js | 4 +- .../Lists/VirtualizedListCellRenderer.js | 4 +- .../Lists/VirtualizedListProps.js | 12 +- .../Lists/VirtualizedSectionList.js | 24 +- 215 files changed, 1430 insertions(+), 1435 deletions(-) diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js index 1b46fd1b88e410..ff5d044d817eae 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js @@ -25,7 +25,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props @@ -39,9 +39,9 @@ type NativeProps = $ReadOnly<{| edgeInsets?: $ReadOnlyArray, dimensions?: $ReadOnlyArray, sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>, - object?: $ReadOnlyArray<$ReadOnly<{|prop: string|}>>, - arrayOfObjects?: $ReadOnlyArray<$ReadOnly<{|prop1: Float, prop2: Int32|}>>, -|}>; + object?: $ReadOnlyArray<$ReadOnly<{prop: string}>>, + arrayOfObjects?: $ReadOnlyArray<$ReadOnly<{prop1: Float, prop2: Int32}>>, +}>; export default (codegenNativeComponent( 'ArrayPropsNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js index 31d27759683731..94fe74cddfe4df 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js @@ -14,13 +14,13 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props disabled?: WithDefault, disabledNullable?: WithDefault, -|}>; +}>; export default (codegenNativeComponent( 'BooleanPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js index 09ad4baeee3644..8a0a713fc7bc78 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js @@ -14,12 +14,12 @@ import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props tintColor?: ColorValue, -|}>; +}>; export default (codegenNativeComponent( 'ColorPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/DimensionPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/DimensionPropNativeComponent.js index 4ca8fc37a2a3ca..6628556b19bf86 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/DimensionPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/DimensionPropNativeComponent.js @@ -14,12 +14,12 @@ import type {DimensionValue} from 'react-native/Libraries/StyleSheet/StyleSheetT import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props marginBack?: DimensionValue, -|}>; +}>; export default (codegenNativeComponent( 'DimensionPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js index 95a70164755820..821206e7e12453 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js @@ -13,13 +13,13 @@ import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNat import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props // TODO(T104760003) Fix EdgeInsetsValue in codegen // contentInset?: EdgeInsetsValue, -|}>; +}>; export default (codegenNativeComponent( 'EdgeInsetsPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js index d4394e662e2464..c2146683c52901 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js @@ -14,13 +14,13 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props alignment?: WithDefault<'top' | 'center' | 'bottom-right', 'center'>, intervals?: WithDefault<0 | 15 | 30 | 60, 0>, -|}>; +}>; export default (codegenNativeComponent( 'EnumPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js index 6d8471c45980f6..4e1f549ec8dc22 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js @@ -18,7 +18,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type OnChangeEvent = $ReadOnly<{| +type OnChangeEvent = $ReadOnly<{ location: { source: {url: string, ...}, x: Int32, @@ -26,9 +26,9 @@ type OnChangeEvent = $ReadOnly<{| arrayOfObjects: $ReadOnlyArray<{value: $ReadOnly<{str: string}>}>, ... }, -|}>; +}>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props @@ -36,7 +36,7 @@ type NativeProps = $ReadOnly<{| // Events onChange?: ?BubblingEventHandler, -|}>; +}>; export default (codegenNativeComponent( 'EventNestedObjectPropsNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js index 4d414adbcebc41..79779aa6f71fe7 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js @@ -20,22 +20,22 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type OnChangeEvent = $ReadOnly<{| +type OnChangeEvent = $ReadOnly<{ value: boolean, source?: string, progress: ?Int32, scale?: ?Float, -|}>; +}>; -type OnEventDirect = $ReadOnly<{| +type OnEventDirect = $ReadOnly<{ value: boolean, -|}>; +}>; -type OnOrientationChangeEvent = $ReadOnly<{| +type OnOrientationChangeEvent = $ReadOnly<{ orientation: 'landscape' | 'portrait', -|}>; +}>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props @@ -57,7 +57,7 @@ type NativeProps = $ReadOnly<{| null, 'paperBubblingName', >, -|}>; +}>; export default (codegenNativeComponent( 'EventPropsNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js index 1bd65ccd564d87..cceb20370ae198 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js @@ -17,7 +17,7 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props @@ -28,7 +28,7 @@ type NativeProps = $ReadOnly<{| blurRadius5?: WithDefault, blurRadius6?: WithDefault, blurRadiusNullable?: WithDefault, -|}>; +}>; export default (codegenNativeComponent( 'FloatPropsNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js index 8c08d112f70e15..7631051aab4cf8 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js @@ -14,12 +14,12 @@ import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNat import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props thumbImage?: ImageSource, -|}>; +}>; export default (codegenNativeComponent( 'ImagePropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js index 8f7400a8f0556c..5c1aeb87183a7c 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js @@ -17,14 +17,14 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props progress1?: WithDefault, progress2?: WithDefault, progress3?: WithDefault, -|}>; +}>; export default (codegenNativeComponent( 'IntegerPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js index 8a5e39ce000a22..6433a985a04643 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js @@ -17,15 +17,15 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props title?: WithDefault, // Events - onChange?: ?BubblingEventHandler<$ReadOnly<{|value: boolean|}>>, -|}>; + onChange?: ?BubblingEventHandler<$ReadOnly<{value: boolean}>>, +}>; export default (codegenNativeComponent( 'InterfaceOnlyNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/MixedPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/MixedPropNativeComponent.js index 883ff8a398e1d4..240ab41773f1d0 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/MixedPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/MixedPropNativeComponent.js @@ -14,12 +14,12 @@ import type {UnsafeMixed} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props mixedProp?: UnsafeMixed, -|}>; +}>; export default (codegenNativeComponent( 'MixedPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js index af1b2fb1eba96f..b0c230c47e687d 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js @@ -16,7 +16,7 @@ import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props @@ -24,7 +24,7 @@ type NativeProps = $ReadOnly<{| color?: ColorValue, thumbTintColor?: ColorValue, point?: PointValue, -|}>; +}>; export default (codegenNativeComponent( 'MultiNativePropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js index 6ac37dda0ce92b..f1bc3bb102cc42 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js @@ -13,11 +13,11 @@ import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNat import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // No Props or events -|}>; +}>; export default (codegenNativeComponent( 'NoPropsNoEventsNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js index 85ad5d590aeecf..dceb916b3c4dfa 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js @@ -21,29 +21,29 @@ import type { import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type ObjectArrayPropType = $ReadOnly<{| +type ObjectArrayPropType = $ReadOnly<{ array: $ReadOnlyArray, -|}>; +}>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props - objectProp?: $ReadOnly<{| + objectProp?: $ReadOnly<{ stringProp?: WithDefault, booleanProp: boolean, floatProp: Float, intProp: Int32, stringEnumProp?: WithDefault<'small' | 'large', 'small'>, intEnumProp?: WithDefault<0 | 1, 0>, - |}>, + }>, objectArrayProp: ObjectArrayPropType, - objectPrimitiveRequiredProp: $ReadOnly<{| + objectPrimitiveRequiredProp: $ReadOnly<{ image: ImageSource, color?: ColorValue, point: ?PointValue, - |}>, -|}>; + }>, +}>; export default (codegenNativeComponent( 'ObjectPropsNativeComponent', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js index 772e079c032c79..a9de5a9564ed63 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js @@ -14,12 +14,12 @@ import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props startPoint?: PointValue, -|}>; +}>; export default (codegenNativeComponent( 'PointPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js index 3246f622970ee0..6117f8a9b38c7f 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js @@ -14,13 +14,13 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props placeholder?: WithDefault, defaultValue?: string, -|}>; +}>; export default (codegenNativeComponent( 'StringPropNativeComponentView', diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js index bfcf3e270b48eb..eb9ba2ce1c8876 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js @@ -12,9 +12,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; -export type StateType = {| +export type StateType = { state: string, -|}; +}; export enum StatusRegularEnum { Active, @@ -40,13 +40,13 @@ export enum StatusLowerCaseEnum { Off = 'off', } -export type StateTypeWithEnums = {| +export type StateTypeWithEnums = { state: string, regular: StatusRegularEnum, str: StatusStrEnum, num: StatusNumEnum, lowerCase: StatusLowerCaseEnum, -|}; +}; export interface Spec extends TurboModule { +getStatusRegular: (statusProp: StateType) => StatusRegularEnum; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js index 7dbc21c6c816fd..e6137d7b1c9d32 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js @@ -17,46 +17,46 @@ type AnotherGenericObject = GenericObject; export interface Spec extends TurboModule { +getGenericObject: (arg: Object) => Object; - +getGenericObjectReadOnly: (arg: Object) => $ReadOnly<{|a: string|}>; + +getGenericObjectReadOnly: (arg: Object) => $ReadOnly<{a: string}>; +getGenericObjectWithAlias: (arg: GenericObject) => AnotherGenericObject; - +difficultObject: (A: {| + +difficultObject: (A: { D: boolean, - E: {| + E: { D: boolean, E: number, F: string, - |}, + }, F: string, - |}) => {| + }) => { D: boolean, - E: {| + E: { D: boolean, - E: {| + E: { D: boolean, E: number, F: string, - |}, + }, F: string, - |}, + }, F: string, - |}; - +getConstants: () => {| + }; + +getConstants: () => { D: boolean, - E: {| + E: { D: boolean, - E: {| + E: { D: boolean, - E: {| + E: { D: boolean, E: number, F: string, - |}, + }, F: string, - |}, + }, F: string, - |}, + }, F: string, - |}; + }; } export default (TurboModuleRegistry.getEnforcing( diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js index 37d1a5c47cb4cd..f272a745221d6e 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js @@ -13,24 +13,24 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {| + +getConstants: () => { D?: ?boolean, A?: Array, - E?: ?{| + E?: ?{ D?: ?boolean, - E?: ?{| + E?: ?{ D?: ?boolean, - E?: ?{| + E?: ?{ D?: boolean, E?: number, F?: string, - |}, + }, F?: string, - |}, + }, F?: string, - |}, + }, F?: string, - |}; + }; } export default (TurboModuleRegistry.getEnforcing( diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js index 3e01c1cc5edbe8..d0d51de2ac7136 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js @@ -14,10 +14,10 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; -export type SomeObj = {| +export type SomeObj = { a: string, b?: boolean, -|}; +}; export type PartialSomeObj = Partial; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js index 57871b1035a92a..69a518427b6b59 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js @@ -15,24 +15,24 @@ import type { import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; -type Animal = {| +type Animal = { name: string, -|}; +}; export interface Spec extends TurboModule { // Exported methods. - +getConstants: () => {| + +getConstants: () => { const1: boolean, const2: number, const3: string, - |}; + }; +voidFunc: () => void; +getBool: (arg: boolean) => boolean; +getNumber: (arg: number) => number; +getString: (arg: string) => string; +getArray: (arg: Array) => Array; +getObject: (arg: Object) => Object; - +getObjectShape: (arg: {|prop: number|}) => {|prop: number|}; + +getObjectShape: (arg: {prop: number}) => {prop: number}; +getAlias: (arg: Animal) => Animal; +getRootTag: (arg: RootTag) => RootTag; +getValue: ( diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js index 940cc75fd8c5e0..3b1e11509e4e18 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js @@ -15,25 +15,25 @@ import type { import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; -type Animal = {| +type Animal = { name: string, -|}; +}; export interface Spec extends TurboModule { // Exported methods. - +getConstants: () => {| + +getConstants: () => { const1: Array, const2: Array, const3: Array, - id?: Array, - |}; + id?: Array, + }; +voidFunc: () => void; +getBool: (id: Array) => Array; +getNumber: (arg: Array) => Array; +getString: (arg: Array) => Array; +getArray: (arg: Array>) => Array>; +getObject: (arg: Array) => Array; - +getObjectShape: (arg: Array<{|prop: number|}>) => Array<{|prop: number|}>; + +getObjectShape: (arg: Array<{prop: number}>) => Array<{prop: number}>; +getAlias: (arg: Array) => Array; +getRootTag: (arg: Array) => Array; +getValue: ( diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js index a96b0ae731d8ac..c4dc0bdb35550a 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js @@ -15,24 +15,24 @@ import type { import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; -type Animal = ?{| +type Animal = ?{ name: ?string, -|}; +}; export interface Spec extends TurboModule { // Exported methods. - +getConstants: () => {| + +getConstants: () => { const1: ?boolean, const2: ?number, const3: ?string, - |}; + }; +voidFunc: () => void; +getBool: (arg: ?boolean) => ?boolean; +getNumber: (arg: ?number) => ?number; +getString: (arg: ?string) => ?string; +getArray: (arg: ?Array) => ?Array; +getObject: (arg: ?Object) => ?Object; - +getObjectShape: (arg: ?{|prop: ?number|}) => ?{|prop: ?number|}; + +getObjectShape: (arg: ?{prop: ?number}) => ?{prop: ?number}; +getAlias: (arg: ?Animal) => ?Animal; +getRootTag: (arg: ?RootTag) => ?RootTag; +getValue: (x: ?number, y: ?string, z: ?Object) => ?Object; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js index fb5b66631f3d2a..f67db58c77adeb 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js @@ -15,24 +15,24 @@ import type { import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; -type Animal = ?{| +type Animal = ?{ name?: ?string, -|}; +}; export interface Spec extends TurboModule { // Exported methods. - +getConstants?: () => {| + +getConstants?: () => { const1?: ?boolean, const2?: ?number, const3?: ?string, - |}; + }; +voidFunc?: () => void; +getBool?: (arg?: ?boolean) => ?boolean; +getNumber?: (arg?: ?number) => ?number; +getString?: (arg?: ?string) => ?string; +getArray?: (arg?: ?Array) => ?Array; +getObject?: (arg?: ?Object) => ?Object; - +getObjectShape?: (arg?: {|prop?: ?number|}) => {|prop?: ?number|}; + +getObjectShape?: (arg?: {prop?: ?number}) => {prop?: ?number}; +getAlias?: (arg?: ?Animal) => ?Animal; +getRootTag?: (arg?: ?RootTag) => ?RootTag; +getValue?: (x?: ?number, y?: ?string, z?: ?Object) => ?Object; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js index 820e99a5cad1b5..9b24b2579d5bd4 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js @@ -15,24 +15,24 @@ import type { import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; -type Animal = {| +type Animal = { name?: string, -|}; +}; export interface Spec extends TurboModule { // Exported methods. - +getConstants?: () => {| + +getConstants?: () => { const1?: boolean, const2?: number, const3?: string, - |}; + }; +voidFunc?: () => void; +getBool?: (arg?: boolean) => boolean; +getNumber?: (arg?: number) => number; +getString?: (arg?: string) => string; +getArray?: (arg?: Array) => Array; +getObject?: (arg?: Object) => Object; - +getObjectShape?: (arg?: {|prop?: number|}) => {|prop?: number|}; + +getObjectShape?: (arg?: {prop?: number}) => {prop?: number}; +getAlias?: (arg?: Animal) => Animal; +getRootTag?: (arg?: RootTag) => RootTag; +getValue?: (x?: number, y?: string, z?: Object) => Object; diff --git a/packages/react-native-test-library/src/SampleNativeComponent.js b/packages/react-native-test-library/src/SampleNativeComponent.js index b70a4947ee5bb3..05557d73360535 100644 --- a/packages/react-native-test-library/src/SampleNativeComponent.js +++ b/packages/react-native-test-library/src/SampleNativeComponent.js @@ -28,18 +28,18 @@ type Event = $ReadOnly<{ doubles: $ReadOnlyArray, yesNos: $ReadOnlyArray<'yep' | 'nope'>, strings: $ReadOnlyArray, - latLons: $ReadOnlyArray<{|lat: Double, lon: Double|}>, + latLons: $ReadOnlyArray<{lat: Double, lon: Double}>, multiArrays: $ReadOnlyArray<$ReadOnlyArray>, }>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, opacity?: Float, values: $ReadOnlyArray, // Events onIntArrayChanged?: ?BubblingEventHandler, -|}>; +}>; export type NativeComponentType = HostComponent; diff --git a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js index e758572882c64e..3c0310f88c8397 100644 --- a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -40,7 +40,7 @@ const ActionSheetIOS = { * See https://reactnative.dev/docs/actionsheetios#showactionsheetwithoptions */ showActionSheetWithOptions( - options: {| + options: { +title?: ?string, +message?: ?string, +options: Array, @@ -52,7 +52,7 @@ const ActionSheetIOS = { +disabledButtonTintColor?: ColorValue | ProcessedColorValue, +userInterfaceStyle?: string, +disabledButtonIndices?: Array, - |}, + }, callback: (buttonIndex: number) => void, ) { invariant( diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 2855cf47ffd6ae..3efa7dc78d39fe 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -26,15 +26,15 @@ const GRAY = '#999999'; type IndicatorSize = number | 'small' | 'large'; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ /** Whether the indicator should hide when not animating. @platform ios */ hidesWhenStopped?: ?boolean, -|}>; -type Props = $ReadOnly<{| +}>; +type Props = $ReadOnly<{ ...ViewProps, ...IOSProps, @@ -58,7 +58,7 @@ type Props = $ReadOnly<{| @type {@platform android} number */ size?: ?IndicatorSize, -|}>; +}>; const ActivityIndicator = ( { diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index 1b5c0b6027894d..90778eb7df2dca 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -27,7 +27,7 @@ import View from './View/View'; import invariant from 'invariant'; import * as React from 'react'; -type ButtonProps = $ReadOnly<{| +type ButtonProps = $ReadOnly<{ /** Text to display inside the button. On Android the given title will be converted to the uppercased form. @@ -167,7 +167,7 @@ type ButtonProps = $ReadOnly<{| importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'), accessibilityHint?: ?string, accessibilityLanguage?: ?Stringish, -|}>; +}>; /** A basic button component that should render nicely on any platform. Supports a diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index fc47c65e354fef..7235d6543d03d8 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -31,11 +31,11 @@ const DRAWER_STATES = ['Idle', 'Dragging', 'Settling']; type DrawerStates = 'Idle' | 'Dragging' | 'Settling'; -type DrawerSlideEvent = $ReadOnly<{| +type DrawerSlideEvent = $ReadOnly<{ offset: number, -|}>; +}>; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ accessibilityRole?: ?AccessibilityRole, /** @@ -116,11 +116,11 @@ type Props = $ReadOnly<{| children?: React.Node, style?: ?ViewStyleProp, -|}>; +}>; -type State = {| +type State = { drawerOpened: boolean, -|}; +}; /** * React component that wraps the platform `DrawerLayout` (Android only). The diff --git a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js index 8aae204e97f328..7d7c0fdeaa712d 100644 --- a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js +++ b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js @@ -25,32 +25,32 @@ export type KeyboardEventEasing = | 'linear' | 'keyboard'; -export type KeyboardMetrics = $ReadOnly<{| +export type KeyboardMetrics = $ReadOnly<{ screenX: number, screenY: number, width: number, height: number, -|}>; +}>; export type KeyboardEvent = AndroidKeyboardEvent | IOSKeyboardEvent; -type BaseKeyboardEvent = {| +type BaseKeyboardEvent = { duration: number, easing: KeyboardEventEasing, endCoordinates: KeyboardMetrics, -|}; +}; -export type AndroidKeyboardEvent = $ReadOnly<{| +export type AndroidKeyboardEvent = $ReadOnly<{ ...BaseKeyboardEvent, duration: 0, easing: 'keyboard', -|}>; +}>; -export type IOSKeyboardEvent = $ReadOnly<{| +export type IOSKeyboardEvent = $ReadOnly<{ ...BaseKeyboardEvent, startCoordinates: KeyboardMetrics, isEventFromThisApp: boolean, -|}>; +}>; type KeyboardEventDefinitions = { keyboardWillShow: [KeyboardEvent], diff --git a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js index 77c81f04316e20..3159bfabd7e53a 100644 --- a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -27,7 +27,7 @@ import View from '../View/View'; import Keyboard from './Keyboard'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ ...ViewProps, /** @@ -51,11 +51,11 @@ type Props = $ReadOnly<{| * may be non-zero in some cases. Defaults to 0. */ keyboardVerticalOffset?: number, -|}>; +}>; -type State = {| +type State = { bottom: number, -|}; +}; /** * View that moves out of the way when the keyboard appears by automatically diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index 68b2574156b127..33cec67727c91d 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -34,11 +34,11 @@ import {useMemo, useRef, useState} from 'react'; type ViewStyleProp = $ElementType, 'style'>; -export type StateCallbackType = $ReadOnly<{| +export type StateCallbackType = $ReadOnly<{ pressed: boolean, -|}>; +}>; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ /** * Accessibility. */ @@ -193,7 +193,7 @@ type Props = $ReadOnly<{| * https://github.com/facebook/react-native/issues/34424 */ 'aria-label'?: ?string, -|}>; +}>; type Instance = React.ElementRef; diff --git a/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js b/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js index 20dd19e969181b..dc6d430e456617 100644 --- a/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js +++ b/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js @@ -19,19 +19,19 @@ import invariant from 'invariant'; import * as React from 'react'; import {useMemo} from 'react'; -type NativeBackgroundProp = $ReadOnly<{| +type NativeBackgroundProp = $ReadOnly<{ type: 'RippleAndroid', color: ?number, borderless: boolean, rippleRadius: ?number, -|}>; +}>; -export type RippleConfig = {| +export type RippleConfig = { color?: ColorValue, borderless?: boolean, radius?: number, foreground?: boolean, -|}; +}; /** * Provides the event handlers and props for configuring the ripple effect on @@ -39,15 +39,15 @@ export type RippleConfig = {| */ export default function useAndroidRippleForView( rippleConfig: ?RippleConfig, - viewRef: {|current: null | React.ElementRef|}, -): ?$ReadOnly<{| + viewRef: {current: null | React.ElementRef}, +): ?$ReadOnly<{ onPressIn: (event: PressEvent) => void, onPressMove: (event: PressEvent) => void, onPressOut: (event: PressEvent) => void, viewProps: - | $ReadOnly<{|nativeBackgroundAndroid: NativeBackgroundProp|}> - | $ReadOnly<{|nativeForegroundAndroid: NativeBackgroundProp|}>, -|}> { + | $ReadOnly<{nativeBackgroundAndroid: NativeBackgroundProp}> + | $ReadOnly<{nativeForegroundAndroid: NativeBackgroundProp}>, +}> { const {color, borderless, radius, foreground} = rippleConfig ?? {}; return useMemo(() => { diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index ca5c4fb6a05341..c954ff0f869d4d 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -15,7 +15,7 @@ import ProgressBarAndroidNativeComponent from './ProgressBarAndroidNativeCompone const React = require('react'); -export type ProgressBarAndroidProps = $ReadOnly<{| +export type ProgressBarAndroidProps = $ReadOnly<{ ...ViewProps, /** @@ -25,12 +25,12 @@ export type ProgressBarAndroidProps = $ReadOnly<{| * `progress` value. */ ... - | {| + | { styleAttr: 'Horizontal', indeterminate: false, progress: number, - |} - | {| + } + | { typeAttr: | 'Horizontal' | 'Normal' @@ -40,7 +40,7 @@ export type ProgressBarAndroidProps = $ReadOnly<{| | 'SmallInverse' | 'LargeInverse', indeterminate: true, - |}, + }, /** * Whether to show the ProgressBar (true, the default) or hide it (false). */ @@ -53,7 +53,7 @@ export type ProgressBarAndroidProps = $ReadOnly<{| * Used to locate this view in end-to-end tests. */ testID?: ?string, -|}>; +}>; /** * React component that wraps the Android-only `ProgressBar`. This component is diff --git a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js index 221df2405e256b..dbffe34c445570 100644 --- a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js +++ b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js @@ -21,7 +21,7 @@ import PullToRefreshViewNativeComponent, { const Platform = require('../../Utilities/Platform'); const React = require('react'); -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ /** * The color of the refresh indicator. */ @@ -34,9 +34,9 @@ type IOSProps = $ReadOnly<{| * The title displayed under the refresh indicator. */ title?: ?string, -|}>; +}>; -type AndroidProps = $ReadOnly<{| +type AndroidProps = $ReadOnly<{ /** * Whether the pull to refresh functionality is enabled. */ @@ -53,9 +53,9 @@ type AndroidProps = $ReadOnly<{| * Size of the refresh indicator. */ size?: ?('default' | 'large'), -|}>; +}>; -export type RefreshControlProps = $ReadOnly<{| +export type RefreshControlProps = $ReadOnly<{ ...ViewProps, ...IOSProps, ...AndroidProps, @@ -74,7 +74,7 @@ export type RefreshControlProps = $ReadOnly<{| * Progress view top offset */ progressViewOffset?: ?number, -|}>; +}>; /** * This component is used inside a ScrollView or ListView to add pull to refresh diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index f2dbf2646fbe44..557aa477a2ccb7 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -127,7 +127,7 @@ import * as React from 'react'; */ // Public methods for ScrollView -export type ScrollViewImperativeMethods = $ReadOnly<{| +export type ScrollViewImperativeMethods = $ReadOnly<{ getScrollResponder: $PropertyType, getScrollableNode: $PropertyType, getInnerViewNode: $PropertyType, @@ -141,19 +141,19 @@ export type ScrollViewImperativeMethods = $ReadOnly<{| ScrollView, 'scrollResponderScrollNativeHandleToKeyboard', >, -|}>; +}>; export type DecelerationRateType = 'fast' | 'normal' | number; export type ScrollResponderType = ScrollViewImperativeMethods; -type PublicScrollViewInstance = $ReadOnly<{| +type PublicScrollViewInstance = $ReadOnly<{ ...HostInstance, ...ScrollViewImperativeMethods, -|}>; +}>; type InnerViewInstance = React.ElementRef; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ /** * Controls whether iOS should automatically adjust the content inset * for scroll views that are placed behind a navigation bar or @@ -307,9 +307,9 @@ type IOSProps = $ReadOnly<{| | 'never' | 'always' ), -|}>; +}>; -type AndroidProps = $ReadOnly<{| +type AndroidProps = $ReadOnly<{ /** * Enables nested scrolling for Android API level 21+. * Nested scrolling is supported by default on iOS @@ -364,14 +364,14 @@ type AndroidProps = $ReadOnly<{| * @platform android */ fadingEdgeLength?: ?number, -|}>; +}>; type StickyHeaderComponentType = component( ref?: React.RefSetter<$ReadOnly void}>>, ...ScrollViewStickyHeaderProps ); -export type Props = $ReadOnly<{| +export type Props = $ReadOnly<{ ...ViewProps, ...IOSProps, ...AndroidProps, @@ -494,10 +494,10 @@ export type Props = $ReadOnly<{| * whether content is "visible" or not. * */ - maintainVisibleContentPosition?: ?$ReadOnly<{| + maintainVisibleContentPosition?: ?$ReadOnly<{ minIndexForVisible: number, autoscrollToTopThreshold?: ?number, - |}>, + }>, /** * Called when the momentum scroll starts (scroll which occurs as the ScrollView glides to a stop). */ @@ -651,17 +651,17 @@ export type Props = $ReadOnly<{| * measure, measureLayout, etc. */ scrollViewRef?: React.RefSetter, -|}>; +}>; -type State = {| +type State = { layoutHeight: ?number, -|}; +}; const IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16; -export type ScrollViewComponentStatics = $ReadOnly<{| +export type ScrollViewComponentStatics = $ReadOnly<{ Context: typeof ScrollViewContext, -|}>; +}>; /** * Component that wraps platform ScrollView while providing @@ -976,22 +976,22 @@ class ScrollView extends React.Component { * @platform ios */ scrollResponderZoomTo: ( - rect: {| + rect: { x: number, y: number, width: number, height: number, animated?: boolean, - |}, + }, animated?: boolean, // deprecated, put this inside the rect argument instead ) => void = ( - rect: {| + rect: { x: number, y: number, width: number, height: number, animated?: boolean, - |}, + }, animated?: boolean, // deprecated, put this inside the rect argument instead ) => { invariant(Platform.OS === 'ios', 'zoomToRect is not implemented'); diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewCommands.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewCommands.js index 2e5385d25abe6c..056f3ff85b2957 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewCommands.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewCommands.js @@ -31,13 +31,13 @@ interface NativeCommands { ) => void; +zoomToRect: ( viewRef: React.ElementRef, - rect: {| + rect: { x: Double, y: Double, width: Double, height: Double, animated?: boolean, - |}, + }, animated?: boolean, ) => void; } diff --git a/packages/react-native/Libraries/Components/StaticRenderer.js b/packages/react-native/Libraries/Components/StaticRenderer.js index 666dbd1cd34709..48aa49bf1e54bf 100644 --- a/packages/react-native/Libraries/Components/StaticRenderer.js +++ b/packages/react-native/Libraries/Components/StaticRenderer.js @@ -12,7 +12,7 @@ const React = require('react'); -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ /** * Indicates whether the render function needs to be called again */ @@ -22,7 +22,7 @@ type Props = $ReadOnly<{| * A function that returns a renderable component */ render: () => React.Node, -|}>; +}>; class StaticRenderer extends React.Component { shouldComponentUpdate(nextProps: Props): boolean { diff --git a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js index 784b8eeea361d7..d626e4e21a3a4c 100644 --- a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js +++ b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js @@ -55,7 +55,7 @@ export type StatusBarAnimation = $Keys<{ ... }>; -type AndroidProps = $ReadOnly<{| +type AndroidProps = $ReadOnly<{ /** * The background color of the status bar. * @platform android @@ -69,9 +69,9 @@ type AndroidProps = $ReadOnly<{| * @platform android */ translucent?: ?boolean, -|}>; +}>; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ /** * If the network activity indicator should be visible. * @@ -85,9 +85,9 @@ type IOSProps = $ReadOnly<{| * @platform ios */ showHideTransition?: ?('fade' | 'slide' | 'none'), -|}>; +}>; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ ...AndroidProps, ...IOSProps, /** @@ -103,7 +103,7 @@ type Props = $ReadOnly<{| * Sets the color of the status bar text. */ barStyle?: ?('default' | 'light-content' | 'dark-content'), -|}>; +}>; type StackProps = { backgroundColor: ?{ diff --git a/packages/react-native/Libraries/Components/Switch/Switch.js b/packages/react-native/Libraries/Components/Switch/Switch.js index b1aa2383defc87..eb7ea00ab73042 100644 --- a/packages/react-native/Libraries/Components/Switch/Switch.js +++ b/packages/react-native/Libraries/Components/Switch/Switch.js @@ -24,13 +24,13 @@ import SwitchNativeComponent, { import * as React from 'react'; type SwitchChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ value: boolean, target: number, - |}>, + }>, >; -export type Props = $ReadOnly<{| +export type Props = $ReadOnly<{ ...ViewProps, /** @@ -59,10 +59,10 @@ export type Props = $ReadOnly<{| color of the background exposed by the shrunken track, use [`ios_backgroundColor`](https://reactnative.dev/docs/switch#ios_backgroundColor). */ - trackColor?: ?$ReadOnly<{| + trackColor?: ?$ReadOnly<{ false?: ?ColorValue, true?: ?ColorValue, - |}>, + }>, /** On iOS, custom color for the background. This background color can be @@ -84,7 +84,7 @@ export type Props = $ReadOnly<{| use `onChange`. */ onValueChange?: ?(value: boolean) => Promise | void, -|}>; +}>; const returnsFalse = () => false; const returnsTrue = () => true; diff --git a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index a77e5b42f715af..d9b847fc88cb22 100644 --- a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -69,10 +69,10 @@ export type ReturnKeyType = export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline'; -export type NativeProps = $ReadOnly<{| +export type NativeProps = $ReadOnly<{ // This allows us to inherit everything from ViewProps except for style (see below) // This must be commented for Fabric codegen to work. - ...$Diff>, + ...$Diff>, /** * Android props after this @@ -345,13 +345,13 @@ export type NativeProps = $ReadOnly<{| * Callback that is called when the text input is blurred. * `target` is the reactTag of the element */ - onBlur?: ?BubblingEventHandler<$ReadOnly<{|target: Int32|}>>, + onBlur?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>, /** * Callback that is called when the text input is focused. * `target` is the reactTag of the element */ - onFocus?: ?BubblingEventHandler<$ReadOnly<{|target: Int32|}>>, + onFocus?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>, /** * Callback that is called when the text input's text changes. @@ -359,7 +359,7 @@ export type NativeProps = $ReadOnly<{| * TODO: differentiate between onChange and onChangeText */ onChange?: ?BubblingEventHandler< - $ReadOnly<{|target: Int32, eventCount: Int32, text: string|}>, + $ReadOnly<{target: Int32, eventCount: Int32, text: string}>, >, /** @@ -368,7 +368,7 @@ export type NativeProps = $ReadOnly<{| * TODO: differentiate between onChange and onChangeText */ onChangeText?: ?BubblingEventHandler< - $ReadOnly<{|target: Int32, eventCount: Int32, text: string|}>, + $ReadOnly<{target: Int32, eventCount: Int32, text: string}>, >, /** @@ -379,17 +379,17 @@ export type NativeProps = $ReadOnly<{| * Only called for multiline text inputs. */ onContentSizeChange?: ?DirectEventHandler< - $ReadOnly<{| + $ReadOnly<{ target: Int32, - contentSize: $ReadOnly<{|width: Double, height: Double|}>, - |}>, + contentSize: $ReadOnly<{width: Double, height: Double}>, + }>, >, /** * Callback that is called when text input ends. */ onEndEditing?: ?BubblingEventHandler< - $ReadOnly<{|target: Int32, text: string|}>, + $ReadOnly<{target: Int32, text: string}>, >, /** @@ -398,10 +398,10 @@ export type NativeProps = $ReadOnly<{| * `{ nativeEvent: { selection: { start, end } } }`. */ onSelectionChange?: ?DirectEventHandler< - $ReadOnly<{| + $ReadOnly<{ target: Int32, - selection: $ReadOnly<{|start: Double, end: Double|}>, - |}>, + selection: $ReadOnly<{start: Double, end: Double}>, + }>, >, /** @@ -409,7 +409,7 @@ export type NativeProps = $ReadOnly<{| * Invalid if `multiline={true}` is specified. */ onSubmitEditing?: ?BubblingEventHandler< - $ReadOnly<{|target: Int32, text: string|}>, + $ReadOnly<{target: Int32, text: string}>, >, /** @@ -419,7 +419,7 @@ export type NativeProps = $ReadOnly<{| * the typed-in character otherwise including `' '` for space. * Fires before `onChange` callbacks. */ - onKeyPress?: ?BubblingEventHandler<$ReadOnly<{|target: Int32, key: string|}>>, + onKeyPress?: ?BubblingEventHandler<$ReadOnly<{target: Int32, key: string}>>, /** * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. @@ -427,32 +427,32 @@ export type NativeProps = $ReadOnly<{| * is not provided for performance reasons. */ onScroll?: ?DirectEventHandler< - $ReadOnly<{| + $ReadOnly<{ target: Int32, responderIgnoreScroll: boolean, - contentInset: $ReadOnly<{| + contentInset: $ReadOnly<{ top: Double, // always 0 on Android bottom: Double, // always 0 on Android left: Double, // always 0 on Android right: Double, // always 0 on Android - |}>, - contentOffset: $ReadOnly<{| + }>, + contentOffset: $ReadOnly<{ x: Double, y: Double, - |}>, - contentSize: $ReadOnly<{| + }>, + contentSize: $ReadOnly<{ width: Double, // always 0 on Android height: Double, // always 0 on Android - |}>, - layoutMeasurement: $ReadOnly<{| + }>, + layoutMeasurement: $ReadOnly<{ width: Double, height: Double, - |}>, - velocity: $ReadOnly<{| + }>, + velocity: $ReadOnly<{ x: Double, // always 0 on Android y: Double, // always 0 on Android - |}>, - |}>, + }>, + }>, >, /** @@ -485,10 +485,10 @@ export type NativeProps = $ReadOnly<{| * The start and end of the text input's selection. Set start and end to * the same value to position the cursor. */ - selection?: ?$ReadOnly<{| + selection?: ?$ReadOnly<{ start: Int32, end?: ?Int32, - |}>, + }>, /** * The value to show for the text input. `TextInput` is a controlled @@ -588,7 +588,7 @@ export type NativeProps = $ReadOnly<{| textShadowRadius?: ?Float, textDecorationLine?: ?string, fontStyle?: ?string, - textShadowOffset?: ?$ReadOnly<{|width?: ?Double, height?: ?Double|}>, + textShadowOffset?: ?$ReadOnly<{width?: ?Double, height?: ?Double}>, lineHeight?: ?Float, textTransform?: ?string, color?: ?Int32, @@ -610,7 +610,7 @@ export type NativeProps = $ReadOnly<{| */ mostRecentEventCount: Int32, text?: ?string, -|}>; +}>; type NativeType = HostComponent; diff --git a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js index a97e82e86c0444..ada95cdc3d6b68 100644 --- a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js +++ b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js @@ -76,7 +76,7 @@ import * as React from 'react'; * For an example, look at InputAccessoryViewExample.js in RNTester. */ -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ +children: React.Node, /** * An ID which is used to associate this `InputAccessoryView` to @@ -85,7 +85,7 @@ type Props = $ReadOnly<{| nativeID?: ?string, style?: ?ViewStyleProp, backgroundColor?: ?ColorValue, -|}>; +}>; const InputAccessoryView: React.ComponentType = (props: Props) => { const {width} = useWindowDimensions(); diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index faee19fecb7679..adcb361f67f2a3 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -26,71 +26,71 @@ import * as React from 'react'; type ReactRefSetter = {current: null | T, ...} | ((ref: null | T) => mixed); export type ChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, target: number, text: string, - |}>, + }>, >; export type TextInputEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, previousText: string, - range: $ReadOnly<{| + range: $ReadOnly<{ start: number, end: number, - |}>, + }>, target: number, text: string, - |}>, + }>, >; export type ContentSizeChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - contentSize: $ReadOnly<{| + contentSize: $ReadOnly<{ width: number, height: number, - |}>, - |}>, + }>, + }>, >; type TargetEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - |}>, + }>, >; export type BlurEvent = TargetEvent; export type FocusEvent = TargetEvent; -type Selection = $ReadOnly<{| +type Selection = $ReadOnly<{ start: number, end: number, -|}>; +}>; export type SelectionChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ selection: Selection, target: number, - |}>, + }>, >; export type KeyPressEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ key: string, target?: ?number, eventCount?: ?number, - |}>, + }>, >; export type EditingEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, text: string, target: number, - |}>, + }>, >; type DataDetectorTypesType = @@ -215,7 +215,7 @@ export type enterKeyHintType = type PasswordRules = string; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ /** * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false. * @platform ios @@ -350,9 +350,9 @@ type IOSProps = $ReadOnly<{| * @platform ios */ smartInsertDelete?: ?boolean, -|}>; +}>; -type AndroidProps = $ReadOnly<{| +type AndroidProps = $ReadOnly<{ /** * When provided it will set the color of the cursor (or "caret") in the component. * Unlike the behavior of `selectionColor` the cursor color will be set independently @@ -444,10 +444,10 @@ type AndroidProps = $ReadOnly<{| * @platform android */ underlineColorAndroid?: ?ColorValue, -|}>; +}>; -export type Props = $ReadOnly<{| - ...$Diff>, +export type Props = $ReadOnly<{ + ...$Diff>, ...IOSProps, ...AndroidProps, @@ -900,10 +900,10 @@ export type Props = $ReadOnly<{| * The start and end of the text input's selection. Set start and end to * the same value to position the cursor. */ - selection?: ?$ReadOnly<{| + selection?: ?$ReadOnly<{ start: number, end?: ?number, - |}>, + }>, /** * The highlight and cursor color of the text input. @@ -978,14 +978,14 @@ export type Props = $ReadOnly<{| * unwanted edits without flicker. */ value?: ?Stringish, -|}>; +}>; -type ImperativeMethods = $ReadOnly<{| +type ImperativeMethods = $ReadOnly<{ clear: () => void, isFocused: () => boolean, getNativeRef: () => ?HostInstance, setSelection: (start: number, end: number) => void, -|}>; +}>; /** * A foundational component for inputting text into the app via a @@ -1103,13 +1103,13 @@ type InternalTextInput = component( ...Props ); -export type TextInputComponentStatics = $ReadOnly<{| - State: $ReadOnly<{| +export type TextInputComponentStatics = $ReadOnly<{ + State: $ReadOnly<{ currentlyFocusedInput: () => ?HostInstance, currentlyFocusedField: () => ?number, focusTextInput: (textField: ?HostInstance) => void, blurTextInput: (textField: ?HostInstance) => void, - |}>, -|}>; + }>, +}>; export type TextInputType = InternalTextInput & TextInputComponentStatics; diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index 48a3c99609a870..d429a41604b593 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -67,71 +67,71 @@ if (Platform.OS === 'android') { } export type ChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, target: number, text: string, - |}>, + }>, >; export type TextInputEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, previousText: string, - range: $ReadOnly<{| + range: $ReadOnly<{ start: number, end: number, - |}>, + }>, target: number, text: string, - |}>, + }>, >; export type ContentSizeChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - contentSize: $ReadOnly<{| + contentSize: $ReadOnly<{ width: number, height: number, - |}>, - |}>, + }>, + }>, >; type TargetEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - |}>, + }>, >; export type BlurEvent = TargetEvent; export type FocusEvent = TargetEvent; -type Selection = $ReadOnly<{| +type Selection = $ReadOnly<{ start: number, end: number, -|}>; +}>; export type SelectionChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ selection: Selection, target: number, - |}>, + }>, >; export type KeyPressEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ key: string, target?: ?number, eventCount?: ?number, - |}>, + }>, >; export type EditingEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, text: string, target: number, - |}>, + }>, >; type DataDetectorTypesType = @@ -259,7 +259,7 @@ export type enterKeyHintType = type PasswordRules = string; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ /** * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false. * @platform ios @@ -397,9 +397,9 @@ type IOSProps = $ReadOnly<{| * @platform ios */ smartInsertDelete?: ?boolean, -|}>; +}>; -type AndroidProps = $ReadOnly<{| +type AndroidProps = $ReadOnly<{ /** * When provided it will set the color of the cursor (or "caret") in the component. * Unlike the behavior of `selectionColor` the cursor color will be set independently @@ -483,10 +483,10 @@ type AndroidProps = $ReadOnly<{| * @platform android */ underlineColorAndroid?: ?ColorValue, -|}>; +}>; -export type Props = $ReadOnly<{| - ...$Diff>, +export type Props = $ReadOnly<{ + ...$Diff>, ...IOSProps, ...AndroidProps, @@ -903,10 +903,10 @@ export type Props = $ReadOnly<{| * The start and end of the text input's selection. Set start and end to * the same value to position the cursor. */ - selection?: ?$ReadOnly<{| + selection?: ?$ReadOnly<{ start: number, end?: ?number, - |}>, + }>, /** * The highlight and cursor color of the text input. @@ -987,7 +987,7 @@ export type Props = $ReadOnly<{| * unwanted edits without flicker. */ value?: ?Stringish, -|}>; +}>; type ViewCommands = $NonMaybeType< | typeof AndroidTextInputCommands @@ -995,10 +995,10 @@ type ViewCommands = $NonMaybeType< | typeof RCTSinglelineTextInputNativeCommands, >; -type LastNativeSelection = {| +type LastNativeSelection = { selection: Selection, mostRecentEventCount: number, -|}; +}; const emptyFunctionThatReturnsTrue = () => true; @@ -1874,14 +1874,14 @@ ExportedForwardRef.State = { blurTextInput: TextInputState.blurTextInput, }; -export type TextInputComponentStatics = $ReadOnly<{| - State: $ReadOnly<{| +export type TextInputComponentStatics = $ReadOnly<{ + State: $ReadOnly<{ currentlyFocusedInput: typeof TextInputState.currentlyFocusedInput, currentlyFocusedField: typeof TextInputState.currentlyFocusedField, focusTextInput: typeof TextInputState.focusTextInput, blurTextInput: typeof TextInputState.blurTextInput, - |}>, -|}>; + }>, +}>; const styles = StyleSheet.create({ multilineDefault: { diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js index 7c9f5a4b6867f1..fc35725e4d3769 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js @@ -19,7 +19,7 @@ import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ ...React.ElementConfig, onPressAnimationComplete?: ?() => void, @@ -29,12 +29,12 @@ type Props = $ReadOnly<{| style?: ?ViewStyleProp, hostRef: React.RefSetter>, -|}>; +}>; -type State = $ReadOnly<{| +type State = $ReadOnly<{ pressability: Pressability, scale: Animated.Value, -|}>; +}>; class TouchableBounce extends React.Component { state: State = { @@ -218,5 +218,5 @@ module.exports = (React.forwardRef((props, hostRef) => ( )): component( ref: React.RefSetter, - ...props: $ReadOnly<$Diff> + ...props: $ReadOnly<$Diff> )); diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index e0aad9ca2e5ddb..4aaf320316c7a4 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -20,19 +20,19 @@ import StyleSheet, {type ViewStyleProp} from '../../StyleSheet/StyleSheet'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; -type AndroidProps = $ReadOnly<{| +type AndroidProps = $ReadOnly<{ nextFocusDown?: ?number, nextFocusForward?: ?number, nextFocusLeft?: ?number, nextFocusRight?: ?number, nextFocusUp?: ?number, -|}>; +}>; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ hasTVPreferredFocus?: ?boolean, -|}>; +}>; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ ...React.ElementConfig, ...AndroidProps, ...IOSProps, @@ -45,17 +45,17 @@ type Props = $ReadOnly<{| testOnly_pressed?: ?boolean, hostRef: React.RefSetter>, -|}>; +}>; -type ExtraStyles = $ReadOnly<{| +type ExtraStyles = $ReadOnly<{ child: ViewStyleProp, underlay: ViewStyleProp, -|}>; +}>; -type State = $ReadOnly<{| +type State = $ReadOnly<{ pressability: Pressability, extraStyles: ?ExtraStyles, -|}>; +}>; /** * A wrapper for making views respond properly to touches. @@ -383,7 +383,7 @@ class TouchableHighlight extends React.Component { const Touchable: component( ref: React.RefSetter>, - ...props: $ReadOnly<$Diff> + ...props: $ReadOnly<$Diff> ) = React.forwardRef((props, hostRef) => ( )); diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js index 0fb5f86702e417..91d6bbadf75e87 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -23,7 +23,7 @@ import {Commands} from '../View/ViewNativeComponent'; import invariant from 'invariant'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ ...React.ElementConfig, /** @@ -33,19 +33,19 @@ type Props = $ReadOnly<{| * methods to generate that dictionary. */ background?: ?( - | $ReadOnly<{| + | $ReadOnly<{ type: 'ThemeAttrAndroid', attribute: | 'selectableItemBackground' | 'selectableItemBackgroundBorderless', rippleRadius: ?number, - |}> - | $ReadOnly<{| + }> + | $ReadOnly<{ type: 'RippleAndroid', color: ?number, borderless: boolean, rippleRadius: ?number, - |}> + }> ), /** @@ -89,22 +89,22 @@ type Props = $ReadOnly<{| * versions, this will fallback to background. */ useForeground?: ?boolean, -|}>; +}>; -type State = $ReadOnly<{| +type State = $ReadOnly<{ pressability: Pressability, -|}>; +}>; class TouchableNativeFeedback extends React.Component { /** * Creates a value for the `background` prop that uses the Android theme's * default background for selectable elements. */ - static SelectableBackground: (rippleRadius: ?number) => $ReadOnly<{| + static SelectableBackground: (rippleRadius: ?number) => $ReadOnly<{ attribute: 'selectableItemBackground', type: 'ThemeAttrAndroid', rippleRadius: ?number, - |}> = (rippleRadius: ?number) => ({ + }> = (rippleRadius: ?number) => ({ type: 'ThemeAttrAndroid', attribute: 'selectableItemBackground', rippleRadius, @@ -114,11 +114,11 @@ class TouchableNativeFeedback extends React.Component { * Creates a value for the `background` prop that uses the Android theme's * default background for borderless selectable elements. Requires API 21+. */ - static SelectableBackgroundBorderless: (rippleRadius: ?number) => $ReadOnly<{| + static SelectableBackgroundBorderless: (rippleRadius: ?number) => $ReadOnly<{ attribute: 'selectableItemBackgroundBorderless', type: 'ThemeAttrAndroid', rippleRadius: ?number, - |}> = (rippleRadius: ?number) => ({ + }> = (rippleRadius: ?number) => ({ type: 'ThemeAttrAndroid', attribute: 'selectableItemBackgroundBorderless', rippleRadius, @@ -133,12 +133,12 @@ class TouchableNativeFeedback extends React.Component { color: string, borderless: boolean, rippleRadius: ?number, - ) => $ReadOnly<{| + ) => $ReadOnly<{ borderless: boolean, color: ?number, rippleRadius: ?number, type: 'RippleAndroid', - |}> = (color: string, borderless: boolean, rippleRadius: ?number) => { + }> = (color: string, borderless: boolean, rippleRadius: ?number) => { const processedColor = processColor(color); invariant( processedColor == null || typeof processedColor === 'number', diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index ef9b2572b69cb8..2924c8af55228c 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -21,16 +21,16 @@ import flattenStyle from '../../StyleSheet/flattenStyle'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; -type TVProps = $ReadOnly<{| +type TVProps = $ReadOnly<{ hasTVPreferredFocus?: ?boolean, nextFocusDown?: ?number, nextFocusForward?: ?number, nextFocusLeft?: ?number, nextFocusRight?: ?number, nextFocusUp?: ?number, -|}>; +}>; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ ...React.ElementConfig, ...TVProps, @@ -38,12 +38,12 @@ type Props = $ReadOnly<{| style?: ?ViewStyleProp, hostRef?: ?React.RefSetter>, -|}>; +}>; -type State = $ReadOnly<{| +type State = $ReadOnly<{ anim: Animated.Value, pressability: Pressability, -|}>; +}>; /** * A wrapper for making views respond properly to touches. diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js index d584a2f8623f5e..59a38a22657d75 100755 --- a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -29,7 +29,7 @@ import usePressability from '../../Pressability/usePressability'; import * as React from 'react'; import {useMemo} from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ accessibilityActions?: ?$ReadOnlyArray, accessibilityElementsHidden?: ?boolean, accessibilityHint?: ?Stringish, @@ -82,7 +82,7 @@ type Props = $ReadOnly<{| rejectResponderTermination?: ?boolean, testID?: ?string, touchSoundDisabled?: ?boolean, -|}>; +}>; const PASSTHROUGH_PROPS = [ 'accessibilityActions', diff --git a/packages/react-native/Libraries/Components/View/ViewAccessibility.js b/packages/react-native/Libraries/Components/View/ViewAccessibility.js index c3e254bcd45250..813fe8f443d2a1 100644 --- a/packages/react-native/Libraries/Components/View/ViewAccessibility.js +++ b/packages/react-native/Libraries/Components/View/ViewAccessibility.js @@ -144,7 +144,7 @@ export type AccessibilityState = { ... }; -export type AccessibilityValue = $ReadOnly<{| +export type AccessibilityValue = $ReadOnly<{ /** * The minimum value of this component's range. (should be an integer) */ @@ -164,4 +164,4 @@ export type AccessibilityValue = $ReadOnly<{| * A textual description of this component's value. (will override minimum, current, and maximum if set) */ text?: Stringish, -|}>; +}>; diff --git a/packages/react-native/Libraries/Components/View/ViewPropTypes.js b/packages/react-native/Libraries/Components/View/ViewPropTypes.js index f56e28d86e0c4b..8f5a93eb8fd24e 100644 --- a/packages/react-native/Libraries/Components/View/ViewPropTypes.js +++ b/packages/react-native/Libraries/Components/View/ViewPropTypes.js @@ -34,7 +34,7 @@ import type {Node} from 'react'; export type ViewLayout = Layout; export type ViewLayoutEvent = LayoutEvent; -type DirectEventProps = $ReadOnly<{| +type DirectEventProps = $ReadOnly<{ /** * When `accessible` is true, the system will try to invoke this function * when the user performs an accessibility custom action. @@ -78,15 +78,15 @@ type DirectEventProps = $ReadOnly<{| * See https://reactnative.dev/docs/view#onaccessibilityescape */ onAccessibilityEscape?: ?() => mixed, -|}>; +}>; -type MouseEventProps = $ReadOnly<{| +type MouseEventProps = $ReadOnly<{ onMouseEnter?: ?(event: MouseEvent) => void, onMouseLeave?: ?(event: MouseEvent) => void, -|}>; +}>; // Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use) -type PointerEventProps = $ReadOnly<{| +type PointerEventProps = $ReadOnly<{ onClick?: ?(event: PointerEvent) => void, onClickCapture?: ?(event: PointerEvent) => void, onPointerEnter?: ?(event: PointerEvent) => void, @@ -109,16 +109,16 @@ type PointerEventProps = $ReadOnly<{| onGotPointerCaptureCapture?: ?(e: PointerEvent) => void, onLostPointerCapture?: ?(e: PointerEvent) => void, onLostPointerCaptureCapture?: ?(e: PointerEvent) => void, -|}>; +}>; -type FocusEventProps = $ReadOnly<{| +type FocusEventProps = $ReadOnly<{ onBlur?: ?(event: BlurEvent) => void, onBlurCapture?: ?(event: BlurEvent) => void, onFocus?: ?(event: FocusEvent) => void, onFocusCapture?: ?(event: FocusEvent) => void, -|}>; +}>; -type TouchEventProps = $ReadOnly<{| +type TouchEventProps = $ReadOnly<{ onTouchCancel?: ?(e: PressEvent) => void, onTouchCancelCapture?: ?(e: PressEvent) => void, onTouchEnd?: ?(e: PressEvent) => void, @@ -127,14 +127,14 @@ type TouchEventProps = $ReadOnly<{| onTouchMoveCapture?: ?(e: PressEvent) => void, onTouchStart?: ?(e: PressEvent) => void, onTouchStartCapture?: ?(e: PressEvent) => void, -|}>; +}>; /** * For most touch interactions, you'll simply want to wrap your component in * `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`, * `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion. */ -type GestureResponderEventProps = $ReadOnly<{| +type GestureResponderEventProps = $ReadOnly<{ /** * Does this view want to "claim" touch responsiveness? This is called for * every touch move on the `View` when it is not the responder. @@ -249,23 +249,23 @@ type GestureResponderEventProps = $ReadOnly<{| * See https://reactnative.dev/docs/view#onstartshouldsetrespondercapture */ onStartShouldSetResponderCapture?: ?(e: PressEvent) => boolean, -|}>; +}>; -type AndroidDrawableThemeAttr = $ReadOnly<{| +type AndroidDrawableThemeAttr = $ReadOnly<{ type: 'ThemeAttrAndroid', attribute: string, -|}>; +}>; -type AndroidDrawableRipple = $ReadOnly<{| +type AndroidDrawableRipple = $ReadOnly<{ type: 'RippleAndroid', color?: ?number, borderless?: ?boolean, rippleRadius?: ?number, -|}>; +}>; type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple; -type AndroidViewProps = $ReadOnly<{| +type AndroidViewProps = $ReadOnly<{ /** * Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props, * the text is read aloud. The value should should match the nativeID of the related element. @@ -394,9 +394,9 @@ type AndroidViewProps = $ReadOnly<{| * @platform android */ onClick?: ?(event: PressEvent) => mixed, -|}>; +}>; -type IOSViewProps = $ReadOnly<{| +type IOSViewProps = $ReadOnly<{ /** * Prevents view from being inverted if set to true and color inversion is turned on. * @@ -465,9 +465,9 @@ type IOSViewProps = $ReadOnly<{| * See https://reactnative.dev/docs/view#shouldrasterizeios */ shouldRasterizeIOS?: ?boolean, -|}>; +}>; -export type ViewProps = $ReadOnly<{| +export type ViewProps = $ReadOnly<{ ...DirectEventProps, ...GestureResponderEventProps, ...MouseEventProps, @@ -644,4 +644,4 @@ export type ViewProps = $ReadOnly<{| * See https://reactnative.dev/docs/view#removeclippedsubviews */ removeClippedSubviews?: ?boolean, -|}>; +}>; diff --git a/packages/react-native/Libraries/Core/RawEventEmitter.js b/packages/react-native/Libraries/Core/RawEventEmitter.js index 03950ff8c16a37..70bfbd516a7872 100644 --- a/packages/react-native/Libraries/Core/RawEventEmitter.js +++ b/packages/react-native/Libraries/Core/RawEventEmitter.js @@ -12,13 +12,13 @@ import type {IEventEmitter} from '../vendor/emitter/EventEmitter'; import EventEmitter from '../vendor/emitter/EventEmitter'; -export type RawEventEmitterEvent = $ReadOnly<{| +export type RawEventEmitterEvent = $ReadOnly<{ eventName: string, // We expect, but do not/cannot require, that nativeEvent is an object // with the properties: key, elementType (string), type (string), tag (numeric), // and a stateNode of the native element/Fiber the event was emitted to. nativeEvent: {[string]: mixed}, -|}>; +}>; type RawEventDefinitions = { [eventChannel: string]: [RawEventEmitterEvent], diff --git a/packages/react-native/Libraries/Core/Timers/JSTimers.js b/packages/react-native/Libraries/Core/Timers/JSTimers.js index f996f9c26d47da..a7403781fe4821 100644 --- a/packages/react-native/Libraries/Core/Timers/JSTimers.js +++ b/packages/react-native/Libraries/Core/Timers/JSTimers.js @@ -452,7 +452,7 @@ function setSendIdleEvents(sendIdleEvents: boolean): void { NativeTiming.setSendIdleEvents(sendIdleEvents); } -let ExportedJSTimers: {| +let ExportedJSTimers: { callIdleCallbacks: (frameTime: number) => any | void, callReactNativeMicrotasks: () => void, callTimers: (timersToCall: Array) => any | void, @@ -467,7 +467,7 @@ let ExportedJSTimers: {| queueReactNativeMicrotask: (func: any, ...args: any) => number, setInterval: (func: any, duration: number, ...args: any) => number, setTimeout: (func: any, duration: number, ...args: any) => number, -|}; +}; if (!NativeTiming) { console.warn("Timing native module is not available, can't set timers."); diff --git a/packages/react-native/Libraries/Events/CustomEvent.js b/packages/react-native/Libraries/Events/CustomEvent.js index 96f422788f9ea2..1a6e6fd9478c6b 100644 --- a/packages/react-native/Libraries/Events/CustomEvent.js +++ b/packages/react-native/Libraries/Events/CustomEvent.js @@ -11,12 +11,12 @@ // Make sure global Event is defined import EventPolyfill from './EventPolyfill'; -type CustomEvent$Options = $ReadOnly<{| +type CustomEvent$Options = $ReadOnly<{ bubbles?: boolean, cancelable?: boolean, composed?: boolean, detail?: {...}, -|}>; +}>; class CustomEvent extends EventPolyfill { detail: ?{...}; diff --git a/packages/react-native/Libraries/Image/AssetSourceResolver.js b/packages/react-native/Libraries/Image/AssetSourceResolver.js index 93f71702acd468..c9c9ac6a3d54e0 100644 --- a/packages/react-native/Libraries/Image/AssetSourceResolver.js +++ b/packages/react-native/Libraries/Image/AssetSourceResolver.js @@ -10,13 +10,13 @@ 'use strict'; -export type ResolvedAssetSource = {| +export type ResolvedAssetSource = { +__packager_asset: boolean, +width: ?number, +height: ?number, +uri: string, +scale: number, -|}; +}; import type { AssetDestPathResolver, diff --git a/packages/react-native/Libraries/Image/ImageProps.js b/packages/react-native/Libraries/Image/ImageProps.js index 80c05862e4330a..b26fbdb7c8aae5 100644 --- a/packages/react-native/Libraries/Image/ImageProps.js +++ b/packages/react-native/Libraries/Image/ImageProps.js @@ -24,16 +24,16 @@ import type {ImageSource} from './ImageSource'; import type {ElementRef, Node, RefSetter} from 'react'; export type ImageLoadEvent = SyntheticEvent< - $ReadOnly<{| - source: $ReadOnly<{| + $ReadOnly<{ + source: $ReadOnly<{ width: number, height: number, uri: string, - |}>, - |}>, + }>, + }>, >; -type IOSImageProps = $ReadOnly<{| +type IOSImageProps = $ReadOnly<{ /** * A static image to display while loading the image source. * @@ -52,12 +52,12 @@ type IOSImageProps = $ReadOnly<{| * See https://reactnative.dev/docs/image#onprogress */ onProgress?: ?( - event: SyntheticEvent<$ReadOnly<{|loaded: number, total: number|}>>, + event: SyntheticEvent<$ReadOnly<{loaded: number, total: number}>>, ) => void, -|}>; +}>; -type AndroidImageProps = $ReadOnly<{| - loadingIndicatorSource?: ?(number | $ReadOnly<{|uri: string|}>), +type AndroidImageProps = $ReadOnly<{ + loadingIndicatorSource?: ?(number | $ReadOnly<{uri: string}>), progressiveRenderingEnabled?: ?boolean, fadeDuration?: ?number, @@ -76,10 +76,10 @@ type AndroidImageProps = $ReadOnly<{| * Defaults to 1.0. */ resizeMultiplier?: ?number, -|}>; +}>; -export type ImageProps = $ReadOnly<{| - ...$Diff>, +export type ImageProps = $ReadOnly<{ + ...$Diff>, ...IOSImageProps, ...AndroidImageProps, @@ -164,9 +164,9 @@ export type ImageProps = $ReadOnly<{| */ onError?: ?( event: SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ error: string, - |}>, + }>, >, ) => void, @@ -267,9 +267,9 @@ export type ImageProps = $ReadOnly<{| */ srcSet?: ?string, children?: empty, -|}>; +}>; -export type ImageBackgroundProps = $ReadOnly<{| +export type ImageBackgroundProps = $ReadOnly<{ ...ImageProps, children?: Node, @@ -293,4 +293,4 @@ export type ImageBackgroundProps = $ReadOnly<{| * See https://reactnative.dev/docs/imagebackground#imageref */ imageRef?: RefSetter>, -|}>; +}>; diff --git a/packages/react-native/Libraries/Image/nativeImageSource.js b/packages/react-native/Libraries/Image/nativeImageSource.js index 7785b56786f8bd..8a98e3940c01cb 100644 --- a/packages/react-native/Libraries/Image/nativeImageSource.js +++ b/packages/react-native/Libraries/Image/nativeImageSource.js @@ -12,7 +12,7 @@ import type {ImageURISource} from './ImageSource'; import Platform from '../Utilities/Platform'; -type NativeImageSourceSpec = $ReadOnly<{| +type NativeImageSourceSpec = $ReadOnly<{ android?: string, ios?: string, default?: string, @@ -21,7 +21,7 @@ type NativeImageSourceSpec = $ReadOnly<{| // https://reactnative.dev/docs/images#why-not-automatically-size-everything height: number, width: number, -|}>; +}>; /** * In hybrid apps, use `nativeImageSource` to access images that are already diff --git a/packages/react-native/Libraries/Inspector/ElementProperties.js b/packages/react-native/Libraries/Inspector/ElementProperties.js index ba01f10d9f0002..8264e038134c2c 100644 --- a/packages/react-native/Libraries/Inspector/ElementProperties.js +++ b/packages/react-native/Libraries/Inspector/ElementProperties.js @@ -25,13 +25,13 @@ const mapWithSeparator = require('../Utilities/mapWithSeparator'); const BoxInspector = require('./BoxInspector'); const StyleInspector = require('./StyleInspector'); -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ hierarchy: ?InspectorData['hierarchy'], style?: ?ViewStyleProp, frame?: ?Object, selection?: ?number, setSelection?: number => mixed, -|}>; +}>; class ElementProperties extends React.Component { render(): React.Node { diff --git a/packages/react-native/Libraries/Inspector/InspectorOverlay.js b/packages/react-native/Libraries/Inspector/InspectorOverlay.js index 46f332d5cb2a8f..6f19c7339a6d0c 100644 --- a/packages/react-native/Libraries/Inspector/InspectorOverlay.js +++ b/packages/react-native/Libraries/Inspector/InspectorOverlay.js @@ -19,10 +19,10 @@ const View = require('../Components/View/View'); const StyleSheet = require('../StyleSheet/StyleSheet'); const ElementBox = require('./ElementBox'); -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ inspected?: ?InspectedElement, onTouchPoint: (locationX: number, locationY: number) => void, -|}>; +}>; function InspectorOverlay({inspected, onTouchPoint}: Props): React.Node { const findViewForTouchEvent = (e: PressEvent) => { diff --git a/packages/react-native/Libraries/Inspector/InspectorPanel.js b/packages/react-native/Libraries/Inspector/InspectorPanel.js index 06dd6d69a4ef4b..7e147d8a891e32 100644 --- a/packages/react-native/Libraries/Inspector/InspectorPanel.js +++ b/packages/react-native/Libraries/Inspector/InspectorPanel.js @@ -24,7 +24,7 @@ const ElementProperties = require('./ElementProperties'); const NetworkOverlay = require('./NetworkOverlay'); const PerformanceOverlay = require('./PerformanceOverlay'); -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ devtoolsIsOpen: boolean, inspecting: boolean, setInspecting: (val: boolean) => void, @@ -38,7 +38,7 @@ type Props = $ReadOnly<{| selection?: ?number, setSelection: number => mixed, inspected?: ?InspectedElement, -|}>; +}>; class InspectorPanel extends React.Component { renderWaiting(): React.Node { @@ -107,11 +107,11 @@ class InspectorPanel extends React.Component { } } -type InspectorPanelButtonProps = $ReadOnly<{| +type InspectorPanelButtonProps = $ReadOnly<{ onClick: (val: boolean) => void, pressed: boolean, title: string, -|}>; +}>; class InspectorPanelButton extends React.Component { render(): React.Node { diff --git a/packages/react-native/Libraries/Inspector/NetworkOverlay.js b/packages/react-native/Libraries/Inspector/NetworkOverlay.js index d845a3ac9bc6a8..41946e2f762264 100644 --- a/packages/react-native/Libraries/Inspector/NetworkOverlay.js +++ b/packages/react-native/Libraries/Inspector/NetworkOverlay.js @@ -49,11 +49,11 @@ type NetworkRequestInfo = { ... }; -type Props = $ReadOnly<{||}>; -type State = {| +type Props = $ReadOnly<{}>; +type State = { detailRowId: ?number, requests: Array, -|}; +}; function getStringByValue(value: any): string { if (value === undefined) { diff --git a/packages/react-native/Libraries/Inspector/resolveBoxStyle.js b/packages/react-native/Libraries/Inspector/resolveBoxStyle.js index 4a8711f5e92230..ece1655338896a 100644 --- a/packages/react-native/Libraries/Inspector/resolveBoxStyle.js +++ b/packages/react-native/Libraries/Inspector/resolveBoxStyle.js @@ -25,12 +25,12 @@ const I18nManager = require('../ReactNative/I18nManager'); function resolveBoxStyle( prefix: string, style: Object, -): ?$ReadOnly<{| +): ?$ReadOnly<{ bottom: number, left: number, right: number, top: number, -|}> { +}> { let hasParts = false; const result = { bottom: 0, diff --git a/packages/react-native/Libraries/Interaction/PanResponder.js b/packages/react-native/Libraries/Interaction/PanResponder.js index 71bec342048681..8d741d9ab44dba 100644 --- a/packages/react-native/Libraries/Interaction/PanResponder.js +++ b/packages/react-native/Libraries/Interaction/PanResponder.js @@ -124,7 +124,7 @@ const currentCentroidY = TouchHistoryMath.currentCentroidY; * [PanResponder example in RNTester](https://github.com/facebook/react-native/blob/HEAD/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js) */ -export type GestureState = {| +export type GestureState = { /** * ID of the gestureState - persisted as long as there at least one touch on screen */ @@ -181,7 +181,7 @@ export type GestureState = {| * @private */ _accountsForMovesUpTo: number, -|}; +}; type ActiveCallback = ( event: PressEvent, @@ -190,7 +190,7 @@ type ActiveCallback = ( type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed; -export type PanHandlers = {| +export type PanHandlers = { onMoveShouldSetResponder: (event: PressEvent) => boolean, onMoveShouldSetResponderCapture: (event: PressEvent) => boolean, onResponderEnd: (event: PressEvent) => void, @@ -203,9 +203,9 @@ export type PanHandlers = {| onResponderTerminationRequest: (event: PressEvent) => boolean, onStartShouldSetResponder: (event: PressEvent) => boolean, onStartShouldSetResponderCapture: (event: PressEvent) => boolean, -|}; +}; -type PanResponderConfig = $ReadOnly<{| +type PanResponderConfig = $ReadOnly<{ onMoveShouldSetPanResponder?: ?ActiveCallback, onMoveShouldSetPanResponderCapture?: ?ActiveCallback, onStartShouldSetPanResponder?: ?ActiveCallback, @@ -224,7 +224,7 @@ type PanResponderConfig = $ReadOnly<{| onPanResponderTerminate?: ?PassiveCallback, onPanResponderTerminationRequest?: ?ActiveCallback, onShouldBlockNativeResponder?: ?ActiveCallback, -|}>; +}>; const PanResponder = { /** diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index 4aec7559f7f6a9..18afd5f93e1fe3 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -32,14 +32,14 @@ const Platform = require('../Utilities/Platform'); const invariant = require('invariant'); const React = require('react'); -type RequiredProps = {| +type RequiredProps = { /** * An array (or array-like list) of items to render. Other data types can be * used by targeting VirtualizedList directly. */ data: ?$ReadOnly<$ArrayLike>, -|}; -type OptionalProps = {| +}; +type OptionalProps = { /** * Takes an item from `data` and renders it into the list. Example usage: * @@ -150,7 +150,7 @@ type OptionalProps = {| * Enable an optimization to memoize the item renderer to prevent unnecessary rerenders. */ strictMode?: boolean, -|}; +}; /** * Default Props Helper Functions @@ -176,10 +176,10 @@ function isArrayLike(data: mixed): boolean { return typeof Object(data).length === 'number'; } -type FlatListProps = {| +type FlatListProps = { ...RequiredProps, ...OptionalProps, -|}; +}; type VirtualizedListProps = React.ElementConfig; diff --git a/packages/react-native/Libraries/Lists/SectionList.js b/packages/react-native/Libraries/Lists/SectionList.js index 26ad34fce49f7f..7461f1e1b3c7c9 100644 --- a/packages/react-native/Libraries/Lists/SectionList.js +++ b/packages/react-native/Libraries/Lists/SectionList.js @@ -25,7 +25,7 @@ type Item = any; export type SectionBase = _SectionBase; -type RequiredProps> = {| +type RequiredProps> = { /** * The actual data to render, akin to the `data` prop in [``](https://reactnative.dev/docs/flatlist). * @@ -38,9 +38,9 @@ type RequiredProps> = {| * }> */ sections: $ReadOnlyArray, -|}; +}; -type OptionalProps> = {| +type OptionalProps> = { /** * Default renderer for every item in every section. Can be over-ridden on a per-section basis. */ @@ -90,9 +90,9 @@ type OptionalProps> = {| * This may improve scroll performance for large lists. */ removeClippedSubviews?: boolean, -|}; +}; -export type Props = {| +export type Props = { ...$Diff< VirtualizedSectionListProps, { @@ -114,7 +114,7 @@ export type Props = {| >, ...RequiredProps, ...OptionalProps, -|}; +}; /** * A performant interface for rendering sectioned lists, supporting the most handy features: diff --git a/packages/react-native/Libraries/Lists/SectionListModern.js b/packages/react-native/Libraries/Lists/SectionListModern.js index 788eead2c914ed..c6ee31d14b3b13 100644 --- a/packages/react-native/Libraries/Lists/SectionListModern.js +++ b/packages/react-native/Libraries/Lists/SectionListModern.js @@ -26,7 +26,7 @@ type Item = any; export type SectionBase = _SectionBase; -type RequiredProps> = {| +type RequiredProps> = { /** * The actual data to render, akin to the `data` prop in [``](https://reactnative.dev/docs/flatlist). * @@ -39,9 +39,9 @@ type RequiredProps> = {| * }> */ sections: $ReadOnlyArray, -|}; +}; -type OptionalProps> = {| +type OptionalProps> = { /** * Default renderer for every item in every section. Can be over-ridden on a per-section basis. */ @@ -91,9 +91,9 @@ type OptionalProps> = {| * This may improve scroll performance for large lists. */ removeClippedSubviews?: boolean, -|}; +}; -export type Props> = $ReadOnly<{| +export type Props> = $ReadOnly<{ ...$Diff< VirtualizedSectionListProps, { @@ -115,7 +115,7 @@ export type Props> = $ReadOnly<{| >, ...RequiredProps, ...OptionalProps, -|}>; +}>; /** * A performant interface for rendering sectioned lists, supporting the most handy features: diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js index 85b7cc7ecc7281..858dd06005a202 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js @@ -37,20 +37,20 @@ export type LogData = $ReadOnly<{ }>; export type Observer = ( - $ReadOnly<{| + $ReadOnly<{ logs: LogBoxLogs, isDisabled: boolean, selectedLogIndex: number, - |}>, + }>, ) => void; export type IgnorePattern = string | RegExp; -export type Subscription = $ReadOnly<{| +export type Subscription = $ReadOnly<{ unsubscribe: () => void, -|}>; +}>; -export type WarningInfo = {| +export type WarningInfo = { finalFormat: string, forceDialogImmediately: boolean, suppressDialog_LEGACY: boolean, @@ -58,15 +58,15 @@ export type WarningInfo = {| monitorEvent: string | null, monitorListVersion: number, monitorSampleRate: number, -|}; +}; export type WarningFilter = (format: string) => WarningInfo; -type AppInfo = $ReadOnly<{| +type AppInfo = $ReadOnly<{ appVersion: string, engine: string, onPress?: ?() => void, -|}>; +}>; const observers: Set<{observer: Observer, ...}> = new Set(); const ignorePatterns: Set = new Set(); @@ -413,25 +413,25 @@ export function observe(observer: Observer): Subscription { }; } -type Props = $ReadOnly<{||}>; -type State = $ReadOnly<{| +type Props = $ReadOnly<{}>; +type State = $ReadOnly<{ logs: LogBoxLogs, isDisabled: boolean, hasError: boolean, selectedLogIndex: number, -|}>; +}>; type SubscribedComponent = React.ComponentType< - $ReadOnly<{| + $ReadOnly<{ logs: $ReadOnlyArray, isDisabled: boolean, selectedLogIndex: number, - |}>, + }>, >; export function withSubscription( WrappedComponent: SubscribedComponent, -): React.ComponentType<{||}> { +): React.ComponentType<{}> { class LogBoxStateSubscription extends React.Component { static getDerivedStateFromError(): {hasError: boolean} { return {hasError: true}; diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js b/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js index f1f53d4073dae7..32cc3323776f91 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js @@ -82,23 +82,23 @@ class LogBoxLog { isComponentError: boolean; extraData: mixed | void; symbolicated: - | $ReadOnly<{|error: null, stack: null, status: 'NONE'|}> - | $ReadOnly<{|error: null, stack: null, status: 'PENDING'|}> - | $ReadOnly<{|error: null, stack: Stack, status: 'COMPLETE'|}> - | $ReadOnly<{|error: Error, stack: null, status: 'FAILED'|}> = { + | $ReadOnly<{error: null, stack: null, status: 'NONE'}> + | $ReadOnly<{error: null, stack: null, status: 'PENDING'}> + | $ReadOnly<{error: null, stack: Stack, status: 'COMPLETE'}> + | $ReadOnly<{error: Error, stack: null, status: 'FAILED'}> = { error: null, stack: null, status: 'NONE', }; symbolicatedComponentStack: - | $ReadOnly<{|error: null, componentStack: null, status: 'NONE'|}> - | $ReadOnly<{|error: null, componentStack: null, status: 'PENDING'|}> - | $ReadOnly<{| + | $ReadOnly<{error: null, componentStack: null, status: 'NONE'}> + | $ReadOnly<{error: null, componentStack: null, status: 'PENDING'}> + | $ReadOnly<{ error: null, componentStack: ComponentStack, status: 'COMPLETE', - |}> - | $ReadOnly<{|error: Error, componentStack: null, status: 'FAILED'|}> = { + }> + | $ReadOnly<{error: Error, componentStack: null, status: 'FAILED'}> = { error: null, componentStack: null, status: 'NONE', diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js index 2327492caf97dd..a6d34be82c3eac 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js @@ -40,12 +40,12 @@ function getLogBoxLog() { }); } -function getLogBoxSymbolication(): {| +function getLogBoxSymbolication(): { symbolicate: JestMockFn< $ReadOnlyArray>, Promise, >, -|} { +} { return (require('../LogBoxSymbolication'): any); } diff --git a/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js b/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js index 40a2c41a769861..bff7e0352ae0cf 100644 --- a/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js +++ b/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js @@ -107,7 +107,7 @@ export type ExtendedExceptionData = ExceptionData & { ... }; export type Category = string; -export type CodeFrame = $ReadOnly<{| +export type CodeFrame = $ReadOnly<{ content: string, location: ?{ row: number, @@ -120,26 +120,26 @@ export type CodeFrame = $ReadOnly<{| // we gained the ability to use the collapse flag, but // it is not integrated into the LogBox UI. collapse?: boolean, -|}>; -export type Message = $ReadOnly<{| +}>; +export type Message = $ReadOnly<{ content: string, substitutions: $ReadOnlyArray< - $ReadOnly<{| + $ReadOnly<{ length: number, offset: number, - |}>, + }>, >, -|}>; +}>; export type ComponentStack = $ReadOnlyArray; export type ComponentStackType = 'legacy' | 'stack'; const SUBSTITUTION = UTFSequence.BOM + '%s'; -export function parseInterpolation(args: $ReadOnlyArray): $ReadOnly<{| +export function parseInterpolation(args: $ReadOnlyArray): $ReadOnly<{ category: Category, message: Message, -|}> { +}> { const categoryParts = []; const contentParts = []; const substitutionOffsets = []; @@ -456,12 +456,12 @@ export function withoutANSIColorStyles(message: mixed): mixed { ); } -export function parseLogBoxLog(args: $ReadOnlyArray): {| +export function parseLogBoxLog(args: $ReadOnlyArray): { componentStack: ComponentStack, componentStackType: ComponentStackType, category: Category, message: Message, -|} { +} { const message = withoutANSIColorStyles(args[0]); let argsWithoutComponentStack: Array = []; let componentStack: ComponentStack = []; diff --git a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js index 3ffaab83616e60..3ccf93a68bde02 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js @@ -16,11 +16,11 @@ import * as LogBoxData from './Data/LogBoxData'; import LogBoxInspector from './UI/LogBoxInspector'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ logs: $ReadOnlyArray, selectedLogIndex: number, isDisabled?: ?boolean, -|}>; +}>; export class _LogBoxInspectorContainer extends React.Component { render(): React.Node { @@ -65,4 +65,4 @@ export class _LogBoxInspectorContainer extends React.Component { export default (LogBoxData.withSubscription( _LogBoxInspectorContainer, -): React.ComponentType<{||}>); +): React.ComponentType<{}>); diff --git a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js index 6f3a8918592459..84f62a17f0ace0 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js @@ -16,11 +16,11 @@ import LogBoxLog from './Data/LogBoxLog'; import LogBoxLogNotification from './UI/LogBoxNotification'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ logs: $ReadOnlyArray, selectedLogIndex: number, isDisabled?: ?boolean, -|}>; +}>; export function _LogBoxNotificationContainer(props: Props): React.Node { const {logs} = props; @@ -102,4 +102,4 @@ const styles = StyleSheet.create({ export default (LogBoxData.withSubscription( _LogBoxNotificationContainer, -): React.ComponentType<{||}>); +): React.ComponentType<{}>); diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js index f9d7361659da54..baaebfe55e3f61 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js @@ -18,16 +18,16 @@ import StyleSheet from '../../StyleSheet/StyleSheet'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| - backgroundColor: $ReadOnly<{| +type Props = $ReadOnly<{ + backgroundColor: $ReadOnly<{ default: string, pressed: string, - |}>, + }>, children?: React.Node, hitSlop?: ?EdgeInsetsProp, onPress?: ?(event: PressEvent) => void, style?: ViewStyleProp, -|}>; +}>; function LogBoxButton(props: Props): React.Node { const [pressed, setPressed] = React.useState(false); diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js index 8353389c4e9330..8061eaace4ab6b 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js @@ -22,9 +22,9 @@ import LogBoxButton from './LogBoxButton'; import LogBoxInspectorSection from './LogBoxInspectorSection'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ codeFrame: ?CodeFrame, -|}>; +}>; function LogBoxInspectorCodeFrame(props: Props): React.Node { const codeFrame = props.codeFrame; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js index 7fc21e7e06db3d..4c41591d4241b2 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js @@ -18,13 +18,13 @@ import LogBoxMessage from './LogBoxMessage'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ collapsed: boolean, message: Message, level: LogLevel, title: string, onPress: () => void, -|}>; +}>; const SHOW_MORE_MESSAGE_LENGTH = 300; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js index 428dc83a5ce85e..4baa1aab450b35 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js @@ -20,9 +20,9 @@ import LogBoxInspectorSection from './LogBoxInspectorSection'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ log: LogBoxLog, -|}>; +}>; const BEFORE_SLASH_RE = /^(.*)[\\/]/; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js index c613db556464f3..2b3d7bcedd9c54 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js @@ -14,11 +14,11 @@ import Text from '../../Text/Text'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ heading: string, children: React.Node, action?: ?React.Node, -|}>; +}>; function LogBoxInspectorSection(props: Props): React.Node { return ( diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js index f54d001f915e2f..d5d3bf9f780863 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js @@ -18,10 +18,10 @@ import LogBoxButton from './LogBoxButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ onPress?: ?(event: PressEvent) => void, status: 'COMPLETE' | 'FAILED' | 'NONE' | 'PENDING', -|}>; +}>; function LogBoxInspectorSourceMapStatus(props: Props): React.Node { const [state, setState] = React.useState({ diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js index b3473bc03c1772..0a11fbab799022 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js @@ -23,10 +23,10 @@ import LogBoxInspectorStackFrame from './LogBoxInspectorStackFrame'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ log: LogBoxLog, onRetry: () => void, -|}>; +}>; export function getCollapseMessage( stackFrames: Stack, diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 8d0a85b15fb9ac..0faa4e6835015b 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -53,11 +53,11 @@ const ModalEventEmitter = // destroyed before the callback is fired. let uniqueModalIdentifier = 0; -type OrientationChangeEvent = $ReadOnly<{| +type OrientationChangeEvent = $ReadOnly<{ orientation: 'portrait' | 'landscape', -|}>; +}>; -export type Props = $ReadOnly<{| +export type Props = $ReadOnly<{ ...ViewProps, /** @@ -171,7 +171,7 @@ export type Props = $ReadOnly<{| * Defaults to `white` if not provided and transparent is `false`. Ignored if `transparent` is `true`. */ backdropColor?: ?string, -|}>; +}>; function confirmProps(props: Props) { if (__DEV__) { @@ -202,7 +202,7 @@ type State = { }; class Modal extends React.Component { - static defaultProps: {|hardwareAccelerated: boolean, visible: boolean|} = { + static defaultProps: {hardwareAccelerated: boolean, visible: boolean} = { visible: true, hardwareAccelerated: false, }; diff --git a/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js b/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js index 3a1964886a5e15..8f157585ded0d3 100644 --- a/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -88,7 +88,7 @@ const PERMISSIONS = Object.freeze({ */ class PermissionsAndroid { - PERMISSIONS: $ReadOnly<{| + PERMISSIONS: $ReadOnly<{ ACCEPT_HANDOVER: string, ACCESS_BACKGROUND_LOCATION: string, ACCESS_COARSE_LOCATION: string, @@ -132,12 +132,12 @@ class PermissionsAndroid { WRITE_CALL_LOG: string, WRITE_CONTACTS: string, WRITE_EXTERNAL_STORAGE: string, - |}> = PERMISSIONS; - RESULTS: $ReadOnly<{| + }> = PERMISSIONS; + RESULTS: $ReadOnly<{ DENIED: 'denied', GRANTED: 'granted', NEVER_ASK_AGAIN: 'never_ask_again', - |}> = PERMISSION_REQUEST_RESULT; + }> = PERMISSION_REQUEST_RESULT; /** * DEPRECATED - use check diff --git a/packages/react-native/Libraries/Pressability/Pressability.js b/packages/react-native/Libraries/Pressability/Pressability.js index f2355b8bb916d7..62dd0ed777c43f 100644 --- a/packages/react-native/Libraries/Pressability/Pressability.js +++ b/packages/react-native/Libraries/Pressability/Pressability.js @@ -27,7 +27,7 @@ import PressabilityPerformanceEventEmitter from './PressabilityPerformanceEventE import {type PressabilityTouchSignal as TouchSignal} from './PressabilityTypes.js'; import invariant from 'invariant'; -export type PressabilityConfig = $ReadOnly<{| +export type PressabilityConfig = $ReadOnly<{ /** * Whether a press gesture can be interrupted by a parent gesture such as a * scroll event. Defaults to true. @@ -135,9 +135,9 @@ export type PressabilityConfig = $ReadOnly<{| * while this pressable is responder. */ blockNativeResponder?: ?boolean, -|}>; +}>; -export type EventHandlers = $ReadOnly<{| +export type EventHandlers = $ReadOnly<{ onBlur: (event: BlurEvent) => void, onClick: (event: PressEvent) => void, onFocus: (event: FocusEvent) => void, @@ -151,7 +151,7 @@ export type EventHandlers = $ReadOnly<{| onResponderTerminate: (event: PressEvent) => void, onResponderTerminationRequest: () => boolean, onStartShouldSetResponder: () => boolean, -|}>; +}>; type TouchState = | 'NOT_RESPONDER' @@ -378,16 +378,16 @@ export default class Pressability { _pressDelayTimeout: ?TimeoutID = null; _pressOutDelayTimeout: ?TimeoutID = null; _responderID: ?number | HostInstance = null; - _responderRegion: ?$ReadOnly<{| + _responderRegion: ?$ReadOnly<{ bottom: number, left: number, right: number, top: number, - |}> = null; - _touchActivatePosition: ?$ReadOnly<{| + }> = null; + _touchActivatePosition: ?$ReadOnly<{ pageX: number, pageY: number, - |}>; + }>; _touchActivateTime: ?number; _touchState: TouchState = 'NOT_RESPONDER'; @@ -830,12 +830,12 @@ export default class Pressability { _isTouchWithinResponderRegion( touch: $PropertyType, - responderRegion: $ReadOnly<{| + responderRegion: $ReadOnly<{ bottom: number, left: number, right: number, top: number, - |}>, + }>, ): boolean { const hitSlop = normalizeRect(this._config.hitSlop); const pressRectOffset = normalizeRect(this._config.pressRectOffset); diff --git a/packages/react-native/Libraries/Pressability/PressabilityDebug.js b/packages/react-native/Libraries/Pressability/PressabilityDebug.js index 01ec826ed7c522..87bf772d64186d 100644 --- a/packages/react-native/Libraries/Pressability/PressabilityDebug.js +++ b/packages/react-native/Libraries/Pressability/PressabilityDebug.js @@ -15,10 +15,10 @@ import normalizeColor from '../StyleSheet/normalizeColor'; import {type RectOrSize, normalizeRect} from '../StyleSheet/Rect'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ color: ColorValue, hitSlop: ?RectOrSize, -|}>; +}>; /** * Displays a debug overlay to visualize press targets when enabled via the diff --git a/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js b/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js index 5853b390ff21dc..9270b01c53e4f3 100644 --- a/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +++ b/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js @@ -10,10 +10,10 @@ import {type PressabilityTouchSignal as TouchSignal} from './PressabilityTypes.js'; -export type PressabilityPerformanceEvent = $ReadOnly<{| +export type PressabilityPerformanceEvent = $ReadOnly<{ signal: TouchSignal, nativeTimestamp: number, -|}>; +}>; export type PressabilityPerformanceEventListener = PressabilityPerformanceEvent => void; diff --git a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js index a70cd006fc998f..da426af419e4f0 100644 --- a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js +++ b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js @@ -82,7 +82,7 @@ const mockSlop = { right: 10, }; -const mockUIManagerMeasure = (options?: {|delay: number|}) => { +const mockUIManagerMeasure = (options?: {delay: number}) => { getMock(UIManager.measure).mockImplementation((id, fn) => { if (options && options.delay) { setTimeout( @@ -171,11 +171,11 @@ const createMockMouseEvent = (registrationName: string) => { const createMockPressEvent = ( nameOrOverrides: | string - | $ReadOnly<{| + | $ReadOnly<{ registrationName: string, pageX: number, pageY: number, - |}>, + }>, ): PressEvent => { let registrationName = ''; let pageX = 0; diff --git a/packages/react-native/Libraries/ReactNative/AppContainer.js b/packages/react-native/Libraries/ReactNative/AppContainer.js index afea7ca8631d01..4f9b7f0895268b 100644 --- a/packages/react-native/Libraries/ReactNative/AppContainer.js +++ b/packages/react-native/Libraries/ReactNative/AppContainer.js @@ -13,7 +13,7 @@ import type {RootTag} from './RootTag'; import * as React from 'react'; -export type Props = $ReadOnly<{| +export type Props = $ReadOnly<{ children?: React.Node, fabric?: boolean, rootTag: number | RootTag, @@ -22,7 +22,7 @@ export type Props = $ReadOnly<{| rootViewStyle?: ?ViewStyleProp, internal_excludeLogBox?: boolean, internal_excludeInspector?: boolean, -|}>; +}>; const AppContainer: component(...Props) = __DEV__ ? require('./AppContainer-dev').default diff --git a/packages/react-native/Libraries/ReactNative/ReactNativeFeatureFlags.js b/packages/react-native/Libraries/ReactNative/ReactNativeFeatureFlags.js index 61f37d20a66b95..8af6bc50b56dca 100644 --- a/packages/react-native/Libraries/ReactNative/ReactNativeFeatureFlags.js +++ b/packages/react-native/Libraries/ReactNative/ReactNativeFeatureFlags.js @@ -8,7 +8,7 @@ * @format */ -export type FeatureFlags = {| +export type FeatureFlags = { /** * Function used to enable / disable W3C pointer event emitting in React Native. * If enabled you must also flip the equivalent native flags on each platform: @@ -21,7 +21,7 @@ export type FeatureFlags = {| * for its hover callbacks */ shouldPressibilityUseW3CPointerEventsForHover: () => boolean, -|}; +}; const ReactNativeFeatureFlags: FeatureFlags = { shouldEmitW3CPointerEvents: () => false, diff --git a/packages/react-native/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js b/packages/react-native/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js index 82bea13749cb74..03e35a497dc3a3 100644 --- a/packages/react-native/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +++ b/packages/react-native/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js @@ -14,7 +14,7 @@ * Perform a set of runtime diagnostics, usually useful for test purpose. * This is only meaningful for __DEV__ mode. */ -export type RuntimeDiagnostics = {| +export type RuntimeDiagnostics = { /** * Check if the runtime diagnostics is enabled at all. */ @@ -24,7 +24,7 @@ export type RuntimeDiagnostics = {| * If enabled, simulate early JavaScript errors during initialization. */ simulateEarlyJavaScriptErrors: () => void, -|}; +}; export type RuntimeDiagnosticFlag = 'early_js_errors' | 'all'; diff --git a/packages/react-native/Libraries/StyleSheet/Rect.js b/packages/react-native/Libraries/StyleSheet/Rect.js index 822576a720fbc0..30f1ec26440389 100644 --- a/packages/react-native/Libraries/StyleSheet/Rect.js +++ b/packages/react-native/Libraries/StyleSheet/Rect.js @@ -8,12 +8,12 @@ * @flow strict */ -export type Rect = $ReadOnly<{| +export type Rect = $ReadOnly<{ bottom?: ?number, left?: ?number, right?: ?number, top?: ?number, -|}>; +}>; export type RectOrSize = Rect | number; diff --git a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js index 4b30b4d6ec1f12..2485acefddbaaf 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js +++ b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js @@ -10,7 +10,7 @@ import type AnimatedNode from '../../Animated/nodes/AnimatedNode'; -export type ____TransformStyle_Internal = $ReadOnly<{| +export type ____TransformStyle_Internal = $ReadOnly<{ /** * `transform` accepts an array of transformation objects. Each object specifies * the property that will be transformed as the key, and the value to use in the @@ -29,27 +29,27 @@ export type ____TransformStyle_Internal = $ReadOnly<{| */ transform?: | $ReadOnlyArray< - | {|+perspective: number | AnimatedNode|} - | {|+rotate: string | AnimatedNode|} - | {|+rotateX: string | AnimatedNode|} - | {|+rotateY: string | AnimatedNode|} - | {|+rotateZ: string | AnimatedNode|} - | {|+scale: number | AnimatedNode|} - | {|+scaleX: number | AnimatedNode|} - | {|+scaleY: number | AnimatedNode|} - | {|+translateX: number | AnimatedNode|} - | {|+translateY: number | AnimatedNode|} - | {| + | {+perspective: number | AnimatedNode} + | {+rotate: string | AnimatedNode} + | {+rotateX: string | AnimatedNode} + | {+rotateY: string | AnimatedNode} + | {+rotateZ: string | AnimatedNode} + | {+scale: number | AnimatedNode} + | {+scaleX: number | AnimatedNode} + | {+scaleY: number | AnimatedNode} + | {+translateX: number | AnimatedNode} + | {+translateY: number | AnimatedNode} + | { +translate: | [number | AnimatedNode, number | AnimatedNode] | AnimatedNode, - |} - | {|+skewX: string | AnimatedNode|} - | {|+skewY: string | AnimatedNode|} + } + | {+skewX: string | AnimatedNode} + | {+skewY: string | AnimatedNode} // TODO: what is the actual type it expects? - | {| + | { +matrix: $ReadOnlyArray | AnimatedNode, - |}, + }, > | string, /** @@ -66,4 +66,4 @@ export type ____TransformStyle_Internal = $ReadOnly<{| transformOrigin?: | [string | number, string | number, string | number] | string, -|}>; +}>; diff --git a/packages/react-native/Libraries/Types/CoreEventTypes.js b/packages/react-native/Libraries/Types/CoreEventTypes.js index 09bd968e293c1b..e5cbb16b44bf3a 100644 --- a/packages/react-native/Libraries/Types/CoreEventTypes.js +++ b/packages/react-native/Libraries/Types/CoreEventTypes.js @@ -10,14 +10,14 @@ import type {HostInstance} from '../Renderer/shims/ReactNativeTypes'; -export type SyntheticEvent<+T> = $ReadOnly<{| +export type SyntheticEvent<+T> = $ReadOnly<{ bubbles: ?boolean, cancelable: ?boolean, currentTarget: number | HostInstance, defaultPrevented: ?boolean, - dispatchConfig: $ReadOnly<{| + dispatchConfig: $ReadOnly<{ registrationName: string, - |}>, + }>, eventPhase: ?number, preventDefault: () => void, isDefaultPrevented: () => boolean, @@ -29,16 +29,16 @@ export type SyntheticEvent<+T> = $ReadOnly<{| target: ?number | HostInstance, timeStamp: number, type: ?string, -|}>; +}>; -export type ResponderSyntheticEvent = $ReadOnly<{| +export type ResponderSyntheticEvent = $ReadOnly<{ ...SyntheticEvent, - touchHistory: $ReadOnly<{| + touchHistory: $ReadOnly<{ indexOfSingleActiveTouch: number, mostRecentTimeStamp: number, numberActiveTouches: number, touchBank: $ReadOnlyArray< - $ReadOnly<{| + $ReadOnly<{ touchActive: boolean, startPageX: number, startPageY: number, @@ -49,37 +49,37 @@ export type ResponderSyntheticEvent = $ReadOnly<{| previousPageX: number, previousPageY: number, previousTimeStamp: number, - |}>, + }>, >, - |}>, -|}>; + }>, +}>; -export type Layout = $ReadOnly<{| +export type Layout = $ReadOnly<{ x: number, y: number, width: number, height: number, -|}>; +}>; -export type TextLayout = $ReadOnly<{| +export type TextLayout = $ReadOnly<{ ...Layout, ascender: number, capHeight: number, descender: number, text: string, xHeight: number, -|}>; +}>; export type LayoutEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ layout: Layout, - |}>, + }>, >; export type TextLayoutEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ lines: Array, - |}>, + }>, >; /** @@ -221,7 +221,7 @@ export interface NativePointerEvent extends NativeMouseEvent { export type PointerEvent = SyntheticEvent; export type PressEvent = ResponderSyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ changedTouches: $ReadOnlyArray<$PropertyType>, force?: number, identifier: number, @@ -232,60 +232,60 @@ export type PressEvent = ResponderSyntheticEvent< target: ?number, timestamp: number, touches: $ReadOnlyArray<$PropertyType>, - |}>, + }>, >; export type ScrollEvent = SyntheticEvent< - $ReadOnly<{| - contentInset: $ReadOnly<{| + $ReadOnly<{ + contentInset: $ReadOnly<{ bottom: number, left: number, right: number, top: number, - |}>, - contentOffset: $ReadOnly<{| + }>, + contentOffset: $ReadOnly<{ y: number, x: number, - |}>, - contentSize: $ReadOnly<{| + }>, + contentSize: $ReadOnly<{ height: number, width: number, - |}>, - layoutMeasurement: $ReadOnly<{| + }>, + layoutMeasurement: $ReadOnly<{ height: number, width: number, - |}>, - targetContentOffset?: $ReadOnly<{| + }>, + targetContentOffset?: $ReadOnly<{ y: number, x: number, - |}>, - velocity?: $ReadOnly<{| + }>, + velocity?: $ReadOnly<{ y: number, x: number, - |}>, + }>, zoomScale?: number, responderIgnoreScroll?: boolean, - |}>, + }>, >; export type BlurEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - |}>, + }>, >; export type FocusEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - |}>, + }>, >; export type MouseEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ clientX: number, clientY: number, pageX: number, pageY: number, timestamp: number, - |}>, + }>, >; diff --git a/packages/react-native/Libraries/UTFSequence.js b/packages/react-native/Libraries/UTFSequence.js index 05a8562960d30b..082c73be9454ad 100644 --- a/packages/react-native/Libraries/UTFSequence.js +++ b/packages/react-native/Libraries/UTFSequence.js @@ -19,7 +19,7 @@ const deepFreezeAndThrowOnMutationInDev = require('./Utilities/deepFreezeAndThro * - Source code should be limited to ASCII. * - Less chance of typos. */ -const UTFSequence: {| +const UTFSequence: { BOM: string, BULLET: string, BULLET_SP: string, @@ -35,7 +35,7 @@ const UTFSequence: {| PIZZA: string, TRIANGLE_LEFT: string, TRIANGLE_RIGHT: string, -|} = deepFreezeAndThrowOnMutationInDev({ +} = deepFreezeAndThrowOnMutationInDev({ BOM: '\ufeff', // byte order mark BULLET: '\u2022', // bullet: • BULLET_SP: '\u00A0\u2022\u00A0', //  •  diff --git a/packages/react-native/Libraries/Utilities/BackHandler.android.js b/packages/react-native/Libraries/Utilities/BackHandler.android.js index 14fb436c8c4c4b..f1e5aa48015792 100644 --- a/packages/react-native/Libraries/Utilities/BackHandler.android.js +++ b/packages/react-native/Libraries/Utilities/BackHandler.android.js @@ -54,13 +54,13 @@ RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function () { * }); * ``` */ -type TBackHandler = {| +type TBackHandler = { +exitApp: () => void, +addEventListener: ( eventName: BackPressEventName, handler: BackPressHandler, ) => {remove: () => void, ...}, -|}; +}; const BackHandler: TBackHandler = { exitApp: function (): void { if (!NativeDeviceEventManager) { diff --git a/packages/react-native/Libraries/Utilities/BackHandler.ios.js b/packages/react-native/Libraries/Utilities/BackHandler.ios.js index bc4cf85c634cb0..70e8f1daced3ec 100644 --- a/packages/react-native/Libraries/Utilities/BackHandler.ios.js +++ b/packages/react-native/Libraries/Utilities/BackHandler.ios.js @@ -13,13 +13,13 @@ type BackPressHandler = () => ?boolean; function emptyFunction(): void {} -type TBackHandler = {| +type TBackHandler = { +exitApp: () => void, +addEventListener: ( eventName: BackPressEventName, handler: BackPressHandler, ) => {remove: () => void, ...}, -|}; +}; let BackHandler: TBackHandler = { exitApp: emptyFunction, diff --git a/packages/react-native/Libraries/Utilities/BackHandler.js.flow b/packages/react-native/Libraries/Utilities/BackHandler.js.flow index aec78e1697004b..5eaaa1cd00cfb7 100644 --- a/packages/react-native/Libraries/Utilities/BackHandler.js.flow +++ b/packages/react-native/Libraries/Utilities/BackHandler.js.flow @@ -12,12 +12,12 @@ type BackPressEventName = 'backPress' | 'hardwareBackPress'; -type TBackHandler = {| +type TBackHandler = { +exitApp: () => void, +addEventListener: ( eventName: BackPressEventName, handler: () => ?boolean, ) => {remove: () => void, ...}, -|}; +}; declare module.exports: TBackHandler; diff --git a/packages/react-native/Libraries/Utilities/HMRClient.js b/packages/react-native/Libraries/Utilities/HMRClient.js index c7832f7bb469e0..d17b8841949164 100644 --- a/packages/react-native/Libraries/Utilities/HMRClient.js +++ b/packages/react-native/Libraries/Utilities/HMRClient.js @@ -39,7 +39,7 @@ type LogLevel = | 'groupEnd' | 'debug'; -export type HMRClientNativeInterface = {| +export type HMRClientNativeInterface = { enable(): void, disable(): void, registerBundle(requestUrl: string): void, @@ -53,7 +53,7 @@ export type HMRClientNativeInterface = {| scheme?: string, ): void, unstable_notifyFuseboxConsoleEnabled(): void, -|}; +}; /** * HMR Client that receives from the server HMR updates and propagates them diff --git a/packages/react-native/Libraries/Utilities/Platform.android.js b/packages/react-native/Libraries/Utilities/Platform.android.js index 756fd50dcf6a31..19b41325bef734 100644 --- a/packages/react-native/Libraries/Utilities/Platform.android.js +++ b/packages/react-native/Libraries/Utilities/Platform.android.js @@ -24,15 +24,15 @@ const Platform: PlatformType = { return this.constants.Version; }, // $FlowFixMe[unsafe-getters-setters] - get constants(): {| + get constants(): { isTesting: boolean, isDisableAnimations?: boolean, - reactNativeVersion: {| + reactNativeVersion: { major: number, minor: number, patch: number, prerelease: ?string, - |}, + }, Version: number, Release: string, Serial: string, @@ -42,7 +42,7 @@ const Platform: PlatformType = { uiMode: string, Brand: string, Manufacturer: string, - |} { + } { // $FlowFixMe[object-this-reference] if (this.__constants == null) { // $FlowFixMe[object-this-reference] diff --git a/packages/react-native/Libraries/Utilities/Platform.flow.js b/packages/react-native/Libraries/Utilities/Platform.flow.js index 674d94388db1f2..1bfbdf28e6d7da 100644 --- a/packages/react-native/Libraries/Utilities/Platform.flow.js +++ b/packages/react-native/Libraries/Utilities/Platform.flow.js @@ -22,21 +22,21 @@ type IOSPlatform = { // $FlowFixMe[unsafe-getters-setters] get Version(): string, // $FlowFixMe[unsafe-getters-setters] - get constants(): {| + get constants(): { forceTouchAvailable: boolean, interfaceIdiom: string, isTesting: boolean, isDisableAnimations?: boolean, osVersion: string, - reactNativeVersion: {| + reactNativeVersion: { major: number, minor: number, patch: number, prerelease: ?string, - |}, + }, systemName: string, isMacCatalyst?: boolean, - |}, + }, // $FlowFixMe[unsafe-getters-setters] get isPad(): boolean, // $FlowFixMe[unsafe-getters-setters] @@ -58,15 +58,15 @@ type AndroidPlatform = { // $FlowFixMe[unsafe-getters-setters] get Version(): number, // $FlowFixMe[unsafe-getters-setters] - get constants(): {| + get constants(): { isTesting: boolean, isDisableAnimations?: boolean, - reactNativeVersion: {| + reactNativeVersion: { major: number, minor: number, patch: number, prerelease: ?string, - |}, + }, Version: number, Release: string, Serial: string, @@ -76,7 +76,7 @@ type AndroidPlatform = { uiMode: string, Brand: string, Manufacturer: string, - |}, + }, // $FlowFixMe[unsafe-getters-setters] get isTV(): boolean, // $FlowFixMe[unsafe-getters-setters] diff --git a/packages/react-native/Libraries/Utilities/Platform.ios.js b/packages/react-native/Libraries/Utilities/Platform.ios.js index a26a50f79460c9..10990969c13538 100644 --- a/packages/react-native/Libraries/Utilities/Platform.ios.js +++ b/packages/react-native/Libraries/Utilities/Platform.ios.js @@ -24,21 +24,21 @@ const Platform: PlatformType = { return this.constants.osVersion; }, // $FlowFixMe[unsafe-getters-setters] - get constants(): {| + get constants(): { forceTouchAvailable: boolean, interfaceIdiom: string, isTesting: boolean, isDisableAnimations?: boolean, osVersion: string, - reactNativeVersion: {| + reactNativeVersion: { major: number, minor: number, patch: number, prerelease: ?string, - |}, + }, systemName: string, isMacCatalyst?: boolean, - |} { + } { // $FlowFixMe[object-this-reference] if (this.__constants == null) { // $FlowFixMe[object-this-reference] diff --git a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js index 3642b8c20aba17..4b00e93106e1b7 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js @@ -10,9 +10,9 @@ const {dispatchCommand} = require('../ReactNative/RendererProxy'); -type Options = $ReadOnly<{| +type Options = $ReadOnly<{ supportedCommands: $ReadOnlyArray, -|}>; +}>; function codegenNativeCommands(options: Options<$Keys>): T { const commandObj: {[$Keys]: (...$ReadOnlyArray) => void} = {}; diff --git a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js index cd2d9ee5998fa2..ccb894b1397524 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js @@ -16,12 +16,12 @@ import requireNativeComponent from '../../Libraries/ReactNative/requireNativeCom import UIManager from '../ReactNative/UIManager'; // TODO: import from CodegenSchema once workspaces are enabled -type Options = $ReadOnly<{| +type Options = $ReadOnly<{ interfaceOnly?: boolean, paperComponentName?: string, paperComponentNameDeprecated?: string, excludedPlatforms?: $ReadOnlyArray<'iOS' | 'android'>, -|}>; +}>; export type NativeComponentType = HostComponent; diff --git a/packages/react-native/Libraries/Utilities/differ/deepDiffer.js b/packages/react-native/Libraries/Utilities/differ/deepDiffer.js index b0af0244a65487..27cef58afa97b1 100644 --- a/packages/react-native/Libraries/Utilities/differ/deepDiffer.js +++ b/packages/react-native/Libraries/Utilities/differ/deepDiffer.js @@ -12,11 +12,11 @@ let logListeners; -type LogListeners = {| +type LogListeners = { +onDifferentFunctionsIgnored: (nameOne: ?string, nameTwo: ?string) => void, -|}; +}; -type Options = {|+unsafelyIgnoreFunctions?: boolean|}; +type Options = {+unsafelyIgnoreFunctions?: boolean}; function unstable_setLogListeners(listeners: ?LogListeners) { logListeners = listeners; diff --git a/packages/react-native/Libraries/Utilities/stringifySafe.js b/packages/react-native/Libraries/Utilities/stringifySafe.js index 042fe0bfcda77c..c0903a7a420dd5 100644 --- a/packages/react-native/Libraries/Utilities/stringifySafe.js +++ b/packages/react-native/Libraries/Utilities/stringifySafe.js @@ -14,12 +14,12 @@ import invariant from 'invariant'; * Tries to stringify with JSON.stringify and toString, but catches exceptions * (e.g. from circular objects) and always returns a string and never throws. */ -export function createStringifySafeWithLimits(limits: {| +export function createStringifySafeWithLimits(limits: { maxDepth?: number, maxStringLimit?: number, maxArrayLimit?: number, maxObjectKeysLimit?: number, -|}): mixed => string { +}): mixed => string { const { maxDepth = Number.POSITIVE_INFINITY, maxStringLimit = Number.POSITIVE_INFINITY, diff --git a/packages/react-native/Libraries/YellowBox/YellowBoxDeprecated.js b/packages/react-native/Libraries/YellowBox/YellowBoxDeprecated.js index 93c3926b0c7308..c6a0f0d964cc16 100644 --- a/packages/react-native/Libraries/YellowBox/YellowBoxDeprecated.js +++ b/packages/react-native/Libraries/YellowBox/YellowBoxDeprecated.js @@ -16,7 +16,7 @@ import React from 'react'; const LogBox = require('../LogBox/LogBox').default; -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; let YellowBox; if (__DEV__) { diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 5ff675086e6788..d918673f27cb4a 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -3,7 +3,7 @@ exports[`public API should not change unintentionally Libraries/ActionSheetIOS/ActionSheetIOS.js 1`] = ` "declare const ActionSheetIOS: { showActionSheetWithOptions( - options: {| + options: { +title?: ?string, +message?: ?string, +options: Array, @@ -15,7 +15,7 @@ exports[`public API should not change unintentionally Libraries/ActionSheetIOS/A +disabledButtonTintColor?: ColorValue | ProcessedColorValue, +userInterfaceStyle?: string, +disabledButtonIndices?: Array, - |}, + }, callback: (buttonIndex: number) => void ): void, showShareActionSheetWithOptions( @@ -1640,16 +1640,16 @@ declare module.exports: legacySendAccessibilityEvent; exports[`public API should not change unintentionally Libraries/Components/ActivityIndicator/ActivityIndicator.js 1`] = ` "type IndicatorSize = number | \\"small\\" | \\"large\\"; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ hidesWhenStopped?: ?boolean, -|}>; -type Props = $ReadOnly<{| +}>; +type Props = $ReadOnly<{ ...ViewProps, ...IOSProps, animating?: ?boolean, color?: ?ColorValue, size?: ?IndicatorSize, -|}>; +}>; declare const ActivityIndicatorWithRef: component( ref: React.RefSetter>, ...props: Props @@ -1665,7 +1665,7 @@ declare export default typeof ActivityIndicatorViewNativeComponent; `; exports[`public API should not change unintentionally Libraries/Components/Button.js 1`] = ` -"type ButtonProps = $ReadOnly<{| +"type ButtonProps = $ReadOnly<{ title: string, onPress: (event?: PressEvent) => mixed, touchSoundDisabled?: ?boolean, @@ -1692,7 +1692,7 @@ exports[`public API should not change unintentionally Libraries/Components/Butto importantForAccessibility?: ?(\\"auto\\" | \\"yes\\" | \\"no\\" | \\"no-hide-descendants\\"), accessibilityHint?: ?string, accessibilityLanguage?: ?Stringish, -|}>; +}>; declare const Touchable: | typeof TouchableNativeFeedback | typeof TouchableOpacity; @@ -1738,28 +1738,28 @@ export type KeyboardEventEasing = | \\"easeOut\\" | \\"linear\\" | \\"keyboard\\"; -export type KeyboardMetrics = $ReadOnly<{| +export type KeyboardMetrics = $ReadOnly<{ screenX: number, screenY: number, width: number, height: number, -|}>; +}>; export type KeyboardEvent = AndroidKeyboardEvent | IOSKeyboardEvent; -type BaseKeyboardEvent = {| +type BaseKeyboardEvent = { duration: number, easing: KeyboardEventEasing, endCoordinates: KeyboardMetrics, -|}; -export type AndroidKeyboardEvent = $ReadOnly<{| +}; +export type AndroidKeyboardEvent = $ReadOnly<{ ...BaseKeyboardEvent, duration: 0, easing: \\"keyboard\\", -|}>; -export type IOSKeyboardEvent = $ReadOnly<{| +}>; +export type IOSKeyboardEvent = $ReadOnly<{ ...BaseKeyboardEvent, startCoordinates: KeyboardMetrics, isEventFromThisApp: boolean, -|}>; +}>; type KeyboardEventDefinitions = { keyboardWillShow: [KeyboardEvent], keyboardDidShow: [KeyboardEvent], @@ -1788,16 +1788,16 @@ declare module.exports: Keyboard; `; exports[`public API should not change unintentionally Libraries/Components/Keyboard/KeyboardAvoidingView.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ ...ViewProps, behavior?: ?(\\"height\\" | \\"position\\" | \\"padding\\"), contentContainerStyle?: ?ViewStyleProp, enabled?: ?boolean, keyboardVerticalOffset?: number, -|}>; -type State = {| +}>; +type State = { bottom: number, -|}; +}; declare class KeyboardAvoidingView extends React.Component { _frame: ?ViewLayout; _keyboardEvent: ?KeyboardEvent; @@ -1849,10 +1849,10 @@ declare export default typeof LayoutConformanceNativeComponent; exports[`public API should not change unintentionally Libraries/Components/Pressable/Pressable.js 1`] = ` "type ViewStyleProp = $ElementType, \\"style\\">; -export type StateCallbackType = $ReadOnly<{| +export type StateCallbackType = $ReadOnly<{ pressed: boolean, -|}>; -type Props = $ReadOnly<{| +}>; +type Props = $ReadOnly<{ accessibilityActions?: ?$ReadOnlyArray, accessibilityElementsHidden?: ?boolean, accessibilityHint?: ?Stringish, @@ -1902,7 +1902,7 @@ type Props = $ReadOnly<{| testOnly_pressed?: ?boolean, unstable_pressDelay?: ?number, \\"aria-label\\"?: ?string, -|}>; +}>; declare export default component( ref: React.RefSetter>, ...props: Props @@ -1911,29 +1911,29 @@ declare export default component( `; exports[`public API should not change unintentionally Libraries/Components/Pressable/useAndroidRippleForView.js 1`] = ` -"type NativeBackgroundProp = $ReadOnly<{| +"type NativeBackgroundProp = $ReadOnly<{ type: \\"RippleAndroid\\", color: ?number, borderless: boolean, rippleRadius: ?number, -|}>; -export type RippleConfig = {| +}>; +export type RippleConfig = { color?: ColorValue, borderless?: boolean, radius?: number, foreground?: boolean, -|}; +}; declare export default function useAndroidRippleForView( rippleConfig: ?RippleConfig, - viewRef: {| current: null | React.ElementRef |} -): ?$ReadOnly<{| + viewRef: { current: null | React.ElementRef } +): ?$ReadOnly<{ onPressIn: (event: PressEvent) => void, onPressMove: (event: PressEvent) => void, onPressOut: (event: PressEvent) => void, viewProps: - | $ReadOnly<{| nativeBackgroundAndroid: NativeBackgroundProp |}> - | $ReadOnly<{| nativeForegroundAndroid: NativeBackgroundProp |}>, -|}>; + | $ReadOnly<{ nativeBackgroundAndroid: NativeBackgroundProp }> + | $ReadOnly<{ nativeForegroundAndroid: NativeBackgroundProp }>, +}>; " `; @@ -1965,25 +1965,25 @@ declare export default typeof PullToRefreshViewNativeComponent; exports[`public API should not change unintentionally Libraries/Components/RefreshControl/RefreshControl.js 1`] = ` "declare const React: $FlowFixMe; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ tintColor?: ?ColorValue, titleColor?: ?ColorValue, title?: ?string, -|}>; -type AndroidProps = $ReadOnly<{| +}>; +type AndroidProps = $ReadOnly<{ enabled?: ?boolean, colors?: ?$ReadOnlyArray, progressBackgroundColor?: ?ColorValue, size?: ?(\\"default\\" | \\"large\\"), -|}>; -export type RefreshControlProps = $ReadOnly<{| +}>; +export type RefreshControlProps = $ReadOnly<{ ...ViewProps, ...IOSProps, ...AndroidProps, onRefresh?: ?() => void | Promise, refreshing: boolean, progressViewOffset?: ?number, -|}>; +}>; declare class RefreshControl extends React.Component { _nativeRef: ?React.ElementRef< | typeof PullToRefreshViewNativeComponent @@ -2036,7 +2036,7 @@ declare export default typeof ScrollContentViewNativeComponent; `; exports[`public API should not change unintentionally Libraries/Components/ScrollView/ScrollView.js 1`] = ` -"export type ScrollViewImperativeMethods = $ReadOnly<{| +"export type ScrollViewImperativeMethods = $ReadOnly<{ getScrollResponder: $PropertyType, getScrollableNode: $PropertyType, getInnerViewNode: $PropertyType, @@ -2050,15 +2050,15 @@ exports[`public API should not change unintentionally Libraries/Components/Scrol ScrollView, \\"scrollResponderScrollNativeHandleToKeyboard\\", >, -|}>; +}>; export type DecelerationRateType = \\"fast\\" | \\"normal\\" | number; export type ScrollResponderType = ScrollViewImperativeMethods; -type PublicScrollViewInstance = $ReadOnly<{| +type PublicScrollViewInstance = $ReadOnly<{ ...HostInstance, ...ScrollViewImperativeMethods, -|}>; +}>; type InnerViewInstance = React.ElementRef; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ automaticallyAdjustContentInsets?: ?boolean, automaticallyAdjustKeyboardInsets?: ?boolean, automaticallyAdjustsScrollIndicatorInsets?: ?boolean, @@ -2087,22 +2087,22 @@ type IOSProps = $ReadOnly<{| | \\"never\\" | \\"always\\" ), -|}>; -type AndroidProps = $ReadOnly<{| +}>; +type AndroidProps = $ReadOnly<{ nestedScrollEnabled?: ?boolean, endFillColor?: ?ColorValue, scrollPerfTag?: ?string, overScrollMode?: ?(\\"auto\\" | \\"always\\" | \\"never\\"), persistentScrollbar?: ?boolean, fadingEdgeLength?: ?number, -|}>; +}>; type StickyHeaderComponentType = component( ref?: React.RefSetter< $ReadOnly void }>, >, ...ScrollViewStickyHeaderProps ); -export type Props = $ReadOnly<{| +export type Props = $ReadOnly<{ ...ViewProps, ...IOSProps, ...AndroidProps, @@ -2115,10 +2115,10 @@ export type Props = $ReadOnly<{| invertStickyHeaders?: ?boolean, keyboardDismissMode?: ?(\\"none\\" | \\"on-drag\\" | \\"interactive\\"), keyboardShouldPersistTaps?: ?(\\"always\\" | \\"never\\" | \\"handled\\" | true | false), - maintainVisibleContentPosition?: ?$ReadOnly<{| + maintainVisibleContentPosition?: ?$ReadOnly<{ minIndexForVisible: number, autoscrollToTopThreshold?: ?number, - |}>, + }>, onMomentumScrollBegin?: ?(event: ScrollEvent) => void, onMomentumScrollEnd?: ?(event: ScrollEvent) => void, onScroll?: ?(event: ScrollEvent) => void, @@ -2146,13 +2146,13 @@ export type Props = $ReadOnly<{| children?: React.Node, innerViewRef?: React.RefSetter, scrollViewRef?: React.RefSetter, -|}>; -type State = {| +}>; +type State = { layoutHeight: ?number, -|}; -export type ScrollViewComponentStatics = $ReadOnly<{| +}; +export type ScrollViewComponentStatics = $ReadOnly<{ Context: typeof ScrollViewContext, -|}>; +}>; declare class ScrollView extends React.Component { static Context: typeof ScrollViewContext; constructor(props: Props): void; @@ -2202,13 +2202,13 @@ declare class ScrollView extends React.Component { preventNegativeScrollOffset?: boolean ) => void; scrollResponderZoomTo: ( - rect: {| + rect: { x: number, y: number, width: number, height: number, animated?: boolean, - |}, + }, animated?: boolean ) => void; _textInputFocusError(): void; @@ -2292,13 +2292,13 @@ interface NativeCommands { ) => void; +zoomToRect: ( viewRef: React.ElementRef, - rect: {| + rect: { x: Double, y: Double, width: Double, height: Double, animated?: boolean, - |}, + }, animated?: boolean ) => void; } @@ -2434,10 +2434,10 @@ declare module.exports: SoundManager; exports[`public API should not change unintentionally Libraries/Components/StaticRenderer.js 1`] = ` "declare const React: $FlowFixMe; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ shouldUpdate: boolean, render: () => React.Node, -|}>; +}>; declare class StaticRenderer extends React.Component { shouldComponentUpdate(nextProps: Props): boolean; render(): React.Node; @@ -2471,21 +2471,21 @@ export type StatusBarAnimation = $Keys<{ slide: string, ... }>; -type AndroidProps = $ReadOnly<{| +type AndroidProps = $ReadOnly<{ backgroundColor?: ?ColorValue, translucent?: ?boolean, -|}>; -type IOSProps = $ReadOnly<{| +}>; +type IOSProps = $ReadOnly<{ networkActivityIndicatorVisible?: ?boolean, showHideTransition?: ?(\\"fade\\" | \\"slide\\" | \\"none\\"), -|}>; -type Props = $ReadOnly<{| +}>; +type Props = $ReadOnly<{ ...AndroidProps, ...IOSProps, hidden?: ?boolean, animated?: ?boolean, barStyle?: ?(\\"default\\" | \\"light-content\\" | \\"dark-content\\"), -|}>; +}>; type StackProps = { backgroundColor: ?{ value: Props[\\"backgroundColor\\"], @@ -2536,24 +2536,24 @@ declare export default typeof AndroidSwitchNativeComponent; exports[`public API should not change unintentionally Libraries/Components/Switch/Switch.js 1`] = ` "type SwitchChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ value: boolean, target: number, - |}>, + }>, >; -export type Props = $ReadOnly<{| +export type Props = $ReadOnly<{ ...ViewProps, disabled?: ?boolean, value?: ?boolean, thumbColor?: ?ColorValue, - trackColor?: ?$ReadOnly<{| + trackColor?: ?$ReadOnly<{ false?: ?ColorValue, true?: ?ColorValue, - |}>, + }>, ios_backgroundColor?: ?ColorValue, onChange?: ?(event: SwitchChangeEvent) => Promise | void, onValueChange?: ?(value: boolean) => Promise | void, -|}>; +}>; type SwitchRef = React.ElementRef< typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent, >; @@ -2601,8 +2601,8 @@ export type ReturnKeyType = | \\"route\\" | \\"yahoo\\"; export type SubmitBehavior = \\"submit\\" | \\"blurAndSubmit\\" | \\"newline\\"; -export type NativeProps = $ReadOnly<{| - ...$Diff>, +export type NativeProps = $ReadOnly<{ + ...$Diff>, autoComplete?: WithDefault< | \\"birthdate-day\\" | \\"birthdate-full\\" @@ -2668,72 +2668,70 @@ export type NativeProps = $ReadOnly<{| returnKeyType?: WithDefault, maxLength?: ?Int32, multiline?: ?boolean, - onBlur?: ?BubblingEventHandler<$ReadOnly<{| target: Int32 |}>>, - onFocus?: ?BubblingEventHandler<$ReadOnly<{| target: Int32 |}>>, + onBlur?: ?BubblingEventHandler<$ReadOnly<{ target: Int32 }>>, + onFocus?: ?BubblingEventHandler<$ReadOnly<{ target: Int32 }>>, onChange?: ?BubblingEventHandler< - $ReadOnly<{| target: Int32, eventCount: Int32, text: string |}>, + $ReadOnly<{ target: Int32, eventCount: Int32, text: string }>, >, onChangeText?: ?BubblingEventHandler< - $ReadOnly<{| target: Int32, eventCount: Int32, text: string |}>, + $ReadOnly<{ target: Int32, eventCount: Int32, text: string }>, >, onContentSizeChange?: ?DirectEventHandler< - $ReadOnly<{| + $ReadOnly<{ target: Int32, - contentSize: $ReadOnly<{| width: Double, height: Double |}>, - |}>, + contentSize: $ReadOnly<{ width: Double, height: Double }>, + }>, >, onEndEditing?: ?BubblingEventHandler< - $ReadOnly<{| target: Int32, text: string |}>, + $ReadOnly<{ target: Int32, text: string }>, >, onSelectionChange?: ?DirectEventHandler< - $ReadOnly<{| + $ReadOnly<{ target: Int32, - selection: $ReadOnly<{| start: Double, end: Double |}>, - |}>, + selection: $ReadOnly<{ start: Double, end: Double }>, + }>, >, onSubmitEditing?: ?BubblingEventHandler< - $ReadOnly<{| target: Int32, text: string |}>, - >, - onKeyPress?: ?BubblingEventHandler< - $ReadOnly<{| target: Int32, key: string |}>, + $ReadOnly<{ target: Int32, text: string }>, >, + onKeyPress?: ?BubblingEventHandler<$ReadOnly<{ target: Int32, key: string }>>, onScroll?: ?DirectEventHandler< - $ReadOnly<{| + $ReadOnly<{ target: Int32, responderIgnoreScroll: boolean, - contentInset: $ReadOnly<{| + contentInset: $ReadOnly<{ top: Double, bottom: Double, left: Double, right: Double, - |}>, - contentOffset: $ReadOnly<{| + }>, + contentOffset: $ReadOnly<{ x: Double, y: Double, - |}>, - contentSize: $ReadOnly<{| + }>, + contentSize: $ReadOnly<{ width: Double, height: Double, - |}>, - layoutMeasurement: $ReadOnly<{| + }>, + layoutMeasurement: $ReadOnly<{ width: Double, height: Double, - |}>, - velocity: $ReadOnly<{| + }>, + velocity: $ReadOnly<{ x: Double, y: Double, - |}>, - |}>, + }>, + }>, >, placeholder?: ?Stringish, placeholderTextColor?: ?ColorValue, secureTextEntry?: ?boolean, selectionColor?: ?ColorValue, selectionHandleColor?: ?ColorValue, - selection?: ?$ReadOnly<{| + selection?: ?$ReadOnly<{ start: Int32, end?: ?Int32, - |}>, + }>, value?: ?string, defaultValue?: ?string, selectTextOnFocus?: ?boolean, @@ -2746,7 +2744,7 @@ export type NativeProps = $ReadOnly<{| textShadowRadius?: ?Float, textDecorationLine?: ?string, fontStyle?: ?string, - textShadowOffset?: ?$ReadOnly<{| width?: ?Double, height?: ?Double |}>, + textShadowOffset?: ?$ReadOnly<{ width?: ?Double, height?: ?Double }>, lineHeight?: ?Float, textTransform?: ?string, color?: ?Int32, @@ -2760,7 +2758,7 @@ export type NativeProps = $ReadOnly<{| cursorColor?: ?ColorValue, mostRecentEventCount: Int32, text?: ?string, -|}>; +}>; type NativeType = HostComponent; type NativeCommands = TextInputNativeCommands; declare export const Commands: NativeCommands; @@ -2770,12 +2768,12 @@ declare export default HostComponent; `; exports[`public API should not change unintentionally Libraries/Components/TextInput/InputAccessoryView.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ +children: React.Node, nativeID?: ?string, style?: ?ViewStyleProp, backgroundColor?: ?ColorValue, -|}>; +}>; declare const InputAccessoryView: React.ComponentType; declare export default typeof InputAccessoryView; " @@ -2819,63 +2817,63 @@ exports[`public API should not change unintentionally Libraries/Components/TextI | { current: null | T, ... } | ((ref: null | T) => mixed); export type ChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, target: number, text: string, - |}>, + }>, >; export type TextInputEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, previousText: string, - range: $ReadOnly<{| + range: $ReadOnly<{ start: number, end: number, - |}>, + }>, target: number, text: string, - |}>, + }>, >; export type ContentSizeChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - contentSize: $ReadOnly<{| + contentSize: $ReadOnly<{ width: number, height: number, - |}>, - |}>, + }>, + }>, >; type TargetEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - |}>, + }>, >; export type BlurEvent = TargetEvent; export type FocusEvent = TargetEvent; -type Selection = $ReadOnly<{| +type Selection = $ReadOnly<{ start: number, end: number, -|}>; +}>; export type SelectionChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ selection: Selection, target: number, - |}>, + }>, >; export type KeyPressEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ key: string, target?: ?number, eventCount?: ?number, - |}>, + }>, >; export type EditingEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, text: string, target: number, - |}>, + }>, >; type DataDetectorTypesType = | \\"phoneNumber\\" @@ -2983,7 +2981,7 @@ export type enterKeyHintType = | \\"search\\" | \\"send\\"; type PasswordRules = string; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ disableKeyboardShortcuts?: ?boolean, clearButtonMode?: ?(\\"never\\" | \\"while-editing\\" | \\"unless-editing\\" | \\"always\\"), clearTextOnFocus?: ?boolean, @@ -3009,8 +3007,8 @@ type IOSProps = $ReadOnly<{| | \\"tail\\" ), smartInsertDelete?: ?boolean, -|}>; -type AndroidProps = $ReadOnly<{| +}>; +type AndroidProps = $ReadOnly<{ cursorColor?: ?ColorValue, selectionHandleColor?: ?ColorValue, disableFullscreenUI?: ?boolean, @@ -3029,9 +3027,9 @@ type AndroidProps = $ReadOnly<{| showSoftInputOnFocus?: ?boolean, textBreakStrategy?: ?(\\"simple\\" | \\"highQuality\\" | \\"balanced\\"), underlineColorAndroid?: ?ColorValue, -|}>; -export type Props = $ReadOnly<{| - ...$Diff>, +}>; +export type Props = $ReadOnly<{ + ...$Diff>, ...IOSProps, ...AndroidProps, autoCapitalize?: ?AutoCapitalize, @@ -3129,35 +3127,35 @@ export type Props = $ReadOnly<{| readOnly?: ?boolean, returnKeyType?: ?ReturnKeyType, secureTextEntry?: ?boolean, - selection?: ?$ReadOnly<{| + selection?: ?$ReadOnly<{ start: number, end?: ?number, - |}>, + }>, selectionColor?: ?ColorValue, selectTextOnFocus?: ?boolean, blurOnSubmit?: ?boolean, submitBehavior?: ?SubmitBehavior, style?: ?TextStyleProp, value?: ?Stringish, -|}>; -type ImperativeMethods = $ReadOnly<{| +}>; +type ImperativeMethods = $ReadOnly<{ clear: () => void, isFocused: () => boolean, getNativeRef: () => ?HostInstance, setSelection: (start: number, end: number) => void, -|}>; +}>; type InternalTextInput = component( ref: React.RefSetter<$ReadOnly<{ ...HostInstance, ...ImperativeMethods }>>, ...Props ); -export type TextInputComponentStatics = $ReadOnly<{| - State: $ReadOnly<{| +export type TextInputComponentStatics = $ReadOnly<{ + State: $ReadOnly<{ currentlyFocusedInput: () => ?HostInstance, currentlyFocusedField: () => ?number, focusTextInput: (textField: ?HostInstance) => void, blurTextInput: (textField: ?HostInstance) => void, - |}>, -|}>; + }>, +}>; export type TextInputType = InternalTextInput & TextInputComponentStatics; " `; @@ -3173,63 +3171,63 @@ type TextInputInstance = HostInstance & { +setSelection: (start: number, end: number) => void, }; export type ChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, target: number, text: string, - |}>, + }>, >; export type TextInputEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, previousText: string, - range: $ReadOnly<{| + range: $ReadOnly<{ start: number, end: number, - |}>, + }>, target: number, text: string, - |}>, + }>, >; export type ContentSizeChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - contentSize: $ReadOnly<{| + contentSize: $ReadOnly<{ width: number, height: number, - |}>, - |}>, + }>, + }>, >; type TargetEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - |}>, + }>, >; export type BlurEvent = TargetEvent; export type FocusEvent = TargetEvent; -type Selection = $ReadOnly<{| +type Selection = $ReadOnly<{ start: number, end: number, -|}>; +}>; export type SelectionChangeEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ selection: Selection, target: number, - |}>, + }>, >; export type KeyPressEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ key: string, target?: ?number, eventCount?: ?number, - |}>, + }>, >; export type EditingEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ eventCount: number, text: string, target: number, - |}>, + }>, >; type DataDetectorTypesType = | \\"phoneNumber\\" @@ -3337,7 +3335,7 @@ export type enterKeyHintType = | \\"previous\\" | \\"enter\\"; type PasswordRules = string; -type IOSProps = $ReadOnly<{| +type IOSProps = $ReadOnly<{ disableKeyboardShortcuts?: ?boolean, clearButtonMode?: ?(\\"never\\" | \\"while-editing\\" | \\"unless-editing\\" | \\"always\\"), clearTextOnFocus?: ?boolean, @@ -3363,8 +3361,8 @@ type IOSProps = $ReadOnly<{| | \\"tail\\" ), smartInsertDelete?: ?boolean, -|}>; -type AndroidProps = $ReadOnly<{| +}>; +type AndroidProps = $ReadOnly<{ cursorColor?: ?ColorValue, disableFullscreenUI?: ?boolean, importantForAutofill?: ?( @@ -3382,9 +3380,9 @@ type AndroidProps = $ReadOnly<{| showSoftInputOnFocus?: ?boolean, textBreakStrategy?: ?(\\"simple\\" | \\"highQuality\\" | \\"balanced\\"), underlineColorAndroid?: ?ColorValue, -|}>; -export type Props = $ReadOnly<{| - ...$Diff>, +}>; +export type Props = $ReadOnly<{ + ...$Diff>, ...IOSProps, ...AndroidProps, autoCapitalize?: ?AutoCapitalize, @@ -3479,10 +3477,10 @@ export type Props = $ReadOnly<{| readOnly?: ?boolean, returnKeyType?: ?ReturnKeyType, secureTextEntry?: ?boolean, - selection?: ?$ReadOnly<{| + selection?: ?$ReadOnly<{ start: number, end?: ?number, - |}>, + }>, selectionColor?: ?ColorValue, selectionHandleColor?: ?ColorValue, selectTextOnFocus?: ?boolean, @@ -3490,15 +3488,15 @@ export type Props = $ReadOnly<{| submitBehavior?: ?SubmitBehavior, style?: ?TextStyleProp, value?: ?Stringish, -|}>; -export type TextInputComponentStatics = $ReadOnly<{| - State: $ReadOnly<{| +}>; +export type TextInputComponentStatics = $ReadOnly<{ + State: $ReadOnly<{ currentlyFocusedInput: typeof TextInputState.currentlyFocusedInput, currentlyFocusedField: typeof TextInputState.currentlyFocusedField, focusTextInput: typeof TextInputState.focusTextInput, blurTextInput: typeof TextInputState.blurTextInput, - |}>, -|}>; + }>, +}>; declare module.exports: TextInputType; " `; @@ -3707,7 +3705,7 @@ declare export default typeof Touchable; `; exports[`public API should not change unintentionally Libraries/Components/Touchable/TouchableBounce.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ ...React.ElementConfig, onPressAnimationComplete?: ?() => void, onPressWithCompletion?: ?(callback: () => void) => void, @@ -3715,26 +3713,26 @@ exports[`public API should not change unintentionally Libraries/Components/Touch releaseVelocity?: ?number, style?: ?ViewStyleProp, hostRef: React.RefSetter>, -|}>; +}>; declare module.exports: component( ref: React.RefSetter, - ...props: $ReadOnly<$Diff> + ...props: $ReadOnly<$Diff> ); " `; exports[`public API should not change unintentionally Libraries/Components/Touchable/TouchableHighlight.js 1`] = ` -"type AndroidProps = $ReadOnly<{| +"type AndroidProps = $ReadOnly<{ nextFocusDown?: ?number, nextFocusForward?: ?number, nextFocusLeft?: ?number, nextFocusRight?: ?number, nextFocusUp?: ?number, -|}>; -type IOSProps = $ReadOnly<{| +}>; +type IOSProps = $ReadOnly<{ hasTVPreferredFocus?: ?boolean, -|}>; -type Props = $ReadOnly<{| +}>; +type Props = $ReadOnly<{ ...React.ElementConfig, ...AndroidProps, ...IOSProps, @@ -3745,32 +3743,32 @@ type Props = $ReadOnly<{| onHideUnderlay?: ?() => void, testOnly_pressed?: ?boolean, hostRef: React.RefSetter>, -|}>; +}>; declare const Touchable: component( ref: React.RefSetter>, - ...props: $ReadOnly<$Diff> + ...props: $ReadOnly<$Diff> ); declare module.exports: Touchable; " `; exports[`public API should not change unintentionally Libraries/Components/Touchable/TouchableNativeFeedback.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ ...React.ElementConfig, background?: ?( - | $ReadOnly<{| + | $ReadOnly<{ type: \\"ThemeAttrAndroid\\", attribute: | \\"selectableItemBackground\\" | \\"selectableItemBackgroundBorderless\\", rippleRadius: ?number, - |}> - | $ReadOnly<{| + }> + | $ReadOnly<{ type: \\"RippleAndroid\\", color: ?number, borderless: boolean, rippleRadius: ?number, - |}> + }> ), hasTVPreferredFocus?: ?boolean, nextFocusDown?: ?number, @@ -3779,31 +3777,31 @@ exports[`public API should not change unintentionally Libraries/Components/Touch nextFocusRight?: ?number, nextFocusUp?: ?number, useForeground?: ?boolean, -|}>; -type State = $ReadOnly<{| +}>; +type State = $ReadOnly<{ pressability: Pressability, -|}>; +}>; declare class TouchableNativeFeedback extends React.Component { - static SelectableBackground: (rippleRadius: ?number) => $ReadOnly<{| + static SelectableBackground: (rippleRadius: ?number) => $ReadOnly<{ attribute: \\"selectableItemBackground\\", type: \\"ThemeAttrAndroid\\", rippleRadius: ?number, - |}>; - static SelectableBackgroundBorderless: (rippleRadius: ?number) => $ReadOnly<{| + }>; + static SelectableBackgroundBorderless: (rippleRadius: ?number) => $ReadOnly<{ attribute: \\"selectableItemBackgroundBorderless\\", type: \\"ThemeAttrAndroid\\", rippleRadius: ?number, - |}>; + }>; static Ripple: ( color: string, borderless: boolean, rippleRadius: ?number - ) => $ReadOnly<{| + ) => $ReadOnly<{ borderless: boolean, color: ?number, rippleRadius: ?number, type: \\"RippleAndroid\\", - |}>; + }>; static canUseNativeForeground: () => boolean; state: State; _createPressabilityConfig(): PressabilityConfig; @@ -3819,21 +3817,21 @@ declare module.exports: TouchableNativeFeedback; `; exports[`public API should not change unintentionally Libraries/Components/Touchable/TouchableOpacity.js 1`] = ` -"type TVProps = $ReadOnly<{| +"type TVProps = $ReadOnly<{ hasTVPreferredFocus?: ?boolean, nextFocusDown?: ?number, nextFocusForward?: ?number, nextFocusLeft?: ?number, nextFocusRight?: ?number, nextFocusUp?: ?number, -|}>; -type Props = $ReadOnly<{| +}>; +type Props = $ReadOnly<{ ...React.ElementConfig, ...TVProps, activeOpacity?: ?number, style?: ?ViewStyleProp, hostRef?: ?React.RefSetter>, -|}>; +}>; declare const Touchable: component( ref: React.RefSetter>, ...props: Props @@ -3843,7 +3841,7 @@ declare module.exports: Touchable; `; exports[`public API should not change unintentionally Libraries/Components/Touchable/TouchableWithoutFeedback.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ accessibilityActions?: ?$ReadOnlyArray, accessibilityElementsHidden?: ?boolean, accessibilityHint?: ?Stringish, @@ -3891,7 +3889,7 @@ exports[`public API should not change unintentionally Libraries/Components/Touch rejectResponderTermination?: ?boolean, testID?: ?string, touchSoundDisabled?: ?boolean, -|}>; +}>; declare module.exports: (props: Props) => React.Node; " `; @@ -4086,12 +4084,12 @@ export type AccessibilityState = { expanded?: ?boolean, ... }; -export type AccessibilityValue = $ReadOnly<{| +export type AccessibilityValue = $ReadOnly<{ min?: number, max?: number, now?: number, text?: Stringish, -|}>; +}>; " `; @@ -4110,18 +4108,18 @@ export type ViewNativeComponentType = HostComponent; exports[`public API should not change unintentionally Libraries/Components/View/ViewPropTypes.js 1`] = ` "export type ViewLayout = Layout; export type ViewLayoutEvent = LayoutEvent; -type DirectEventProps = $ReadOnly<{| +type DirectEventProps = $ReadOnly<{ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed, onAccessibilityTap?: ?() => mixed, onLayout?: ?(event: LayoutEvent) => mixed, onMagicTap?: ?() => mixed, onAccessibilityEscape?: ?() => mixed, -|}>; -type MouseEventProps = $ReadOnly<{| +}>; +type MouseEventProps = $ReadOnly<{ onMouseEnter?: ?(event: MouseEvent) => void, onMouseLeave?: ?(event: MouseEvent) => void, -|}>; -type PointerEventProps = $ReadOnly<{| +}>; +type PointerEventProps = $ReadOnly<{ onClick?: ?(event: PointerEvent) => void, onClickCapture?: ?(event: PointerEvent) => void, onPointerEnter?: ?(event: PointerEvent) => void, @@ -4144,14 +4142,14 @@ type PointerEventProps = $ReadOnly<{| onGotPointerCaptureCapture?: ?(e: PointerEvent) => void, onLostPointerCapture?: ?(e: PointerEvent) => void, onLostPointerCaptureCapture?: ?(e: PointerEvent) => void, -|}>; -type FocusEventProps = $ReadOnly<{| +}>; +type FocusEventProps = $ReadOnly<{ onBlur?: ?(event: BlurEvent) => void, onBlurCapture?: ?(event: BlurEvent) => void, onFocus?: ?(event: FocusEvent) => void, onFocusCapture?: ?(event: FocusEvent) => void, -|}>; -type TouchEventProps = $ReadOnly<{| +}>; +type TouchEventProps = $ReadOnly<{ onTouchCancel?: ?(e: PressEvent) => void, onTouchCancelCapture?: ?(e: PressEvent) => void, onTouchEnd?: ?(e: PressEvent) => void, @@ -4160,8 +4158,8 @@ type TouchEventProps = $ReadOnly<{| onTouchMoveCapture?: ?(e: PressEvent) => void, onTouchStart?: ?(e: PressEvent) => void, onTouchStartCapture?: ?(e: PressEvent) => void, -|}>; -type GestureResponderEventProps = $ReadOnly<{| +}>; +type GestureResponderEventProps = $ReadOnly<{ onMoveShouldSetResponder?: ?(e: PressEvent) => boolean, onMoveShouldSetResponderCapture?: ?(e: PressEvent) => boolean, onResponderGrant?: ?(e: PressEvent) => void | boolean, @@ -4174,19 +4172,19 @@ type GestureResponderEventProps = $ReadOnly<{| onResponderTerminationRequest?: ?(e: PressEvent) => boolean, onStartShouldSetResponder?: ?(e: PressEvent) => boolean, onStartShouldSetResponderCapture?: ?(e: PressEvent) => boolean, -|}>; -type AndroidDrawableThemeAttr = $ReadOnly<{| +}>; +type AndroidDrawableThemeAttr = $ReadOnly<{ type: \\"ThemeAttrAndroid\\", attribute: string, -|}>; -type AndroidDrawableRipple = $ReadOnly<{| +}>; +type AndroidDrawableRipple = $ReadOnly<{ type: \\"RippleAndroid\\", color?: ?number, borderless?: ?boolean, rippleRadius?: ?number, -|}>; +}>; type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple; -type AndroidViewProps = $ReadOnly<{| +type AndroidViewProps = $ReadOnly<{ accessibilityLabelledBy?: ?string | ?Array, \\"aria-labelledby\\"?: ?string, accessibilityLiveRegion?: ?(\\"none\\" | \\"polite\\" | \\"assertive\\"), @@ -4204,8 +4202,8 @@ type AndroidViewProps = $ReadOnly<{| focusable?: boolean, tabIndex?: 0 | -1, onClick?: ?(event: PressEvent) => mixed, -|}>; -type IOSViewProps = $ReadOnly<{| +}>; +type IOSViewProps = $ReadOnly<{ accessibilityIgnoresInvertColors?: ?boolean, accessibilityViewIsModal?: ?boolean, accessibilityShowsLargeContentViewer?: ?boolean, @@ -4214,8 +4212,8 @@ type IOSViewProps = $ReadOnly<{| accessibilityElementsHidden?: ?boolean, accessibilityLanguage?: ?Stringish, shouldRasterizeIOS?: ?boolean, -|}>; -export type ViewProps = $ReadOnly<{| +}>; +export type ViewProps = $ReadOnly<{ ...DirectEventProps, ...GestureResponderEventProps, ...MouseEventProps, @@ -4254,7 +4252,7 @@ export type ViewProps = $ReadOnly<{| hitSlop?: ?EdgeInsetsOrSizeProp, pointerEvents?: ?(\\"auto\\" | \\"box-none\\" | \\"box-only\\" | \\"none\\"), removeClippedSubviews?: ?boolean, -|}>; +}>; " `; @@ -4409,10 +4407,10 @@ declare export default typeof NativeExceptionsManager; `; exports[`public API should not change unintentionally Libraries/Core/RawEventEmitter.js 1`] = ` -"export type RawEventEmitterEvent = $ReadOnly<{| +"export type RawEventEmitterEvent = $ReadOnly<{ eventName: string, nativeEvent: { [string]: mixed }, -|}>; +}>; type RawEventDefinitions = { [eventChannel: string]: [RawEventEmitterEvent], }; @@ -4465,7 +4463,7 @@ exports[`public API should not change unintentionally Libraries/Core/Timers/JSTi | \\"requestAnimationFrame\\" | \\"queueReactNativeMicrotask\\" | \\"requestIdleCallback\\"; -declare let ExportedJSTimers: {| +declare let ExportedJSTimers: { callIdleCallbacks: (frameTime: number) => any | void, callReactNativeMicrotasks: () => void, callTimers: (timersToCall: Array) => any | void, @@ -4480,7 +4478,7 @@ declare let ExportedJSTimers: {| queueReactNativeMicrotask: (func: any, ...args: any) => number, setInterval: (func: any, duration: number, ...args: any) => number, setTimeout: (func: any, duration: number, ...args: any) => number, -|}; +}; declare module.exports: ExportedJSTimers; " `; @@ -4649,12 +4647,12 @@ declare module.exports: RCTNativeAppEventEmitter; `; exports[`public API should not change unintentionally Libraries/Events/CustomEvent.js 1`] = ` -"type CustomEvent$Options = $ReadOnly<{| +"type CustomEvent$Options = $ReadOnly<{ bubbles?: boolean, cancelable?: boolean, composed?: boolean, detail?: { ... }, -|}>; +}>; declare class CustomEvent extends EventPolyfill { detail: ?{ ... }; constructor(typeArg: string, options: CustomEvent$Options): void; @@ -4732,13 +4730,13 @@ exports[`public API should not change unintentionally Libraries/Image/AssetRegis `; exports[`public API should not change unintentionally Libraries/Image/AssetSourceResolver.js 1`] = ` -"export type ResolvedAssetSource = {| +"export type ResolvedAssetSource = { +__packager_asset: boolean, +width: ?number, +height: ?number, +uri: string, +scale: number, -|}; +}; declare class AssetSourceResolver { serverUrl: ?string; jsbundleUrl: ?string; @@ -4823,30 +4821,30 @@ declare export function useWrapRefWithImageAttachedCallbacks( exports[`public API should not change unintentionally Libraries/Image/ImageProps.js 1`] = ` "export type ImageLoadEvent = SyntheticEvent< - $ReadOnly<{| - source: $ReadOnly<{| + $ReadOnly<{ + source: $ReadOnly<{ width: number, height: number, uri: string, - |}>, - |}>, + }>, + }>, >; -type IOSImageProps = $ReadOnly<{| +type IOSImageProps = $ReadOnly<{ defaultSource?: ?ImageSource, onPartialLoad?: ?() => void, onProgress?: ?( - event: SyntheticEvent<$ReadOnly<{| loaded: number, total: number |}>> + event: SyntheticEvent<$ReadOnly<{ loaded: number, total: number }>> ) => void, -|}>; -type AndroidImageProps = $ReadOnly<{| - loadingIndicatorSource?: ?(number | $ReadOnly<{| uri: string |}>), +}>; +type AndroidImageProps = $ReadOnly<{ + loadingIndicatorSource?: ?(number | $ReadOnly<{ uri: string }>), progressiveRenderingEnabled?: ?boolean, fadeDuration?: ?number, resizeMethod?: ?(\\"auto\\" | \\"resize\\" | \\"scale\\" | \\"none\\"), resizeMultiplier?: ?number, -|}>; -export type ImageProps = $ReadOnly<{| - ...$Diff>, +}>; +export type ImageProps = $ReadOnly<{ + ...$Diff>, ...IOSImageProps, ...AndroidImageProps, accessible?: ?boolean, @@ -4862,9 +4860,9 @@ export type ImageProps = $ReadOnly<{| width?: number, onError?: ?( event: SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ error: string, - |}>, + }>, > ) => void, onLayout?: ?(event: LayoutEvent) => mixed, @@ -4889,14 +4887,14 @@ export type ImageProps = $ReadOnly<{| src?: ?string, srcSet?: ?string, children?: empty, -|}>; -export type ImageBackgroundProps = $ReadOnly<{| +}>; +export type ImageBackgroundProps = $ReadOnly<{ ...ImageProps, children?: Node, style?: ?ViewStyleProp, imageStyle?: ?ImageStyleProp, imageRef?: RefSetter>, -|}>; +}>; " `; @@ -5088,13 +5086,13 @@ declare export default typeof TextInlineImage; `; exports[`public API should not change unintentionally Libraries/Image/nativeImageSource.js 1`] = ` -"type NativeImageSourceSpec = $ReadOnly<{| +"type NativeImageSourceSpec = $ReadOnly<{ android?: string, ios?: string, default?: string, height: number, width: number, -|}>; +}>; declare function nativeImageSource(spec: NativeImageSourceSpec): ImageURISource; declare module.exports: nativeImageSource; " @@ -5144,13 +5142,13 @@ declare module.exports: ElementBox; `; exports[`public API should not change unintentionally Libraries/Inspector/ElementProperties.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ hierarchy: ?InspectorData[\\"hierarchy\\"], style?: ?ViewStyleProp, frame?: ?Object, selection?: ?number, setSelection?: (number) => mixed, -|}>; +}>; declare class ElementProperties extends React.Component { render(): React.Node; } @@ -5176,17 +5174,17 @@ declare module.exports: Inspector; `; exports[`public API should not change unintentionally Libraries/Inspector/InspectorOverlay.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ inspected?: ?InspectedElement, onTouchPoint: (locationX: number, locationY: number) => void, -|}>; +}>; declare function InspectorOverlay(Props): React.Node; declare module.exports: InspectorOverlay; " `; exports[`public API should not change unintentionally Libraries/Inspector/InspectorPanel.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ devtoolsIsOpen: boolean, inspecting: boolean, setInspecting: (val: boolean) => void, @@ -5200,7 +5198,7 @@ exports[`public API should not change unintentionally Libraries/Inspector/Inspec selection?: ?number, setSelection: (number) => mixed, inspected?: ?InspectedElement, -|}>; +}>; declare class InspectorPanel extends React.Component { renderWaiting(): React.Node; render(): React.Node; @@ -5233,11 +5231,11 @@ type NetworkRequestInfo = { serverError?: Object, ... }; -type Props = $ReadOnly<{||}>; -type State = {| +type Props = $ReadOnly<{}>; +type State = { detailRowId: ?number, requests: Array, -|}; +}; declare class NetworkOverlay extends React.Component { _requestsListView: ?React.ElementRef>>; _detailScrollView: ?React.ElementRef; @@ -5319,12 +5317,12 @@ exports[`public API should not change unintentionally Libraries/Inspector/resolv "declare function resolveBoxStyle( prefix: string, style: Object -): ?$ReadOnly<{| +): ?$ReadOnly<{ bottom: number, left: number, right: number, top: number, -|}>; +}>; declare module.exports: resolveBoxStyle; " `; @@ -5421,7 +5419,7 @@ declare export default typeof NativeFrameRateLogger; `; exports[`public API should not change unintentionally Libraries/Interaction/PanResponder.js 1`] = ` -"export type GestureState = {| +"export type GestureState = { stateID: number, moveX: number, moveY: number, @@ -5433,13 +5431,13 @@ exports[`public API should not change unintentionally Libraries/Interaction/PanR vy: number, numberActiveTouches: number, _accountsForMovesUpTo: number, -|}; +}; type ActiveCallback = ( event: PressEvent, gestureState: GestureState ) => boolean; type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed; -export type PanHandlers = {| +export type PanHandlers = { onMoveShouldSetResponder: (event: PressEvent) => boolean, onMoveShouldSetResponderCapture: (event: PressEvent) => boolean, onResponderEnd: (event: PressEvent) => void, @@ -5452,8 +5450,8 @@ export type PanHandlers = {| onResponderTerminationRequest: (event: PressEvent) => boolean, onStartShouldSetResponder: (event: PressEvent) => boolean, onStartShouldSetResponderCapture: (event: PressEvent) => boolean, -|}; -type PanResponderConfig = $ReadOnly<{| +}; +type PanResponderConfig = $ReadOnly<{ onMoveShouldSetPanResponder?: ?ActiveCallback, onMoveShouldSetPanResponderCapture?: ?ActiveCallback, onStartShouldSetPanResponder?: ?ActiveCallback, @@ -5467,7 +5465,7 @@ type PanResponderConfig = $ReadOnly<{| onPanResponderTerminate?: ?PassiveCallback, onPanResponderTerminationRequest?: ?ActiveCallback, onShouldBlockNativeResponder?: ?ActiveCallback, -|}>; +}>; declare const PanResponder: { _initializeGestureState(gestureState: GestureState): void, _updateGestureStateOnMove( @@ -5700,10 +5698,10 @@ declare module.exports: FillRateHelper; exports[`public API should not change unintentionally Libraries/Lists/FlatList.js 1`] = ` "declare const View: $FlowFixMe; declare const React: $FlowFixMe; -type RequiredProps = {| +type RequiredProps = { data: ?$ReadOnly<$ArrayLike>, -|}; -type OptionalProps = {| +}; +type OptionalProps = { renderItem?: ?RenderItemType, columnWrapperStyle?: ViewStyleProp, extraData?: any, @@ -5725,11 +5723,11 @@ type OptionalProps = {| removeClippedSubviews?: boolean, fadingEdgeLength?: ?number, strictMode?: boolean, -|}; -type FlatListProps = {| +}; +type FlatListProps = { ...RequiredProps, ...OptionalProps, -|}; +}; type VirtualizedListProps = React.ElementConfig; export type Props = { ...$Diff< @@ -5799,10 +5797,10 @@ declare module.exports: FlatList; exports[`public API should not change unintentionally Libraries/Lists/SectionList.js 1`] = ` "type Item = any; export type SectionBase = _SectionBase; -type RequiredProps> = {| +type RequiredProps> = { sections: $ReadOnlyArray, -|}; -type OptionalProps> = {| +}; +type OptionalProps> = { renderItem?: (info: { item: Item, index: number, @@ -5821,8 +5819,8 @@ type OptionalProps> = {| keyExtractor?: ?(item: Item, index: number) => string, onEndReached?: ?(info: { distanceFromEnd: number, ... }) => void, removeClippedSubviews?: boolean, -|}; -export type Props = {| +}; +export type Props = { ...$Diff< VirtualizedSectionListProps, { @@ -5844,7 +5842,7 @@ export type Props = {| >, ...RequiredProps, ...OptionalProps, -|}; +}; declare export default class SectionList> extends React.PureComponent, void> { @@ -5865,10 +5863,10 @@ declare export default class SectionList> exports[`public API should not change unintentionally Libraries/Lists/SectionListModern.js 1`] = ` "type Item = any; export type SectionBase = _SectionBase; -type RequiredProps> = {| +type RequiredProps> = { sections: $ReadOnlyArray, -|}; -type OptionalProps> = {| +}; +type OptionalProps> = { renderItem?: (info: { item: Item, index: number, @@ -5887,8 +5885,8 @@ type OptionalProps> = {| keyExtractor?: ?(item: Item, index: number) => string, onEndReached?: ?(info: { distanceFromEnd: number, ... }) => void, removeClippedSubviews?: boolean, -|}; -export type Props> = $ReadOnly<{| +}; +export type Props> = $ReadOnly<{ ...$Diff< VirtualizedSectionListProps, { @@ -5910,7 +5908,7 @@ export type Props> = $ReadOnly<{| >, ...RequiredProps, ...OptionalProps, -|}>; +}>; declare const SectionList: component( ref?: React.RefSetter, ...Props> @@ -5976,17 +5974,17 @@ export type LogData = $ReadOnly<{ stack?: string, }>; export type Observer = ( - $ReadOnly<{| + $ReadOnly<{ logs: LogBoxLogs, isDisabled: boolean, selectedLogIndex: number, - |}> + }> ) => void; export type IgnorePattern = string | RegExp; -export type Subscription = $ReadOnly<{| +export type Subscription = $ReadOnly<{ unsubscribe: () => void, -|}>; -export type WarningInfo = {| +}>; +export type WarningInfo = { finalFormat: string, forceDialogImmediately: boolean, suppressDialog_LEGACY: boolean, @@ -5994,13 +5992,13 @@ export type WarningInfo = {| monitorEvent: string | null, monitorListVersion: number, monitorSampleRate: number, -|}; +}; export type WarningFilter = (format: string) => WarningInfo; -type AppInfo = $ReadOnly<{| +type AppInfo = $ReadOnly<{ appVersion: string, engine: string, onPress?: ?() => void, -|}>; +}>; declare export function reportLogBoxError( error: ExtendedError, componentStack?: string @@ -6029,15 +6027,15 @@ declare export function setDisabled(value: boolean): void; declare export function isDisabled(): boolean; declare export function observe(observer: Observer): Subscription; type SubscribedComponent = React.ComponentType< - $ReadOnly<{| + $ReadOnly<{ logs: $ReadOnlyArray, isDisabled: boolean, selectedLogIndex: number, - |}>, + }>, >; declare export function withSubscription( WrappedComponent: SubscribedComponent -): React.ComponentType<{||}>; +): React.ComponentType<{}>; " `; @@ -6070,19 +6068,19 @@ declare class LogBoxLog { isComponentError: boolean; extraData: mixed | void; symbolicated: - | $ReadOnly<{| error: null, stack: null, status: \\"NONE\\" |}> - | $ReadOnly<{| error: null, stack: null, status: \\"PENDING\\" |}> - | $ReadOnly<{| error: null, stack: Stack, status: \\"COMPLETE\\" |}> - | $ReadOnly<{| error: Error, stack: null, status: \\"FAILED\\" |}>; + | $ReadOnly<{ error: null, stack: null, status: \\"NONE\\" }> + | $ReadOnly<{ error: null, stack: null, status: \\"PENDING\\" }> + | $ReadOnly<{ error: null, stack: Stack, status: \\"COMPLETE\\" }> + | $ReadOnly<{ error: Error, stack: null, status: \\"FAILED\\" }>; symbolicatedComponentStack: - | $ReadOnly<{| error: null, componentStack: null, status: \\"NONE\\" |}> - | $ReadOnly<{| error: null, componentStack: null, status: \\"PENDING\\" |}> - | $ReadOnly<{| + | $ReadOnly<{ error: null, componentStack: null, status: \\"NONE\\" }> + | $ReadOnly<{ error: null, componentStack: null, status: \\"PENDING\\" }> + | $ReadOnly<{ error: null, componentStack: ComponentStack, status: \\"COMPLETE\\", - |}> - | $ReadOnly<{| error: Error, componentStack: null, status: \\"FAILED\\" |}>; + }> + | $ReadOnly<{ error: Error, componentStack: null, status: \\"FAILED\\" }>; onNotificationPress: ?() => void; constructor(data: LogBoxLogData): void; incrementCount(): void; @@ -6125,7 +6123,7 @@ export type ExtendedExceptionData = ExceptionData & { ... }; export type Category = string; -export type CodeFrame = $ReadOnly<{| +export type CodeFrame = $ReadOnly<{ content: string, location: ?{ row: number, @@ -6134,24 +6132,24 @@ export type CodeFrame = $ReadOnly<{| }, fileName: string, collapse?: boolean, -|}>; -export type Message = $ReadOnly<{| +}>; +export type Message = $ReadOnly<{ content: string, substitutions: $ReadOnlyArray< - $ReadOnly<{| + $ReadOnly<{ length: number, offset: number, - |}>, + }>, >, -|}>; +}>; export type ComponentStack = $ReadOnlyArray; export type ComponentStackType = \\"legacy\\" | \\"stack\\"; declare export function parseInterpolation( args: $ReadOnlyArray -): $ReadOnly<{| +): $ReadOnly<{ category: Category, message: Message, -|}>; +}>; declare export function parseComponentStack(message: string): { type: ComponentStackType, stack: ComponentStack, @@ -6160,12 +6158,12 @@ declare export function parseLogBoxException( error: ExtendedExceptionData ): LogBoxLogData; declare export function withoutANSIColorStyles(message: mixed): mixed; -declare export function parseLogBoxLog(args: $ReadOnlyArray): {| +declare export function parseLogBoxLog(args: $ReadOnlyArray): { componentStack: ComponentStack, componentStackType: ComponentStackType, category: Category, message: Message, -|}; +}; " `; @@ -6186,29 +6184,29 @@ declare export default ILogBox; `; exports[`public API should not change unintentionally Libraries/LogBox/LogBoxInspectorContainer.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ logs: $ReadOnlyArray, selectedLogIndex: number, isDisabled?: ?boolean, -|}>; +}>; declare export class _LogBoxInspectorContainer extends React.Component { render(): React.Node; _handleDismiss: $FlowFixMe; _handleMinimize: $FlowFixMe; _handleSetSelectedLog: $FlowFixMe; } -declare export default React.ComponentType<{||}>; +declare export default React.ComponentType<{}>; " `; exports[`public API should not change unintentionally Libraries/LogBox/LogBoxNotificationContainer.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ logs: $ReadOnlyArray, selectedLogIndex: number, isDisabled?: ?boolean, -|}>; +}>; declare export function _LogBoxNotificationContainer(props: Props): React.Node; -declare export default React.ComponentType<{||}>; +declare export default React.ComponentType<{}>; " `; @@ -6222,16 +6220,16 @@ exports[`public API should not change unintentionally Libraries/LogBox/UI/AnsiHi `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxButton.js 1`] = ` -"type Props = $ReadOnly<{| - backgroundColor: $ReadOnly<{| +"type Props = $ReadOnly<{ + backgroundColor: $ReadOnly<{ default: string, pressed: string, - |}>, + }>, children?: React.Node, hitSlop?: ?EdgeInsetsProp, onPress?: ?(event: PressEvent) => void, style?: ViewStyleProp, -|}>; +}>; declare function LogBoxButton(props: Props): React.Node; declare export default typeof LogBoxButton; " @@ -6259,9 +6257,9 @@ exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBox `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ codeFrame: ?CodeFrame, -|}>; +}>; declare function LogBoxInspectorCodeFrame(props: Props): React.Node; declare export default typeof LogBoxInspectorCodeFrame; " @@ -6312,43 +6310,43 @@ exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBox `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ collapsed: boolean, message: Message, level: LogLevel, title: string, onPress: () => void, -|}>; +}>; declare function LogBoxInspectorMessageHeader(props: Props): React.Node; declare export default typeof LogBoxInspectorMessageHeader; " `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorReactFrames.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ log: LogBoxLog, -|}>; +}>; declare function LogBoxInspectorReactFrames(props: Props): React.Node; declare export default typeof LogBoxInspectorReactFrames; " `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorSection.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ heading: string, children: React.Node, action?: ?React.Node, -|}>; +}>; declare function LogBoxInspectorSection(props: Props): React.Node; declare export default typeof LogBoxInspectorSection; " `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ onPress?: ?(event: PressEvent) => void, status: \\"COMPLETE\\" | \\"FAILED\\" | \\"NONE\\" | \\"PENDING\\", -|}>; +}>; declare function LogBoxInspectorSourceMapStatus(props: Props): React.Node; declare export default typeof LogBoxInspectorSourceMapStatus; " @@ -6365,10 +6363,10 @@ declare export default typeof LogBoxInspectorStackFrame; `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorStackFrames.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ log: LogBoxLog, onRetry: () => void, -|}>; +}>; declare export function getCollapseMessage( stackFrames: Stack, collapsed: boolean @@ -6444,10 +6442,10 @@ declare export function getTextColor(opacity?: number): string; `; exports[`public API should not change unintentionally Libraries/Modal/Modal.js 1`] = ` -"type OrientationChangeEvent = $ReadOnly<{| +"type OrientationChangeEvent = $ReadOnly<{ orientation: \\"portrait\\" | \\"landscape\\", -|}>; -export type Props = $ReadOnly<{| +}>; +export type Props = $ReadOnly<{ ...ViewProps, animationType?: ?(\\"none\\" | \\"slide\\" | \\"fade\\"), presentationStyle?: ?( @@ -6473,12 +6471,12 @@ export type Props = $ReadOnly<{| >, onOrientationChange?: ?DirectEventHandler, backdropColor?: ?string, -|}>; +}>; type State = { isRendered: boolean, }; declare class Modal extends React.Component { - static defaultProps: {| hardwareAccelerated: boolean, visible: boolean |}; + static defaultProps: { hardwareAccelerated: boolean, visible: boolean }; static contextType: React.Context; _identifier: number; _eventSubscription: ?EventSubscription; @@ -6974,7 +6972,7 @@ exports[`public API should not change unintentionally Libraries/PermissionsAndro ... }; declare class PermissionsAndroid { - PERMISSIONS: $ReadOnly<{| + PERMISSIONS: $ReadOnly<{ ACCEPT_HANDOVER: string, ACCESS_BACKGROUND_LOCATION: string, ACCESS_COARSE_LOCATION: string, @@ -7018,12 +7016,12 @@ declare class PermissionsAndroid { WRITE_CALL_LOG: string, WRITE_CONTACTS: string, WRITE_EXTERNAL_STORAGE: string, - |}>; - RESULTS: $ReadOnly<{| + }>; + RESULTS: $ReadOnly<{ DENIED: \\"denied\\", GRANTED: \\"granted\\", NEVER_ASK_AGAIN: \\"never_ask_again\\", - |}>; + }>; checkPermission(permission: PermissionType): Promise; check(permission: PermissionType): Promise; requestPermission( @@ -7049,7 +7047,7 @@ exports[`public API should not change unintentionally Libraries/Pressability/Hov `; exports[`public API should not change unintentionally Libraries/Pressability/Pressability.js 1`] = ` -"export type PressabilityConfig = $ReadOnly<{| +"export type PressabilityConfig = $ReadOnly<{ cancelable?: ?boolean, disabled?: ?boolean, hitSlop?: ?RectOrSize, @@ -7071,8 +7069,8 @@ exports[`public API should not change unintentionally Libraries/Pressability/Pre onPressMove?: ?(event: PressEvent) => mixed, onPressOut?: ?(event: PressEvent) => mixed, blockNativeResponder?: ?boolean, -|}>; -export type EventHandlers = $ReadOnly<{| +}>; +export type EventHandlers = $ReadOnly<{ onBlur: (event: BlurEvent) => void, onClick: (event: PressEvent) => void, onFocus: (event: FocusEvent) => void, @@ -7086,7 +7084,7 @@ export type EventHandlers = $ReadOnly<{| onResponderTerminate: (event: PressEvent) => void, onResponderTerminationRequest: () => boolean, onStartShouldSetResponder: () => boolean, -|}>; +}>; type TouchState = | \\"NOT_RESPONDER\\" | \\"RESPONDER_INACTIVE_PRESS_IN\\" @@ -7106,16 +7104,16 @@ declare export default class Pressability { _pressDelayTimeout: ?TimeoutID; _pressOutDelayTimeout: ?TimeoutID; _responderID: ?number | HostInstance; - _responderRegion: ?$ReadOnly<{| + _responderRegion: ?$ReadOnly<{ bottom: number, left: number, right: number, top: number, - |}>; - _touchActivatePosition: ?$ReadOnly<{| + }>; + _touchActivatePosition: ?$ReadOnly<{ pageX: number, pageY: number, - |}>; + }>; _touchActivateTime: ?number; _touchState: TouchState; constructor(config: PressabilityConfig): void; @@ -7137,12 +7135,12 @@ declare export default class Pressability { _measureCallback: $FlowFixMe; _isTouchWithinResponderRegion( touch: $PropertyType, - responderRegion: $ReadOnly<{| + responderRegion: $ReadOnly<{ bottom: number, left: number, right: number, top: number, - |}> + }> ): boolean; _handleLongPress(event: PressEvent): void; _cancelHoverInDelayTimeout(): void; @@ -7155,10 +7153,10 @@ declare export default class Pressability { `; exports[`public API should not change unintentionally Libraries/Pressability/PressabilityDebug.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ color: ColorValue, hitSlop: ?RectOrSize, -|}>; +}>; declare export function PressabilityDebugView(props: Props): React.Node; declare export function isEnabled(): boolean; declare export function setEnabled(value: boolean): void; @@ -7166,10 +7164,10 @@ declare export function setEnabled(value: boolean): void; `; exports[`public API should not change unintentionally Libraries/Pressability/PressabilityPerformanceEventEmitter.js 1`] = ` -"export type PressabilityPerformanceEvent = $ReadOnly<{| +"export type PressabilityPerformanceEvent = $ReadOnly<{ signal: TouchSignal, nativeTimestamp: number, -|}>; +}>; export type PressabilityPerformanceEventListener = (PressabilityPerformanceEvent) => void; declare class PressabilityPerformanceEventEmitter { @@ -7292,7 +7290,7 @@ declare module.exports: PushNotificationIOS; `; exports[`public API should not change unintentionally Libraries/ReactNative/AppContainer.js 1`] = ` -"export type Props = $ReadOnly<{| +"export type Props = $ReadOnly<{ children?: React.Node, fabric?: boolean, rootTag: number | RootTag, @@ -7301,7 +7299,7 @@ exports[`public API should not change unintentionally Libraries/ReactNative/AppC rootViewStyle?: ?ViewStyleProp, internal_excludeLogBox?: boolean, internal_excludeInspector?: boolean, -|}>; +}>; declare const AppContainer: component(...Props); declare module.exports: AppContainer; " @@ -7596,20 +7594,20 @@ exports[`public API should not change unintentionally Libraries/ReactNative/Reac `; exports[`public API should not change unintentionally Libraries/ReactNative/ReactNativeFeatureFlags.js 1`] = ` -"export type FeatureFlags = {| +"export type FeatureFlags = { shouldEmitW3CPointerEvents: () => boolean, shouldPressibilityUseW3CPointerEventsForHover: () => boolean, -|}; +}; declare const ReactNativeFeatureFlags: FeatureFlags; declare module.exports: ReactNativeFeatureFlags; " `; exports[`public API should not change unintentionally Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js 1`] = ` -"export type RuntimeDiagnostics = {| +"export type RuntimeDiagnostics = { isEnabled: () => boolean, simulateEarlyJavaScriptErrors: () => void, -|}; +}; export type RuntimeDiagnosticFlag = \\"early_js_errors\\" | \\"all\\"; declare const ReactNativeRuntimeDiagnostics: RuntimeDiagnostics; declare module.exports: ReactNativeRuntimeDiagnostics; @@ -7816,12 +7814,12 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/Point `; exports[`public API should not change unintentionally Libraries/StyleSheet/Rect.js 1`] = ` -"export type Rect = $ReadOnly<{| +"export type Rect = $ReadOnly<{ bottom?: ?number, left?: ?number, right?: ?number, top?: ?number, -|}>; +}>; export type RectOrSize = Rect | number; declare export function createSquare(size: number): Rect; declare export function normalizeRect(rectOrSize: ?RectOrSize): ?Rect; @@ -8298,35 +8296,35 @@ export type ____ViewStyle_InternalOverrides = $ReadOnly<{}>; `; exports[`public API should not change unintentionally Libraries/StyleSheet/private/_TransformStyle.js 1`] = ` -"export type ____TransformStyle_Internal = $ReadOnly<{| +"export type ____TransformStyle_Internal = $ReadOnly<{ transform?: | $ReadOnlyArray< - | {| +perspective: number | AnimatedNode |} - | {| +rotate: string | AnimatedNode |} - | {| +rotateX: string | AnimatedNode |} - | {| +rotateY: string | AnimatedNode |} - | {| +rotateZ: string | AnimatedNode |} - | {| +scale: number | AnimatedNode |} - | {| +scaleX: number | AnimatedNode |} - | {| +scaleY: number | AnimatedNode |} - | {| +translateX: number | AnimatedNode |} - | {| +translateY: number | AnimatedNode |} - | {| + | { +perspective: number | AnimatedNode } + | { +rotate: string | AnimatedNode } + | { +rotateX: string | AnimatedNode } + | { +rotateY: string | AnimatedNode } + | { +rotateZ: string | AnimatedNode } + | { +scale: number | AnimatedNode } + | { +scaleX: number | AnimatedNode } + | { +scaleY: number | AnimatedNode } + | { +translateX: number | AnimatedNode } + | { +translateY: number | AnimatedNode } + | { +translate: | [number | AnimatedNode, number | AnimatedNode] | AnimatedNode, - |} - | {| +skewX: string | AnimatedNode |} - | {| +skewY: string | AnimatedNode |} - | {| + } + | { +skewX: string | AnimatedNode } + | { +skewY: string | AnimatedNode } + | { +matrix: $ReadOnlyArray | AnimatedNode, - |}, + }, > | string, transformOrigin?: | [string | number, string | number, string | number] | string, -|}>; +}>; " `; @@ -8603,14 +8601,14 @@ export type EventEmitter = ( `; exports[`public API should not change unintentionally Libraries/Types/CoreEventTypes.js 1`] = ` -"export type SyntheticEvent<+T> = $ReadOnly<{| +"export type SyntheticEvent<+T> = $ReadOnly<{ bubbles: ?boolean, cancelable: ?boolean, currentTarget: number | HostInstance, defaultPrevented: ?boolean, - dispatchConfig: $ReadOnly<{| + dispatchConfig: $ReadOnly<{ registrationName: string, - |}>, + }>, eventPhase: ?number, preventDefault: () => void, isDefaultPrevented: () => boolean, @@ -8622,15 +8620,15 @@ exports[`public API should not change unintentionally Libraries/Types/CoreEventT target: ?number | HostInstance, timeStamp: number, type: ?string, -|}>; -export type ResponderSyntheticEvent = $ReadOnly<{| +}>; +export type ResponderSyntheticEvent = $ReadOnly<{ ...SyntheticEvent, - touchHistory: $ReadOnly<{| + touchHistory: $ReadOnly<{ indexOfSingleActiveTouch: number, mostRecentTimeStamp: number, numberActiveTouches: number, touchBank: $ReadOnlyArray< - $ReadOnly<{| + $ReadOnly<{ touchActive: boolean, startPageX: number, startPageY: number, @@ -8641,33 +8639,33 @@ export type ResponderSyntheticEvent = $ReadOnly<{| previousPageX: number, previousPageY: number, previousTimeStamp: number, - |}>, + }>, >, - |}>, -|}>; -export type Layout = $ReadOnly<{| + }>, +}>; +export type Layout = $ReadOnly<{ x: number, y: number, width: number, height: number, -|}>; -export type TextLayout = $ReadOnly<{| +}>; +export type TextLayout = $ReadOnly<{ ...Layout, ascender: number, capHeight: number, descender: number, text: string, xHeight: number, -|}>; +}>; export type LayoutEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ layout: Layout, - |}>, + }>, >; export type TextLayoutEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ lines: Array, - |}>, + }>, >; export interface NativeUIEvent { +detail: number; @@ -8705,7 +8703,7 @@ export interface NativePointerEvent extends NativeMouseEvent { } export type PointerEvent = SyntheticEvent; export type PressEvent = ResponderSyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ changedTouches: $ReadOnlyArray<$PropertyType>, force?: number, identifier: number, @@ -8716,58 +8714,58 @@ export type PressEvent = ResponderSyntheticEvent< target: ?number, timestamp: number, touches: $ReadOnlyArray<$PropertyType>, - |}>, + }>, >; export type ScrollEvent = SyntheticEvent< - $ReadOnly<{| - contentInset: $ReadOnly<{| + $ReadOnly<{ + contentInset: $ReadOnly<{ bottom: number, left: number, right: number, top: number, - |}>, - contentOffset: $ReadOnly<{| + }>, + contentOffset: $ReadOnly<{ y: number, x: number, - |}>, - contentSize: $ReadOnly<{| + }>, + contentSize: $ReadOnly<{ height: number, width: number, - |}>, - layoutMeasurement: $ReadOnly<{| + }>, + layoutMeasurement: $ReadOnly<{ height: number, width: number, - |}>, - targetContentOffset?: $ReadOnly<{| + }>, + targetContentOffset?: $ReadOnly<{ y: number, x: number, - |}>, - velocity?: $ReadOnly<{| + }>, + velocity?: $ReadOnly<{ y: number, x: number, - |}>, + }>, zoomScale?: number, responderIgnoreScroll?: boolean, - |}>, + }>, >; export type BlurEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - |}>, + }>, >; export type FocusEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ target: number, - |}>, + }>, >; export type MouseEvent = SyntheticEvent< - $ReadOnly<{| + $ReadOnly<{ clientX: number, clientY: number, pageX: number, pageY: number, timestamp: number, - |}>, + }>, >; " `; @@ -8830,7 +8828,7 @@ exports[`public API should not change unintentionally Libraries/Types/UIManagerJ `; exports[`public API should not change unintentionally Libraries/UTFSequence.js 1`] = ` -"declare const UTFSequence: {| +"declare const UTFSequence: { BOM: string, BULLET: string, BULLET_SP: string, @@ -8846,7 +8844,7 @@ exports[`public API should not change unintentionally Libraries/UTFSequence.js 1 PIZZA: string, TRIANGLE_LEFT: string, TRIANGLE_RIGHT: string, -|}; +}; declare export default typeof UTFSequence; " `; @@ -8862,13 +8860,13 @@ declare export function addChangeListener( exports[`public API should not change unintentionally Libraries/Utilities/BackHandler.js.flow 1`] = ` "type BackPressEventName = \\"backPress\\" | \\"hardwareBackPress\\"; -type TBackHandler = {| +type TBackHandler = { +exitApp: () => void, +addEventListener: ( eventName: BackPressEventName, handler: () => ?boolean ) => { remove: () => void, ... }, -|}; +}; declare module.exports: TBackHandler; " `; @@ -8938,7 +8936,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/HMRCli | \\"groupCollapsed\\" | \\"groupEnd\\" | \\"debug\\"; -export type HMRClientNativeInterface = {| +export type HMRClientNativeInterface = { enable(): void, disable(): void, registerBundle(requestUrl: string): void, @@ -8952,7 +8950,7 @@ export type HMRClientNativeInterface = {| scheme?: string ): void, unstable_notifyFuseboxConsoleEnabled(): void, -|}; +}; declare const HMRClient: HMRClientNativeInterface; declare module.exports: HMRClient; " @@ -9064,21 +9062,21 @@ type IOSPlatform = { __constants: null, OS: \\"ios\\", get Version(): string, - get constants(): {| + get constants(): { forceTouchAvailable: boolean, interfaceIdiom: string, isTesting: boolean, isDisableAnimations?: boolean, osVersion: string, - reactNativeVersion: {| + reactNativeVersion: { major: number, minor: number, patch: number, prerelease: ?string, - |}, + }, systemName: string, isMacCatalyst?: boolean, - |}, + }, get isPad(): boolean, get isTV(): boolean, get isVision(): boolean, @@ -9091,15 +9089,15 @@ type AndroidPlatform = { __constants: null, OS: \\"android\\", get Version(): number, - get constants(): {| + get constants(): { isTesting: boolean, isDisableAnimations?: boolean, - reactNativeVersion: {| + reactNativeVersion: { major: number, minor: number, patch: number, prerelease: ?string, - |}, + }, Version: number, Release: string, Serial: string, @@ -9109,7 +9107,7 @@ type AndroidPlatform = { uiMode: string, Brand: string, Manufacturer: string, - |}, + }, get isTV(): boolean, get isVision(): boolean, get isTesting(): boolean, @@ -9217,9 +9215,9 @@ declare module.exports: binaryToBase64; `; exports[`public API should not change unintentionally Libraries/Utilities/codegenNativeCommands.js 1`] = ` -"type Options = $ReadOnly<{| +"type Options = $ReadOnly<{ supportedCommands: $ReadOnlyArray, -|}>; +}>; declare function codegenNativeCommands( options: Options<$Keys> ): T; @@ -9228,12 +9226,12 @@ declare export default typeof codegenNativeCommands; `; exports[`public API should not change unintentionally Libraries/Utilities/codegenNativeComponent.js 1`] = ` -"type Options = $ReadOnly<{| +"type Options = $ReadOnly<{ interfaceOnly?: boolean, paperComponentName?: string, paperComponentNameDeprecated?: string, excludedPlatforms?: $ReadOnlyArray<\\"iOS\\" | \\"android\\">, -|}>; +}>; export type NativeComponentType = HostComponent; declare function codegenNativeComponent( componentName: string, @@ -9274,7 +9272,7 @@ declare module.exports: defineLazyObjectProperty; `; exports[`public API should not change unintentionally Libraries/Utilities/differ/deepDiffer.js 1`] = ` -"type Options = {| +unsafelyIgnoreFunctions?: boolean |}; +"type Options = { +unsafelyIgnoreFunctions?: boolean }; declare const deepDiffer: ( one: any, two: any, @@ -9354,12 +9352,12 @@ declare module.exports: mapWithSeparator; `; exports[`public API should not change unintentionally Libraries/Utilities/stringifySafe.js 1`] = ` -"declare export function createStringifySafeWithLimits(limits: {| +"declare export function createStringifySafeWithLimits(limits: { maxDepth?: number, maxStringLimit?: number, maxArrayLimit?: number, maxObjectKeysLimit?: number, -|}): (mixed) => string; +}): (mixed) => string; declare const stringifySafe: (mixed) => string; declare export default typeof stringifySafe; " @@ -9517,7 +9515,7 @@ declare module.exports: WebSocketInterceptor; `; exports[`public API should not change unintentionally Libraries/YellowBox/YellowBoxDeprecated.js 1`] = ` -"type Props = $ReadOnly<{||}>; +"type Props = $ReadOnly<{}>; declare module.exports: Class> & { ignoreWarnings($ReadOnlyArray): void, install(): void, diff --git a/packages/react-native/flow/jest.js b/packages/react-native/flow/jest.js index 0f0cfe2b999b4f..5841fe0e5affb0 100644 --- a/packages/react-native/flow/jest.js +++ b/packages/react-native/flow/jest.js @@ -268,7 +268,7 @@ type EnzymeMatchersType = { toIncludeText(text: string): void, toMatchElement( element: React.MixedElement, - options?: {|ignoreProps?: boolean, verbose?: boolean|}, + options?: {ignoreProps?: boolean, verbose?: boolean}, ): void, toMatchSelector(selector: string): void, // 7.x @@ -302,7 +302,7 @@ type DomTestingLibraryType = { toHaveStyle(css: string | {[name: string]: any, ...}): void, toHaveTextContent( text: string | RegExp, - options?: {|normalizeWhitespace: boolean|}, + options?: {normalizeWhitespace: boolean}, ): void, toHaveValue(value?: string | string[] | number): void, @@ -607,14 +607,14 @@ type SnapshotDiffType = { */ toMatchDiffSnapshot( valueB: any, - options?: {| + options?: { expand?: boolean, colors?: boolean, contextLines?: number, stablePatchmarks?: boolean, aAnnotation?: string, bAnnotation?: string, - |}, + }, testName?: string, ): void, ... @@ -994,10 +994,10 @@ type JestObjectType = { type JestSpyType = {calls: JestCallsType, ...}; -type JestDoneFn = {| +type JestDoneFn = { (error?: Error): void, fail: (error: Error) => void, -|}; +}; /** Runs this function after every test inside this context */ declare function afterEach( @@ -1070,7 +1070,7 @@ declare var it: { * @param {Function} Test * @param {number} Timeout for the test, in milliseconds. */ - only: {| + only: { ( name: JestTestName, fn?: (done: JestDoneFn) => ?Promise, @@ -1083,7 +1083,7 @@ declare var it: { fn?: (...args: Array) => ?Promise, timeout?: number, ) => void, - |}, + }, /** * Skip running this test * @@ -1091,7 +1091,7 @@ declare var it: { * @param {Function} Test * @param {number} Timeout for the test, in milliseconds. */ - skip: {| + skip: { ( name: JestTestName, fn?: (done: JestDoneFn) => ?Promise, @@ -1104,7 +1104,7 @@ declare var it: { fn?: (...args: Array) => ?Promise, timeout?: number, ) => void, - |}, + }, /** * Highlight planned tests in the summary output * @@ -1188,7 +1188,7 @@ type JestPrettyFormatRefs = Array; type JestPrettyFormatPrint = any => string; type JestPrettyFormatStringOrNull = string | null; -type JestPrettyFormatOptions = {| +type JestPrettyFormatOptions = { callToJSON: boolean, edgeSpacing: string, escapeRegex: boolean, @@ -1199,14 +1199,14 @@ type JestPrettyFormatOptions = {| plugins: JestPrettyFormatPlugins, printFunctionName: boolean, spacing: string, - theme: {| + theme: { comment: string, content: string, prop: string, tag: string, value: string, - |}, -|}; + }, +}; type JestPrettyFormatPlugin = { print: ( diff --git a/packages/react-native/src/private/specs/components/ActivityIndicatorViewNativeComponent.js b/packages/react-native/src/private/specs/components/ActivityIndicatorViewNativeComponent.js index b24ad41303f443..d1115820ce8df8 100644 --- a/packages/react-native/src/private/specs/components/ActivityIndicatorViewNativeComponent.js +++ b/packages/react-native/src/private/specs/components/ActivityIndicatorViewNativeComponent.js @@ -15,7 +15,7 @@ import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes'; import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, /** @@ -46,7 +46,7 @@ type NativeProps = $ReadOnly<{| * See https://reactnative.dev/docs/activityindicator#size */ size?: WithDefault<'small' | 'large', 'small'>, -|}>; +}>; export default (codegenNativeComponent('ActivityIndicatorView', { paperComponentName: 'RCTActivityIndicatorView', diff --git a/packages/react-native/src/private/specs/components/AndroidDrawerLayoutNativeComponent.js b/packages/react-native/src/private/specs/components/AndroidDrawerLayoutNativeComponent.js index 525009eddb332f..370368bbe89345 100644 --- a/packages/react-native/src/private/specs/components/AndroidDrawerLayoutNativeComponent.js +++ b/packages/react-native/src/private/specs/components/AndroidDrawerLayoutNativeComponent.js @@ -22,15 +22,15 @@ import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNative import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; import * as React from 'react'; -type DrawerStateEvent = $ReadOnly<{| +type DrawerStateEvent = $ReadOnly<{ drawerState: Int32, -|}>; +}>; -type DrawerSlideEvent = $ReadOnly<{| +type DrawerSlideEvent = $ReadOnly<{ offset: Float, -|}>; +}>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, /** * Determines whether the keyboard gets dismissed in response to a drag. @@ -106,7 +106,7 @@ type NativeProps = $ReadOnly<{| * effect on API 21+. */ statusBarBackgroundColor?: ?ColorValue, -|}>; +}>; type NativeType = HostComponent; diff --git a/packages/react-native/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js b/packages/react-native/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js index 7b0f3bdfe1aeec..d6c3fd0af28ffc 100644 --- a/packages/react-native/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +++ b/packages/react-native/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js @@ -13,11 +13,11 @@ import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNati import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, removeClippedSubviews?: ?boolean, -|}>; +}>; type NativeType = HostComponent; diff --git a/packages/react-native/src/private/specs/components/AndroidSwipeRefreshLayoutNativeComponent.js b/packages/react-native/src/private/specs/components/AndroidSwipeRefreshLayoutNativeComponent.js index 3d8a8e52fb8748..1b5d27f92614a1 100644 --- a/packages/react-native/src/private/specs/components/AndroidSwipeRefreshLayoutNativeComponent.js +++ b/packages/react-native/src/private/specs/components/AndroidSwipeRefreshLayoutNativeComponent.js @@ -21,7 +21,7 @@ import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNative import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; import * as React from 'react'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, /** @@ -54,7 +54,7 @@ type NativeProps = $ReadOnly<{| * Whether the view should be indicating an active refresh. */ refreshing: boolean, -|}>; +}>; type NativeType = HostComponent; diff --git a/packages/react-native/src/private/specs/components/AndroidSwitchNativeComponent.js b/packages/react-native/src/private/specs/components/AndroidSwitchNativeComponent.js index 788d8cac6415ae..a57a61e5b9d15d 100644 --- a/packages/react-native/src/private/specs/components/AndroidSwitchNativeComponent.js +++ b/packages/react-native/src/private/specs/components/AndroidSwitchNativeComponent.js @@ -21,12 +21,12 @@ import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNative import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; import * as React from 'react'; -type SwitchChangeEvent = $ReadOnly<{| +type SwitchChangeEvent = $ReadOnly<{ value: boolean, target: Int32, -|}>; +}>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props @@ -42,7 +42,7 @@ type NativeProps = $ReadOnly<{| // Events onChange?: BubblingEventHandler, -|}>; +}>; type NativeType = HostComponent; diff --git a/packages/react-native/src/private/specs/components/DebuggingOverlayNativeComponent.js b/packages/react-native/src/private/specs/components/DebuggingOverlayNativeComponent.js index 1d2f230ce999f0..eea8fa72b5b810 100644 --- a/packages/react-native/src/private/specs/components/DebuggingOverlayNativeComponent.js +++ b/packages/react-native/src/private/specs/components/DebuggingOverlayNativeComponent.js @@ -16,9 +16,9 @@ import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNative import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; import * as React from 'react'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, -|}>; +}>; export type DebuggingOverlayNativeComponentType = HostComponent; export type TraceUpdate = { diff --git a/packages/react-native/src/private/specs/components/ProgressBarAndroidNativeComponent.js b/packages/react-native/src/private/specs/components/ProgressBarAndroidNativeComponent.js index c2878ec5019872..dede4a63b06d33 100644 --- a/packages/react-native/src/private/specs/components/ProgressBarAndroidNativeComponent.js +++ b/packages/react-native/src/private/specs/components/ProgressBarAndroidNativeComponent.js @@ -18,7 +18,7 @@ import type { import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, //Props @@ -29,7 +29,7 @@ type NativeProps = $ReadOnly<{| animating?: WithDefault, color?: ?ColorValue, testID?: WithDefault, -|}>; +}>; export default (codegenNativeComponent('AndroidProgressBar', { interfaceOnly: true, diff --git a/packages/react-native/src/private/specs/components/PullToRefreshViewNativeComponent.js b/packages/react-native/src/private/specs/components/PullToRefreshViewNativeComponent.js index 0e139d5096cde1..8de4e61b088dc4 100644 --- a/packages/react-native/src/private/specs/components/PullToRefreshViewNativeComponent.js +++ b/packages/react-native/src/private/specs/components/PullToRefreshViewNativeComponent.js @@ -21,7 +21,7 @@ import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNative import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; import * as React from 'react'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, /** @@ -50,7 +50,7 @@ type NativeProps = $ReadOnly<{| * Whether the view should be indicating an active refresh. */ refreshing: boolean, -|}>; +}>; type ComponentType = HostComponent; diff --git a/packages/react-native/src/private/specs/components/RCTInputAccessoryViewNativeComponent.js b/packages/react-native/src/private/specs/components/RCTInputAccessoryViewNativeComponent.js index ac19932c3e909e..3f71ae25e20158 100644 --- a/packages/react-native/src/private/specs/components/RCTInputAccessoryViewNativeComponent.js +++ b/packages/react-native/src/private/specs/components/RCTInputAccessoryViewNativeComponent.js @@ -14,10 +14,10 @@ import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet'; import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, backgroundColor?: ?ColorValue, -|}>; +}>; export default (codegenNativeComponent('InputAccessory', { interfaceOnly: true, diff --git a/packages/react-native/src/private/specs/components/RCTModalHostViewNativeComponent.js b/packages/react-native/src/private/specs/components/RCTModalHostViewNativeComponent.js index 58ec2940079bc8..2c7e58f7f557f2 100644 --- a/packages/react-native/src/private/specs/components/RCTModalHostViewNativeComponent.js +++ b/packages/react-native/src/private/specs/components/RCTModalHostViewNativeComponent.js @@ -18,11 +18,11 @@ import type { import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -type OrientationChangeEvent = $ReadOnly<{| +type OrientationChangeEvent = $ReadOnly<{ orientation: 'portrait' | 'landscape', -|}>; +}>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, /** @@ -139,7 +139,7 @@ type NativeProps = $ReadOnly<{| * The `identifier` is the unique number for identifying Modal components. */ identifier?: WithDefault, -|}>; +}>; export default (codegenNativeComponent('ModalHostView', { interfaceOnly: true, diff --git a/packages/react-native/src/private/specs/components/RCTSafeAreaViewNativeComponent.js b/packages/react-native/src/private/specs/components/RCTSafeAreaViewNativeComponent.js index e626f78123f50e..5e9aeb530682e4 100644 --- a/packages/react-native/src/private/specs/components/RCTSafeAreaViewNativeComponent.js +++ b/packages/react-native/src/private/specs/components/RCTSafeAreaViewNativeComponent.js @@ -13,11 +13,11 @@ import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNati import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // No props -|}>; +}>; export default (codegenNativeComponent('SafeAreaView', { paperComponentName: 'RCTSafeAreaView', diff --git a/packages/react-native/src/private/specs/components/SwitchNativeComponent.js b/packages/react-native/src/private/specs/components/SwitchNativeComponent.js index f2f514da0a8f87..f24967511dc8ca 100644 --- a/packages/react-native/src/private/specs/components/SwitchNativeComponent.js +++ b/packages/react-native/src/private/specs/components/SwitchNativeComponent.js @@ -21,12 +21,12 @@ import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNative import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; import * as React from 'react'; -type SwitchChangeEvent = $ReadOnly<{| +type SwitchChangeEvent = $ReadOnly<{ value: boolean, target: Int32, -|}>; +}>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, // Props @@ -43,7 +43,7 @@ type NativeProps = $ReadOnly<{| // Events onChange?: ?BubblingEventHandler, -|}>; +}>; type ComponentType = HostComponent; diff --git a/packages/react-native/src/private/specs/components/UnimplementedNativeViewNativeComponent.js b/packages/react-native/src/private/specs/components/UnimplementedNativeViewNativeComponent.js index 308f0adaf90cb3..d1ba83747327f0 100644 --- a/packages/react-native/src/private/specs/components/UnimplementedNativeViewNativeComponent.js +++ b/packages/react-native/src/private/specs/components/UnimplementedNativeViewNativeComponent.js @@ -14,10 +14,10 @@ import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes'; import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, name?: WithDefault, -|}>; +}>; // NOTE: This component is not implemented in paper // Do not require this file in paper builds diff --git a/packages/react-native/src/private/specs/modules/NativeAccessibilityManager.js b/packages/react-native/src/private/specs/modules/NativeAccessibilityManager.js index 6a978c3ea18560..793847fdae9109 100644 --- a/packages/react-native/src/private/specs/modules/NativeAccessibilityManager.js +++ b/packages/react-native/src/private/specs/modules/NativeAccessibilityManager.js @@ -45,7 +45,7 @@ export interface Spec extends TurboModule { onSuccess: (isScreenReaderEnabled: boolean) => void, onError: (error: Object) => void, ) => void; - +setAccessibilityContentSizeMultipliers: (JSMultipliers: {| + +setAccessibilityContentSizeMultipliers: (JSMultipliers: { +extraSmall?: ?number, +small?: ?number, +medium?: ?number, @@ -58,7 +58,7 @@ export interface Spec extends TurboModule { +accessibilityExtraLarge?: ?number, +accessibilityExtraExtraLarge?: ?number, +accessibilityExtraExtraExtraLarge?: ?number, - |}) => void; + }) => void; +setAccessibilityFocus: (reactTag: number) => void; +announceForAccessibility: (announcement: string) => void; +announceForAccessibilityWithOptions?: ( diff --git a/packages/react-native/src/private/specs/modules/NativeActionSheetManager.js b/packages/react-native/src/private/specs/modules/NativeActionSheetManager.js index 2364a83c4faf49..1141499c2862e9 100644 --- a/packages/react-native/src/private/specs/modules/NativeActionSheetManager.js +++ b/packages/react-native/src/private/specs/modules/NativeActionSheetManager.js @@ -13,9 +13,9 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; +showActionSheetWithOptions: ( - options: {| + options: { +title?: ?string, +message?: ?string, +options: ?Array, @@ -27,11 +27,11 @@ export interface Spec extends TurboModule { +disabledButtonTintColor?: ?number, +userInterfaceStyle?: ?string, +disabledButtonIndices?: Array, - |}, + }, callback: (buttonIndex: number) => void, ) => void; +showShareActionSheetWithOptions: ( - options: {| + options: { +message?: ?string, +url?: ?string, +subject?: ?string, @@ -41,13 +41,13 @@ export interface Spec extends TurboModule { +disabledButtonTintColor?: ?number, +excludedActivityTypes?: ?Array, +userInterfaceStyle?: ?string, - |}, - failureCallback: (error: {| + }, + failureCallback: (error: { +domain: string, +code: string, +userInfo?: ?Object, +message: string, - |}) => void, + }) => void, successCallback: (completed: boolean, activityType: ?string) => void, ) => void; +dismissActionSheet?: () => void; diff --git a/packages/react-native/src/private/specs/modules/NativeAlertManager.js b/packages/react-native/src/private/specs/modules/NativeAlertManager.js index f17ec771418cfe..312a01713f03a8 100644 --- a/packages/react-native/src/private/specs/modules/NativeAlertManager.js +++ b/packages/react-native/src/private/specs/modules/NativeAlertManager.js @@ -12,7 +12,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -export type Args = {| +export type Args = { title?: string, message?: string, buttons?: Array, // TODO(T67565166): have a better type @@ -23,7 +23,7 @@ export type Args = {| preferredButtonKey?: string, keyboardType?: string, userInterfaceStyle?: string, -|}; +}; export interface Spec extends TurboModule { +alertWithArgs: ( diff --git a/packages/react-native/src/private/specs/modules/NativeAnimatedModule.js b/packages/react-native/src/private/specs/modules/NativeAnimatedModule.js index 2c67bfccd7314b..b7746551e61ffe 100644 --- a/packages/react-native/src/private/specs/modules/NativeAnimatedModule.js +++ b/packages/react-native/src/private/specs/modules/NativeAnimatedModule.js @@ -17,10 +17,10 @@ type EndResult = {finished: boolean, value?: number, ...}; type EndCallback = (result: EndResult) => void; type SaveValueCallback = (value: number) => void; -export type EventMapping = {| +export type EventMapping = { nativeEventPath: Array, animatedValueTag: ?number, -|}; +}; // The config has different keys depending on the type of the Node // TODO(T54896888): Make these types strict diff --git a/packages/react-native/src/private/specs/modules/NativeAnimatedTurboModule.js b/packages/react-native/src/private/specs/modules/NativeAnimatedTurboModule.js index 7af2ef159d39fd..7f584685eb1728 100644 --- a/packages/react-native/src/private/specs/modules/NativeAnimatedTurboModule.js +++ b/packages/react-native/src/private/specs/modules/NativeAnimatedTurboModule.js @@ -17,10 +17,10 @@ type EndResult = {finished: boolean, value?: number, ...}; type EndCallback = (result: EndResult) => void; type SaveValueCallback = (value: number) => void; -export type EventMapping = {| +export type EventMapping = { nativeEventPath: Array, animatedValueTag: ?number, -|}; +}; // The config has different keys depending on the type of the Node // TODO(T54896888): Make these types strict diff --git a/packages/react-native/src/private/specs/modules/NativeAppState.js b/packages/react-native/src/private/specs/modules/NativeAppState.js index 5627f7ea25154c..a80e4c2f1aebcb 100644 --- a/packages/react-native/src/private/specs/modules/NativeAppState.js +++ b/packages/react-native/src/private/specs/modules/NativeAppState.js @@ -12,11 +12,11 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -export type AppStateConstants = {| +export type AppStateConstants = { initialAppState: string, -|}; +}; -export type AppState = {|app_state: string|}; +export type AppState = {app_state: string}; export interface Spec extends TurboModule { +getConstants: () => AppStateConstants; diff --git a/packages/react-native/src/private/specs/modules/NativeBlobModule.js b/packages/react-native/src/private/specs/modules/NativeBlobModule.js index f751d2e2634021..b997a7f885537f 100644 --- a/packages/react-native/src/private/specs/modules/NativeBlobModule.js +++ b/packages/react-native/src/private/specs/modules/NativeBlobModule.js @@ -12,7 +12,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -export type Constants = {|BLOB_URI_SCHEME: ?string, BLOB_URI_HOST: ?string|}; +export type Constants = {BLOB_URI_SCHEME: ?string, BLOB_URI_HOST: ?string}; export interface Spec extends TurboModule { +getConstants: () => Constants; diff --git a/packages/react-native/src/private/specs/modules/NativeClipboard.js b/packages/react-native/src/private/specs/modules/NativeClipboard.js index 98e16e3f7e1117..ef3c10f92ff37d 100644 --- a/packages/react-native/src/private/specs/modules/NativeClipboard.js +++ b/packages/react-native/src/private/specs/modules/NativeClipboard.js @@ -13,7 +13,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; +getString: () => Promise; +setString: (content: string) => void; } diff --git a/packages/react-native/src/private/specs/modules/NativeDeviceInfo.js b/packages/react-native/src/private/specs/modules/NativeDeviceInfo.js index 44c18203a91b0d..adb85f1a782f2c 100644 --- a/packages/react-native/src/private/specs/modules/NativeDeviceInfo.js +++ b/packages/react-native/src/private/specs/modules/NativeDeviceInfo.js @@ -12,32 +12,32 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -export type DisplayMetricsAndroid = {| +export type DisplayMetricsAndroid = { width: number, height: number, scale: number, fontScale: number, densityDpi: number, -|}; +}; -export type DisplayMetrics = {| +export type DisplayMetrics = { width: number, height: number, scale: number, fontScale: number, -|}; +}; -export type DimensionsPayload = {| +export type DimensionsPayload = { window?: DisplayMetrics, screen?: DisplayMetrics, windowPhysicalPixels?: DisplayMetricsAndroid, screenPhysicalPixels?: DisplayMetricsAndroid, -|}; +}; -export type DeviceInfoConstants = {| +export type DeviceInfoConstants = { +Dimensions: DimensionsPayload, +isIPhoneX_deprecated?: boolean, -|}; +}; export interface Spec extends TurboModule { +getConstants: () => DeviceInfoConstants; diff --git a/packages/react-native/src/private/specs/modules/NativeDialogManagerAndroid.js b/packages/react-native/src/private/specs/modules/NativeDialogManagerAndroid.js index 07e19b47c14fe9..d64b5deb2e414f 100644 --- a/packages/react-native/src/private/specs/modules/NativeDialogManagerAndroid.js +++ b/packages/react-native/src/private/specs/modules/NativeDialogManagerAndroid.js @@ -20,7 +20,7 @@ type DialogAction = string; buttonNeutral = -3 */ type DialogButtonKey = number; -export type DialogOptions = {| +export type DialogOptions = { title?: string, message?: string, buttonPositive?: string, @@ -28,16 +28,16 @@ export type DialogOptions = {| buttonNeutral?: string, items?: Array, cancelable?: boolean, -|}; +}; export interface Spec extends TurboModule { - +getConstants: () => {| + +getConstants: () => { +buttonClicked: DialogAction, +dismissed: DialogAction, +buttonPositive: DialogButtonKey, +buttonNegative: DialogButtonKey, +buttonNeutral: DialogButtonKey, - |}; + }; +showAlert: ( config: DialogOptions, onError: (error: string) => void, diff --git a/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js b/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js index 0b684c681e7071..7561c1f16359b2 100644 --- a/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js +++ b/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js @@ -14,13 +14,13 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod const Platform = require('../../../../Libraries/Utilities/Platform'); -export type StackFrame = {| +export type StackFrame = { column: ?number, file: ?string, lineNumber: ?number, methodName: string, collapse?: boolean, -|}; +}; export type ExceptionData = { message: string, originalMessage: ?string, diff --git a/packages/react-native/src/private/specs/modules/NativeFrameRateLogger.js b/packages/react-native/src/private/specs/modules/NativeFrameRateLogger.js index fad4ae18adcb46..dcda162b6ac420 100644 --- a/packages/react-native/src/private/specs/modules/NativeFrameRateLogger.js +++ b/packages/react-native/src/private/specs/modules/NativeFrameRateLogger.js @@ -13,7 +13,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +setGlobalOptions: (options: {|+debug?: ?boolean|}) => void; + +setGlobalOptions: (options: {+debug?: ?boolean}) => void; +setContext: (context: string) => void; +beginScroll: () => void; +endScroll: () => void; diff --git a/packages/react-native/src/private/specs/modules/NativeI18nManager.js b/packages/react-native/src/private/specs/modules/NativeI18nManager.js index 5bc91c365fabb1..bede3bcedea190 100644 --- a/packages/react-native/src/private/specs/modules/NativeI18nManager.js +++ b/packages/react-native/src/private/specs/modules/NativeI18nManager.js @@ -12,11 +12,11 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -export type I18nManagerConstants = {| +export type I18nManagerConstants = { doLeftAndRightSwapInRTL: boolean, isRTL: boolean, localeIdentifier?: ?string, -|}; +}; export interface Spec extends TurboModule { +getConstants: () => I18nManagerConstants; diff --git a/packages/react-native/src/private/specs/modules/NativeImageEditor.js b/packages/react-native/src/private/specs/modules/NativeImageEditor.js index 4654b9118bb2a2..37718d92dd0323 100644 --- a/packages/react-native/src/private/specs/modules/NativeImageEditor.js +++ b/packages/react-native/src/private/specs/modules/NativeImageEditor.js @@ -12,19 +12,19 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -type Options = {| - +offset: {| +type Options = { + +offset: { +x: number, +y: number, - |}, - +size: {| + }, + +size: { +width: number, +height: number, - |}, - +displaySize?: ?{| + }, + +displaySize?: ?{ +width: number, +height: number, - |}, + }, /** * Enum with potential values: * - cover @@ -35,10 +35,10 @@ type Options = {| */ +resizeMode?: ?string, +allowExternalStorage?: boolean, -|}; +}; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; +cropImage: ( uri: string, cropData: Options, diff --git a/packages/react-native/src/private/specs/modules/NativeImageLoaderAndroid.js b/packages/react-native/src/private/specs/modules/NativeImageLoaderAndroid.js index f8171272218c8b..35d3de62770b5b 100644 --- a/packages/react-native/src/private/specs/modules/NativeImageLoaderAndroid.js +++ b/packages/react-native/src/private/specs/modules/NativeImageLoaderAndroid.js @@ -20,7 +20,7 @@ export type ImageSize = { export interface Spec extends TurboModule { +abortRequest: (requestId: number) => void; - +getConstants: () => {||}; + +getConstants: () => {}; +getSize: (uri: string) => Promise; +getSizeWithHeaders: (uri: string, headers: Object) => Promise; +prefetchImage: (uri: string, requestId: number) => Promise; diff --git a/packages/react-native/src/private/specs/modules/NativeImageLoaderIOS.js b/packages/react-native/src/private/specs/modules/NativeImageLoaderIOS.js index b3d73201313e8b..c3350e6bc90a9b 100644 --- a/packages/react-native/src/private/specs/modules/NativeImageLoaderIOS.js +++ b/packages/react-native/src/private/specs/modules/NativeImageLoaderIOS.js @@ -14,7 +14,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; // Return [width, height] of image uri +getSize: (uri: string) => Promise<$ReadOnlyArray>; +getSizeWithHeaders: ( diff --git a/packages/react-native/src/private/specs/modules/NativeImageStoreAndroid.js b/packages/react-native/src/private/specs/modules/NativeImageStoreAndroid.js index 4962c037dc3c91..ac9ac5d6a40114 100644 --- a/packages/react-native/src/private/specs/modules/NativeImageStoreAndroid.js +++ b/packages/react-native/src/private/specs/modules/NativeImageStoreAndroid.js @@ -13,7 +13,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; +getBase64ForTag: ( uri: string, successCallback: (base64ImageData: string) => void, diff --git a/packages/react-native/src/private/specs/modules/NativeImageStoreIOS.js b/packages/react-native/src/private/specs/modules/NativeImageStoreIOS.js index 9e4e2a358e2cd9..006df5102fc862 100644 --- a/packages/react-native/src/private/specs/modules/NativeImageStoreIOS.js +++ b/packages/react-native/src/private/specs/modules/NativeImageStoreIOS.js @@ -13,18 +13,18 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; +getBase64ForTag: ( uri: string, successCallback: (base64ImageData: string) => void, - errorCallback: (error: {|message: string|}) => void, + errorCallback: (error: {message: string}) => void, ) => void; +hasImageForTag: (uri: string, callback: (hasImage: boolean) => void) => void; +removeImageForTag: (uri: string) => void; +addImageFromBase64: ( base64ImageData: string, successCallback: (uri: string) => void, - errorCallback: (error: {|message: string|}) => void, + errorCallback: (error: {message: string}) => void, ) => void; } diff --git a/packages/react-native/src/private/specs/modules/NativeNetworkingIOS.js b/packages/react-native/src/private/specs/modules/NativeNetworkingIOS.js index 1cb2e3e002d106..bf74606cec15b2 100644 --- a/packages/react-native/src/private/specs/modules/NativeNetworkingIOS.js +++ b/packages/react-native/src/private/specs/modules/NativeNetworkingIOS.js @@ -14,7 +14,7 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod export interface Spec extends TurboModule { +sendRequest: ( - query: {| + query: { method: string, url: string, data: Object, @@ -23,7 +23,7 @@ export interface Spec extends TurboModule { incrementalUpdates: boolean, timeout: number, withCredentials: boolean, - |}, + }, callback: (requestId: number) => void, ) => void; +abortRequest: (requestId: number) => void; diff --git a/packages/react-native/src/private/specs/modules/NativePlatformConstantsAndroid.js b/packages/react-native/src/private/specs/modules/NativePlatformConstantsAndroid.js index c68afa54f50612..5ed3f879af991f 100644 --- a/packages/react-native/src/private/specs/modules/NativePlatformConstantsAndroid.js +++ b/packages/react-native/src/private/specs/modules/NativePlatformConstantsAndroid.js @@ -12,14 +12,14 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -export type ReactNativeVersionAndroid = {| +export type ReactNativeVersionAndroid = { major: number, minor: number, patch: number, prerelease: ?string, -|}; +}; -export type PlatformConstantsAndroid = {| +export type PlatformConstantsAndroid = { isTesting: boolean, isDisableAnimations?: boolean, reactNativeVersion: ReactNativeVersionAndroid, @@ -32,7 +32,7 @@ export type PlatformConstantsAndroid = {| uiMode: string, Brand: string, Manufacturer: string, -|}; +}; export interface Spec extends TurboModule { +getConstants: () => PlatformConstantsAndroid; diff --git a/packages/react-native/src/private/specs/modules/NativePlatformConstantsIOS.js b/packages/react-native/src/private/specs/modules/NativePlatformConstantsIOS.js index f35b991b2e5ebe..03477d4a14dbc1 100644 --- a/packages/react-native/src/private/specs/modules/NativePlatformConstantsIOS.js +++ b/packages/react-native/src/private/specs/modules/NativePlatformConstantsIOS.js @@ -12,21 +12,21 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -export type PlatformConstantsIOS = {| +export type PlatformConstantsIOS = { isTesting: boolean, isDisableAnimations?: boolean, - reactNativeVersion: {| + reactNativeVersion: { major: number, minor: number, patch: number, prerelease: ?string, - |}, + }, forceTouchAvailable: boolean, osVersion: string, systemName: string, interfaceIdiom: string, isMacCatalyst?: boolean, -|}; +}; export interface Spec extends TurboModule { +getConstants: () => PlatformConstantsIOS; diff --git a/packages/react-native/src/private/specs/modules/NativePushNotificationManagerIOS.js b/packages/react-native/src/private/specs/modules/NativePushNotificationManagerIOS.js index 52e5fc8f17f3bb..0cd54562b2a7d0 100644 --- a/packages/react-native/src/private/specs/modules/NativePushNotificationManagerIOS.js +++ b/packages/react-native/src/private/specs/modules/NativePushNotificationManagerIOS.js @@ -12,13 +12,13 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -type Permissions = {| +type Permissions = { alert: boolean, badge: boolean, sound: boolean, -|}; +}; -type Notification = {| +type Notification = { +alertTitle?: ?string, +alertBody?: ?string, +userInfo?: ?Object, @@ -55,10 +55,10 @@ type Notification = {| * getScheduledLocalNotifications or getDeliveredNotifications. */ +soundName?: ?string, -|}; +}; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; +onFinishRemoteNotification: ( notificationId: string, /** @@ -71,11 +71,11 @@ export interface Spec extends TurboModule { ) => void; +setApplicationIconBadgeNumber: (num: number) => void; +getApplicationIconBadgeNumber: (callback: (num: number) => void) => void; - +requestPermissions: (permission: {| + +requestPermissions: (permission: { +alert: boolean, +badge: boolean, +sound: boolean, - |}) => Promise; + }) => Promise; +abandonPermissions: () => void; +checkPermissions: (callback: (permissions: Permissions) => void) => void; +presentLocalNotification: (notification: Notification) => void; diff --git a/packages/react-native/src/private/specs/modules/NativeSampleTurboModule.js b/packages/react-native/src/private/specs/modules/NativeSampleTurboModule.js index 0cecad05b3dbe1..49cf9bde46bfba 100644 --- a/packages/react-native/src/private/specs/modules/NativeSampleTurboModule.js +++ b/packages/react-native/src/private/specs/modules/NativeSampleTurboModule.js @@ -36,11 +36,11 @@ export interface Spec extends TurboModule { +onChange: EventEmitter; +onSubmit: EventEmitter; // Exported methods. - +getConstants: () => {| + +getConstants: () => { const1: boolean, const2: number, const3: string, - |}; + }; +voidFunc: () => void; +getBool: (arg: boolean) => boolean; +getEnum?: (arg: EnumInt) => EnumInt; diff --git a/packages/react-native/src/private/specs/modules/NativeSettingsManager.js b/packages/react-native/src/private/specs/modules/NativeSettingsManager.js index 9112f7fdeed988..5f20809ca4e695 100644 --- a/packages/react-native/src/private/specs/modules/NativeSettingsManager.js +++ b/packages/react-native/src/private/specs/modules/NativeSettingsManager.js @@ -13,9 +13,9 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {| + +getConstants: () => { settings: Object, - |}; + }; +setValues: (values: Object) => void; +deleteValues: (values: Array) => void; } diff --git a/packages/react-native/src/private/specs/modules/NativeShareModule.js b/packages/react-native/src/private/specs/modules/NativeShareModule.js index c07fd4ed766114..3ddb767b372786 100644 --- a/packages/react-native/src/private/specs/modules/NativeShareModule.js +++ b/packages/react-native/src/private/specs/modules/NativeShareModule.js @@ -13,11 +13,11 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; +share: ( - content: {|title?: string, message?: string|}, + content: {title?: string, message?: string}, dialogTitle?: string, - ) => Promise<{|action: string|}>; + ) => Promise<{action: string}>; } export default (TurboModuleRegistry.get('ShareModule'): ?Spec); diff --git a/packages/react-native/src/private/specs/modules/NativeSourceCode.js b/packages/react-native/src/private/specs/modules/NativeSourceCode.js index d6b8564b962843..6918a583feeac2 100644 --- a/packages/react-native/src/private/specs/modules/NativeSourceCode.js +++ b/packages/react-native/src/private/specs/modules/NativeSourceCode.js @@ -12,9 +12,9 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -export type SourceCodeConstants = {| +export type SourceCodeConstants = { scriptURL: string, -|}; +}; export interface Spec extends TurboModule { +getConstants: () => SourceCodeConstants; diff --git a/packages/react-native/src/private/specs/modules/NativeStatusBarManagerAndroid.js b/packages/react-native/src/private/specs/modules/NativeStatusBarManagerAndroid.js index f65f934749230a..03ba33b7224899 100644 --- a/packages/react-native/src/private/specs/modules/NativeStatusBarManagerAndroid.js +++ b/packages/react-native/src/private/specs/modules/NativeStatusBarManagerAndroid.js @@ -13,10 +13,10 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {| + +getConstants: () => { +HEIGHT: number, +DEFAULT_BACKGROUND_COLOR: number, - |}; + }; +setColor: (color: number, animated: boolean) => void; +setTranslucent: (translucent: boolean) => void; @@ -33,10 +33,10 @@ const NativeModule = TurboModuleRegistry.getEnforcing('StatusBarManager'); let constants = null; const NativeStatusBarManager = { - getConstants(): {| + getConstants(): { +HEIGHT: number, +DEFAULT_BACKGROUND_COLOR?: number, - |} { + } { if (constants == null) { constants = NativeModule.getConstants(); } diff --git a/packages/react-native/src/private/specs/modules/NativeStatusBarManagerIOS.js b/packages/react-native/src/private/specs/modules/NativeStatusBarManagerIOS.js index 6749e5d076d9fa..a18bc292d52bdb 100644 --- a/packages/react-native/src/private/specs/modules/NativeStatusBarManagerIOS.js +++ b/packages/react-native/src/private/specs/modules/NativeStatusBarManagerIOS.js @@ -13,13 +13,13 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {| + +getConstants: () => { +HEIGHT: number, +DEFAULT_BACKGROUND_COLOR?: number, - |}; + }; // TODO(T47754272) Can we remove this method? - +getHeight: (callback: (result: {|height: number|}) => void) => void; + +getHeight: (callback: (result: {height: number}) => void) => void; +setNetworkActivityIndicatorVisible: (visible: boolean) => void; +addListener: (eventType: string) => void; +removeListeners: (count: number) => void; @@ -41,10 +41,10 @@ const NativeModule = TurboModuleRegistry.getEnforcing('StatusBarManager'); let constants = null; const NativeStatusBarManager = { - getConstants(): {| + getConstants(): { +HEIGHT: number, +DEFAULT_BACKGROUND_COLOR?: number, - |} { + } { if (constants == null) { constants = NativeModule.getConstants(); } @@ -52,7 +52,7 @@ const NativeStatusBarManager = { }, // TODO(T47754272) Can we remove this method? - getHeight(callback: (result: {|height: number|}) => void): void { + getHeight(callback: (result: {height: number}) => void): void { NativeModule.getHeight(callback); }, diff --git a/packages/react-native/src/private/specs/modules/NativeToastAndroid.js b/packages/react-native/src/private/specs/modules/NativeToastAndroid.js index 769985b8ccd59e..5d91ace6d06c02 100644 --- a/packages/react-native/src/private/specs/modules/NativeToastAndroid.js +++ b/packages/react-native/src/private/specs/modules/NativeToastAndroid.js @@ -13,13 +13,13 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {| + +getConstants: () => { SHORT: number, LONG: number, TOP: number, BOTTOM: number, CENTER: number, - |}; + }; +show: (message: string, duration: number) => void; +showWithGravity: ( message: string, diff --git a/packages/react-native/src/private/specs/modules/NativeVibration.js b/packages/react-native/src/private/specs/modules/NativeVibration.js index 0a4bff9a31f40f..64704c8d770081 100644 --- a/packages/react-native/src/private/specs/modules/NativeVibration.js +++ b/packages/react-native/src/private/specs/modules/NativeVibration.js @@ -13,7 +13,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; +vibrate: (pattern: number) => void; // Android only diff --git a/packages/react-native/src/private/specs/modules/NativeWebSocketModule.js b/packages/react-native/src/private/specs/modules/NativeWebSocketModule.js index 268578c3d79ea8..e48223552a7da3 100644 --- a/packages/react-native/src/private/specs/modules/NativeWebSocketModule.js +++ b/packages/react-native/src/private/specs/modules/NativeWebSocketModule.js @@ -16,7 +16,7 @@ export interface Spec extends TurboModule { +connect: ( url: string, protocols: ?Array, - options: {|headers?: Object|}, + options: {headers?: Object}, socketID: number, ) => void; +send: (message: string, forSocketID: number) => void; diff --git a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js index 0729487636372f..a5177c5646beb1 100644 --- a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js +++ b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js @@ -26,7 +26,7 @@ function debug(...args: Array) { // console.log.apply(null, arguments); } -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; type State = { didAnimation: boolean, diff --git a/packages/rn-tester/IntegrationTests/TimersTest.js b/packages/rn-tester/IntegrationTests/TimersTest.js index 3a74f97edf3131..45f1088dc384f6 100644 --- a/packages/rn-tester/IntegrationTests/TimersTest.js +++ b/packages/rn-tester/IntegrationTests/TimersTest.js @@ -15,12 +15,12 @@ const ReactNative = require('react-native'); const {StyleSheet, Text, View} = ReactNative; const {TestModule} = ReactNative.NativeModules; -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; -type State = {| +type State = { count: number, done: boolean, -|}; +}; type ImmediateID = Object; diff --git a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js index 859b2cfc1732dd..44f8c40f8f68ae 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js @@ -26,12 +26,12 @@ type ColorChangedEvent = { }, }; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, opacity?: number, color?: string, onColorChanged?: (event: ColorChangedEvent) => void, -|}>; +}>; export type MyLegacyViewType = HostComponent; diff --git a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js index 4b062598cf100d..8434e5cac65b76 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js @@ -28,7 +28,7 @@ type Event = $ReadOnly<{ doubles: $ReadOnlyArray, yesNos: $ReadOnlyArray<'yep' | 'nope'>, strings: $ReadOnlyArray, - latLons: $ReadOnlyArray<{|lat: Double, lon: Double|}>, + latLons: $ReadOnlyArray<{lat: Double, lon: Double}>, multiArrays: $ReadOnlyArray<$ReadOnlyArray>, }>; @@ -36,7 +36,7 @@ type LegacyStyleEvent = $ReadOnly<{ string: string, }>; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, opacity?: Float, values: $ReadOnlyArray, @@ -47,7 +47,7 @@ type NativeProps = $ReadOnly<{| LegacyStyleEvent, 'alternativeLegacyName', >, -|}>; +}>; export type MyNativeViewType = HostComponent; diff --git a/packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js b/packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js index f0a039add0f190..9065b866d203d9 100644 --- a/packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js +++ b/packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js @@ -16,7 +16,7 @@ import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboMo export type ScreenshotManagerOptions = UnsafeObject; export interface Spec extends TurboModule { - +getConstants: () => {||}; + +getConstants: () => {}; takeScreenshot( id: string, options: ScreenshotManagerOptions, diff --git a/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js b/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js index a98f2ba87d90f7..8d1101db5c2e29 100644 --- a/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js +++ b/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js @@ -20,11 +20,11 @@ type SnapshotReadyEvent = SyntheticEvent< $ReadOnly<{testIdentifier: string, ...}>, >; -type NativeProps = $ReadOnly<{| +type NativeProps = $ReadOnly<{ ...ViewProps, onSnapshotReady?: ?(event: SnapshotReadyEvent) => mixed, testIdentifier?: ?string, -|}>; +}>; const RCTSnapshotNativeComponent: HostComponent = requireNativeComponent('RCTSnapshot'); diff --git a/packages/rn-tester/js/components/ListExampleShared.js b/packages/rn-tester/js/components/ListExampleShared.js index 6626be70af5e64..11a927447b857d 100644 --- a/packages/rn-tester/js/components/ListExampleShared.js +++ b/packages/rn-tester/js/components/ListExampleShared.js @@ -241,7 +241,7 @@ function getItemLayout( data: any, index: number, horizontal?: boolean, -): {|index: number, length: number, offset: number|} { +): {index: number, length: number, offset: number} { const [length, separator, header] = horizontal ? [HORIZ_WIDTH, 0, HEADER.width] : [ITEM_HEIGHT, SEPARATOR_HEIGHT, HEADER.height]; diff --git a/packages/rn-tester/js/components/RNTConfigurationBlock.js b/packages/rn-tester/js/components/RNTConfigurationBlock.js index 38d94576754032..a0fddb9a3002ac 100644 --- a/packages/rn-tester/js/components/RNTConfigurationBlock.js +++ b/packages/rn-tester/js/components/RNTConfigurationBlock.js @@ -14,10 +14,10 @@ import {RNTesterThemeContext} from './RNTesterTheme'; import * as React from 'react'; import {StyleSheet, View} from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ children?: ?React.Node, testID?: string, -|}>; +}>; /** * Container view for a block of configuration options for an example. diff --git a/packages/rn-tester/js/components/RNTOption.js b/packages/rn-tester/js/components/RNTOption.js index 0d92178524cc30..cf42e085e804c8 100644 --- a/packages/rn-tester/js/components/RNTOption.js +++ b/packages/rn-tester/js/components/RNTOption.js @@ -17,7 +17,7 @@ import {RNTesterThemeContext} from './RNTesterTheme'; import * as React from 'react'; import {Pressable, StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ testID?: ?string, label: string, onPress?: ?(event: PressEvent) => mixed, @@ -25,7 +25,7 @@ type Props = $ReadOnly<{| multiSelect?: ?boolean, disabled?: ?boolean, style?: ViewStyleProp, -|}>; +}>; /** * A reusable toggle button component for RNTester. Highlights when selected. diff --git a/packages/rn-tester/js/components/RNTesterBlock.js b/packages/rn-tester/js/components/RNTesterBlock.js index 8849ec4056b01b..a6528c520f4907 100644 --- a/packages/rn-tester/js/components/RNTesterBlock.js +++ b/packages/rn-tester/js/components/RNTesterBlock.js @@ -12,11 +12,11 @@ import {RNTesterThemeContext} from './RNTesterTheme'; import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ children?: React.Node, title?: ?string, description?: ?string, -|}>; +}>; const RNTesterBlock = ({description, title, children}: Props): React.Node => { const theme = React.useContext(RNTesterThemeContext); diff --git a/packages/rn-tester/js/components/RNTesterButton.js b/packages/rn-tester/js/components/RNTesterButton.js index 686301af61567b..1097c79bbfc1bb 100644 --- a/packages/rn-tester/js/components/RNTesterButton.js +++ b/packages/rn-tester/js/components/RNTesterButton.js @@ -15,12 +15,12 @@ import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import React from 'react'; import {Pressable, StyleSheet, Text} from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ testID?: string, textTestID?: string, children?: React.Node, onPress?: ?(event: PressEvent) => mixed, -|}>; +}>; function RNTesterButton(props: Props): React.Node { return ( diff --git a/packages/rn-tester/js/components/RNTesterComponentTitle.js b/packages/rn-tester/js/components/RNTesterComponentTitle.js index 4e2ea40cc96d8f..38464067ad1437 100644 --- a/packages/rn-tester/js/components/RNTesterComponentTitle.js +++ b/packages/rn-tester/js/components/RNTesterComponentTitle.js @@ -13,9 +13,9 @@ import {RNTesterThemeContext} from './RNTesterTheme'; const React = require('react'); const {StyleSheet, Text} = require('react-native'); -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ children: string, -|}>; +}>; class RNTesterComponentTitle extends React.Component { constructor(props: Props) { diff --git a/packages/rn-tester/js/components/RNTesterDocumentationURL.js b/packages/rn-tester/js/components/RNTesterDocumentationURL.js index e25657820624a4..07b54df61d722d 100644 --- a/packages/rn-tester/js/components/RNTesterDocumentationURL.js +++ b/packages/rn-tester/js/components/RNTesterDocumentationURL.js @@ -12,9 +12,9 @@ import * as React from 'react'; import {Image, StyleSheet, TouchableOpacity} from 'react-native'; import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ documentationURL: string, -|}>; +}>; const RNTesterDocumentationURL = ({documentationURL}: Props): React.Node => ( { constructor(props: Props) { super(props); diff --git a/packages/rn-tester/js/components/RNTesterNavbar.js b/packages/rn-tester/js/components/RNTesterNavbar.js index e67d7f55fd674f..8faadf3775abb6 100644 --- a/packages/rn-tester/js/components/RNTesterNavbar.js +++ b/packages/rn-tester/js/components/RNTesterNavbar.js @@ -115,11 +115,11 @@ const APITab = ({ /> ); -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ handleNavBarPress: NavBarOnPressHandler, screen: string, isExamplePageOpen: boolean, -|}>; +}>; const RNTesterNavbar = ({ handleNavBarPress, diff --git a/packages/rn-tester/js/components/RNTesterPage.js b/packages/rn-tester/js/components/RNTesterPage.js index 71342f255ba630..4aad7a19acfcf1 100644 --- a/packages/rn-tester/js/components/RNTesterPage.js +++ b/packages/rn-tester/js/components/RNTesterPage.js @@ -15,11 +15,11 @@ import {useContext} from 'react'; const React = require('react'); const {SafeAreaView, ScrollView, StyleSheet, View} = require('react-native'); -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ children?: React.Node, title?: ?string, noScroll?: ?boolean, -|}>; +}>; function RNTesterPage({children, title, noScroll}: Props): React.Node { const theme = useContext(RNTesterThemeContext); diff --git a/packages/rn-tester/js/components/RNTesterTextInput.js b/packages/rn-tester/js/components/RNTesterTextInput.js index d760b3a00ea230..0ac8b3da488ee7 100644 --- a/packages/rn-tester/js/components/RNTesterTextInput.js +++ b/packages/rn-tester/js/components/RNTesterTextInput.js @@ -15,12 +15,12 @@ import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; const React = require('react'); const {Pressable, StyleSheet, Text} = require('react-native'); -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ testID?: string, textTestID?: string, children?: React.Node, onPress?: ?(event: PressEvent) => mixed, -|}>; +}>; class RNTesterButton extends React.Component { render(): React.Node { diff --git a/packages/rn-tester/js/components/UseCase.js b/packages/rn-tester/js/components/UseCase.js index 2b13c8e1ac5487..f2d18bf879c477 100644 --- a/packages/rn-tester/js/components/UseCase.js +++ b/packages/rn-tester/js/components/UseCase.js @@ -11,13 +11,13 @@ import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ children?: React.Node, title?: ?string, note?: ?string, ios?: ?boolean, android?: ?boolean, -|}>; +}>; export default function UseCase(props: Props): React.Node { const children = React.Children.toArray(props.children).filter( diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js index b4d9681cba9ae3..88b924102e418e 100644 --- a/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js +++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js @@ -14,7 +14,7 @@ const {RNTesterThemeContext} = require('../../components/RNTesterTheme'); const React = require('react'); const {Alert, Text, View} = require('react-native'); -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; class AccessibilityIOSExample extends React.Component { render(): React.Node { return ( diff --git a/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js b/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js index c21161dfdcae92..2eaaef5fb1b0ef 100644 --- a/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js +++ b/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js @@ -30,8 +30,8 @@ const DESTRUCTIVE_INDEX = 3; const CANCEL_INDEX = 4; const DISABLED_BUTTON_INDICES = [1, 2]; -type Props = $ReadOnly<{||}>; -type State = {|clicked: string|}; +type Props = $ReadOnly<{}>; +type State = {clicked: string}; class ActionSheetExample extends React.Component { state: State = { clicked: 'none', diff --git a/packages/rn-tester/js/examples/Animated/ComposingExample.js b/packages/rn-tester/js/examples/Animated/ComposingExample.js index 3a9080e3439e32..f894035bff1f7a 100644 --- a/packages/rn-tester/js/examples/Animated/ComposingExample.js +++ b/packages/rn-tester/js/examples/Animated/ComposingExample.js @@ -26,7 +26,7 @@ import { useWindowDimensions, } from 'react-native'; -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; const boxSize = 12; const padding = 8; const leftToRightTimingConfig = (useNativeDriver: boolean) => ({ diff --git a/packages/rn-tester/js/examples/Animated/EasingExample.js b/packages/rn-tester/js/examples/Animated/EasingExample.js index c4dd4a262065d8..2ec1fc78a1b7a7 100644 --- a/packages/rn-tester/js/examples/Animated/EasingExample.js +++ b/packages/rn-tester/js/examples/Animated/EasingExample.js @@ -24,7 +24,7 @@ import { View, } from 'react-native'; -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; type EasingListItem = { title: string, diff --git a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js index efe0bae2f46543..2ead9f1743fc70 100644 --- a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js +++ b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js @@ -54,7 +54,7 @@ const styles = StyleSheet.create({ }, }); -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; function MovingBoxView({useNativeDriver}: {useNativeDriver: boolean}) { const x = React.useRef(new Animated.Value(0)); diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js index a9c2f209bdf774..37eeca249293fd 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js @@ -22,13 +22,13 @@ const randColor = () => { return `rgb(${colors.join(',')})`; }; -type AnExSetProps = $ReadOnly<{| +type AnExSetProps = $ReadOnly<{ openVal: Animated.Value, containerLayout: {width: number, height: number}, id: string, isActive: boolean, onDismiss: (velocity: number) => void, -|}>; +}>; const AnExSet = ({ openVal, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js index 94aa4145b75c6a..c0b47dd2f6e9a0 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js @@ -16,12 +16,12 @@ import usePlatformTestHarness from './usePlatformTestHarness'; import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ title: string, description: string, instructions?: $ReadOnlyArray, component: React.ComponentType, -|}>; +}>; export default function RNTesterPlatformTest(props: Props): React.MixedElement { const { diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js index 4968f45339ebda..582680b4fa174f 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js @@ -13,10 +13,10 @@ import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ instructions?: $ReadOnlyArray, style?: ?ViewStyleProp, -|}>; +}>; export default function RNTesterPlatformTestInstructions({ instructions, style, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js index 4f904d0a51c1f0..b8ba890db5b275 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js @@ -14,7 +14,7 @@ import RNTesterPlatformTestResultsText from './RNTesterPlatformTestResultsText'; import * as React from 'react'; import {StyleSheet, Text, TouchableHighlight, View} from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ numFail: number, numError: number, numPass: number, @@ -22,7 +22,7 @@ type Props = $ReadOnly<{| numSkipped: number, onPress?: () => void, style?: ?ViewStyleProp, -|}>; +}>; export default function RNTesterPlatformTestMinimizedResultView({ numFail, numError, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js index 099858d92a61e2..009dab35cefc96 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js @@ -181,12 +181,12 @@ function renderTableRow({item}: RenderItemProps) { return ; } -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ numPending: number, reset: () => void, results: $ReadOnlyArray, style?: ?ViewStyleProp, -|}>; +}>; export default function RNTesterPlatformTestResultView( props: Props, ): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js index 89678a796db76b..0af82e098a030a 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js @@ -8,21 +8,21 @@ * @flow */ -type BasePlatformTestAssertionResult = $ReadOnly<{| +type BasePlatformTestAssertionResult = $ReadOnly<{ name: string, description: string, -|}>; +}>; -export type PassingPlatformTestAssertionResult = $ReadOnly<{| +export type PassingPlatformTestAssertionResult = $ReadOnly<{ ...BasePlatformTestAssertionResult, passing: true, -|}>; +}>; -export type FailingPlatformTestAssertionResult = $ReadOnly<{| +export type FailingPlatformTestAssertionResult = $ReadOnly<{ ...BasePlatformTestAssertionResult, passing: false, failureMessage: string, -|}>; +}>; export type PlatformTestAssertionResult = | PassingPlatformTestAssertionResult @@ -30,12 +30,12 @@ export type PlatformTestAssertionResult = export type PlatformTestResultStatus = 'PASS' | 'FAIL' | 'ERROR' | 'SKIPPED'; -export type PlatformTestResult = $ReadOnly<{| +export type PlatformTestResult = $ReadOnly<{ name: string, status: PlatformTestResultStatus, assertions: $ReadOnlyArray, error: mixed | null, // null is technically unnecessary but is kept to ensure the error is described as nullable -|}>; +}>; export type PlatformTestContext = $ReadOnly<{ assert_true(a: boolean, description: string): void, @@ -47,23 +47,23 @@ export type PlatformTestContext = $ReadOnly<{ export type PlatformTestCase = (context: PlatformTestContext) => void; -export type AsyncPlatformTest = $ReadOnly<{| +export type AsyncPlatformTest = $ReadOnly<{ done(): void, step(testcase: PlatformTestCase): void, -|}>; +}>; -export type SyncTestOptions = $ReadOnly<{| +export type SyncTestOptions = $ReadOnly<{ skip?: boolean, -|}>; +}>; -export type PlatformTestHarness = $ReadOnly<{| +export type PlatformTestHarness = $ReadOnly<{ test( testcase: PlatformTestCase, name: string, options?: SyncTestOptions, ): void, useAsyncTest(description: string, timeout?: number): AsyncPlatformTest, -|}>; +}>; export type PlatformTestComponentBaseProps = { +harness: PlatformTestHarness, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js index f6a1bb5023e8fe..0d84794e859c91 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js @@ -131,13 +131,13 @@ function constructAsyncTestHook( }; } -export type PlatformTestHarnessHookResult = $ReadOnly<{| +export type PlatformTestHarnessHookResult = $ReadOnly<{ testKey: number, harness: PlatformTestHarness, numPending: number, reset: () => void, results: $ReadOnlyArray, -|}>; +}>; export default function usePlatformTestHarness(): PlatformTestHarnessHookResult { const [testResults, updateTestResults] = useState< diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventsEventfulView.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventsEventfulView.js index 94dd82caae6148..4f8ede7591fcf9 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventsEventfulView.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventsEventfulView.js @@ -14,7 +14,7 @@ import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; -export default function EventfulView(props: {| +export default function EventfulView(props: { name: string, emitByDefault?: boolean, onLeave?: boolean, @@ -35,7 +35,7 @@ export default function EventfulView(props: {| onCancelCapture?: boolean, log: string => void, ...ViewProps, -|}): React.Node { +}): React.Node { const ref = React.useRef>(); React.useEffect(() => { // $FlowFixMe[prop-missing] Using private property diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js index 6fb48fa8be8d44..29dbb52574b1d0 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js @@ -55,8 +55,8 @@ const VIEWABILITY_CONFIG = { waitForInteraction: true, }; -type Props = $ReadOnly<{||}>; -type State = {| +type Props = $ReadOnly<{}>; +type State = { data: Array, first: number, last: number, @@ -76,7 +76,7 @@ type State = {| maintainVisibleContentPosition: boolean, previousLoading: boolean, nextLoading: boolean, -|}; +}; const IS_RTL = I18nManager.isRTL; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js index 89e124c6dc33b8..0d421693d14e64 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js @@ -36,14 +36,14 @@ class MultiColumnExample extends React.PureComponent< > { state: | any - | {| + | { data: Array, filterText: string, fixedHeight: boolean, logViewable: boolean, numColumns: number, virtualized: boolean, - |} = { + } = { data: genNewerItems(1000), filterText: '', fixedHeight: true, diff --git a/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js b/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js index 30afdb8b3f4662..ef8fb08e120c06 100644 --- a/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js +++ b/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js @@ -15,7 +15,7 @@ const ReactNative = require('react-native'); const nativeImageSource = require('react-native/Libraries/Image/nativeImageSource'); const {Image, StyleSheet, Text, View} = ReactNative; -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; class ImageCapInsetsExample extends React.Component { render(): React.Node { return ( diff --git a/packages/rn-tester/js/examples/Image/ImageExample.js b/packages/rn-tester/js/examples/Image/ImageExample.js index 92e4665c8405fd..938eedbe910cdb 100644 --- a/packages/rn-tester/js/examples/Image/ImageExample.js +++ b/packages/rn-tester/js/examples/Image/ImageExample.js @@ -31,13 +31,13 @@ const base64Icon = const IMAGE_PREFETCH_URL = `${IMAGE1}?r=1&t=${Date.now()}`; const prefetchTask = Image.prefetch(IMAGE_PREFETCH_URL); -type ImageSource = $ReadOnly<{| +type ImageSource = $ReadOnly<{ uri: string, -|}>; +}>; -type BlobImageProps = $ReadOnly<{| +type BlobImageProps = $ReadOnly<{ url: string, -|}>; +}>; const BlobImage = ({url}: BlobImageProps): React.Node => { const [objectURL, setObjectURL] = React.useState(null); @@ -58,11 +58,11 @@ const BlobImage = ({url}: BlobImageProps): React.Node => { ); }; -type BlobImageExampleState = {||}; +type BlobImageExampleState = {}; -type BlobImageExampleProps = $ReadOnly<{| +type BlobImageExampleProps = $ReadOnly<{ urls: string[], -|}>; +}>; class BlobImageExample extends React.Component< BlobImageExampleProps, @@ -79,10 +79,10 @@ class BlobImageExample extends React.Component< } } -type NetworkImageCallbackExampleProps = $ReadOnly<{| +type NetworkImageCallbackExampleProps = $ReadOnly<{ source: ImageSource, prefetchedSource: ImageSource, -|}>; +}>; const NetworkImageCallbackExample = ({ source, @@ -195,11 +195,11 @@ const NetworkImageCallbackExample = ({ ); }; -type NetworkImageExampleState = {| +type NetworkImageExampleState = { error: ?string, loading: boolean, progress: $ReadOnlyArray, -|}; +}; class NetworkImageExample extends React.Component< ImageProps, @@ -243,14 +243,14 @@ class NetworkImageExample extends React.Component< } } -type ImageSizeExampleState = {| +type ImageSizeExampleState = { width: number, height: number, -|}; +}; -type ImageSizeExampleProps = $ReadOnly<{| +type ImageSizeExampleProps = $ReadOnly<{ source: ImageSource, -|}>; +}>; class ImageSizeExample extends React.Component< ImageSizeExampleProps, @@ -280,12 +280,12 @@ class ImageSizeExample extends React.Component< } } -type MultipleSourcesExampleState = {| +type MultipleSourcesExampleState = { width: number, height: number, -|}; +}; -type MultipleSourcesExampleProps = $ReadOnly<{||}>; +type MultipleSourcesExampleProps = $ReadOnly<{}>; class MultipleSourcesExample extends React.Component< MultipleSourcesExampleProps, @@ -356,11 +356,11 @@ class MultipleSourcesExample extends React.Component< } } -type LoadingIndicatorSourceExampleState = {| +type LoadingIndicatorSourceExampleState = { imageHash: number, -|}; +}; -type LoadingIndicatorSourceExampleProps = $ReadOnly<{||}>; +type LoadingIndicatorSourceExampleProps = $ReadOnly<{}>; class LoadingIndicatorSourceExample extends React.Component< LoadingIndicatorSourceExampleProps, @@ -404,11 +404,11 @@ class LoadingIndicatorSourceExample extends React.Component< } } -type FadeDurationExampleState = {| +type FadeDurationExampleState = { imageHash: number, -|}; +}; -type FadeDurationExampleProps = $ReadOnly<{||}>; +type FadeDurationExampleProps = $ReadOnly<{}>; class FadeDurationExample extends React.Component< FadeDurationExampleProps, @@ -445,13 +445,13 @@ class FadeDurationExample extends React.Component< } } -type OnLayoutExampleState = {| +type OnLayoutExampleState = { width: number, height: number, layoutHandlerMessage: string, -|}; +}; -type OnLayoutExampleProps = $ReadOnly<{||}>; +type OnLayoutExampleProps = $ReadOnly<{}>; class OnLayoutExample extends React.Component< OnLayoutExampleProps, @@ -540,11 +540,11 @@ class OnLayoutExample extends React.Component< } } -type OnPartialLoadExampleState = {| +type OnPartialLoadExampleState = { hasLoaded: boolean, -|}; +}; -type OnPartialLoadExampleProps = $ReadOnly<{||}>; +type OnPartialLoadExampleProps = $ReadOnly<{}>; class OnPartialLoadExample extends React.Component< OnPartialLoadExampleProps, diff --git a/packages/rn-tester/js/examples/InputAccessoryView/InputAccessoryViewExample.js b/packages/rn-tester/js/examples/InputAccessoryView/InputAccessoryViewExample.js index 24d0af2bb193b1..798658d1456664 100644 --- a/packages/rn-tester/js/examples/InputAccessoryView/InputAccessoryViewExample.js +++ b/packages/rn-tester/js/examples/InputAccessoryView/InputAccessoryViewExample.js @@ -22,7 +22,7 @@ const { View, } = require('react-native'); -type MessageProps = $ReadOnly<{||}>; +type MessageProps = $ReadOnly<{}>; class Message extends React.PureComponent { render(): React.Node { return ( @@ -33,8 +33,8 @@ class Message extends React.PureComponent { } } -type TextInputProps = $ReadOnly<{||}>; -type TextInputState = {|text: string|}; +type TextInputProps = $ReadOnly<{}>; +type TextInputState = {text: string}; class TextInputBar extends React.PureComponent { state: TextInputState = {text: ''}; @@ -61,7 +61,7 @@ class TextInputBar extends React.PureComponent { } const BAR_HEIGHT = 44; -type InputAccessoryProps = $ReadOnly<{||}>; +type InputAccessoryProps = $ReadOnly<{}>; class InputAccessoryViewExample extends React.Component { render(): React.Node { return ( diff --git a/packages/rn-tester/js/examples/Layout/LayoutAnimationExample.js b/packages/rn-tester/js/examples/Layout/LayoutAnimationExample.js index d6bf0c9451e395..8c92fe721dc828 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutAnimationExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutAnimationExample.js @@ -19,14 +19,14 @@ import { View, } from 'react-native'; -type ExampleViewSpec = {| +type ExampleViewSpec = { key: number, -|}; +}; -type AddRemoveExampleState = {| +type AddRemoveExampleState = { views: Array, nextKey: number, -|}; +}; function shuffleArray(array: Array) { var currentIndex: number = array.length, @@ -149,9 +149,9 @@ class AddRemoveExample extends React.Component<{...}, AddRemoveExampleState> { } } -type ReparentingExampleState = {| +type ReparentingExampleState = { hasBorder: boolean, -|}; +}; class ReparentingExample extends React.Component< {...}, @@ -217,9 +217,9 @@ const BlueSquare = () => ( ); -type CrossFadeExampleState = {| +type CrossFadeExampleState = { toggled: boolean, -|}; +}; class CrossFadeExample extends React.Component<{...}, CrossFadeExampleState> { state: CrossFadeExampleState = { @@ -249,10 +249,10 @@ class CrossFadeExample extends React.Component<{...}, CrossFadeExampleState> { } } -type LayoutUpdateExampleState = {| +type LayoutUpdateExampleState = { width: number, height: number, -|}; +}; class LayoutUpdateExample extends React.Component< {...}, diff --git a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js index 2ec94c7ac6e9a7..17c6378082ddb2 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js @@ -19,14 +19,14 @@ import RNTesterText from '../../components/RNTesterText'; import React from 'react'; import {Image, LayoutAnimation, StyleSheet, View} from 'react-native'; -type Props = $ReadOnly<{||}>; +type Props = $ReadOnly<{}>; type State = { - containerStyle?: {|width: number|}, + containerStyle?: {width: number}, extraText?: string, imageLayout?: ViewLayout, textLayout?: ViewLayout, viewLayout?: ViewLayout, - viewStyle: {|margin: number|}, + viewStyle: {margin: number}, ... }; diff --git a/packages/rn-tester/js/examples/Linking/LinkingExample.js b/packages/rn-tester/js/examples/Linking/LinkingExample.js index 5fdb4d3d2cc69c..cec6043f197f91 100644 --- a/packages/rn-tester/js/examples/Linking/LinkingExample.js +++ b/packages/rn-tester/js/examples/Linking/LinkingExample.js @@ -22,9 +22,9 @@ import { View, } from 'react-native'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ url?: ?string, -|}>; +}>; class OpenURLButton extends React.Component { handleClick = () => { diff --git a/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js b/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js index f1f4b1ce14a4e5..47d4315b38590b 100644 --- a/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js +++ b/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js @@ -13,17 +13,17 @@ const React = require('react'); const {StyleSheet, Text, View} = require('react-native'); -type ExampleBoxComponentProps = $ReadOnly<{| +type ExampleBoxComponentProps = $ReadOnly<{ onLog: (msg: string) => void, -|}>; +}>; -type ExampleBoxProps = $ReadOnly<{| +type ExampleBoxProps = $ReadOnly<{ Component: React.ComponentType, -|}>; +}>; -type ExampleBoxState = $ReadOnly<{| +type ExampleBoxState = $ReadOnly<{ log: string[], -|}>; +}>; class ExampleBox extends React.Component { state: ExampleBoxState = { @@ -278,10 +278,10 @@ class BoxOnlyStyleExample extends React.Component<$FlowFixMeProps> { } } -type OverflowExampleProps = $ReadOnly<{| +type OverflowExampleProps = $ReadOnly<{ overflow: 'hidden' | 'visible', onLog: (msg: string) => void, -|}>; +}>; class OverflowExample extends React.Component { render(): React.Node { diff --git a/packages/rn-tester/js/examples/RTL/RTLExample.js b/packages/rn-tester/js/examples/RTL/RTLExample.js index 3a74bdbbe32e55..962cef224d7306 100644 --- a/packages/rn-tester/js/examples/RTL/RTLExample.js +++ b/packages/rn-tester/js/examples/RTL/RTLExample.js @@ -142,9 +142,9 @@ function AnimationBlock(props: { ); } -type RTLSwitcherComponentState = {| +type RTLSwitcherComponentState = { isRTL: boolean, -|}; +}; function withRTLState( Component: ({ diff --git a/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js b/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js index e4cba55160fc0f..555e9acde0b8f4 100644 --- a/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js +++ b/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js @@ -23,9 +23,9 @@ const { class SafeAreaViewExample extends React.Component< {...}, - {| + { modalVisible: boolean, - |}, + }, > { state: {modalVisible: boolean} = { modalVisible: false, diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js index ae0b34365c5675..6ec79751e73d81 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js @@ -1352,10 +1352,10 @@ function ClippingExampleHorizontal() { ); } -class Item extends React.PureComponent<{| +class Item extends React.PureComponent<{ msg?: string, style?: ViewStyleProp, -|}> { +}> { render(): $FlowFixMe { return ( diff --git a/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js b/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js index c35c47e6c38426..a428cefdcda5f4 100644 --- a/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js +++ b/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js @@ -29,11 +29,11 @@ type SnapshotReadyEvent = SyntheticEvent< $ReadOnly<{testIdentifier: string, ...}>, >; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ ...ViewProps, onSnapshotReady?: ?(event: SnapshotReadyEvent) => mixed, testIdentifier?: ?string, -|}>; +}>; class SnapshotViewIOS extends React.Component { onDefaultAction: (event: SnapshotReadyEvent) => void = ( diff --git a/packages/rn-tester/js/examples/Switch/SwitchExample.js b/packages/rn-tester/js/examples/Switch/SwitchExample.js index 9e9984700aa34e..4f3676bacd8930 100644 --- a/packages/rn-tester/js/examples/Switch/SwitchExample.js +++ b/packages/rn-tester/js/examples/Switch/SwitchExample.js @@ -14,12 +14,12 @@ import RNTesterText from '../../components/RNTesterText'; import React from 'react'; import {Platform, Switch, View} from 'react-native'; -type OnOffIndicatorProps = $ReadOnly<{|on: boolean, testID: string|}>; +type OnOffIndicatorProps = $ReadOnly<{on: boolean, testID: string}>; function OnOffIndicator({on, testID}: OnOffIndicatorProps) { return {on ? 'On' : 'Off'}; } -type ExampleRowProps = $ReadOnly<{|children: React.Node|}>; +type ExampleRowProps = $ReadOnly<{children: React.Node}>; function ExampleRow({children}: ExampleRowProps) { return ( ; +}>; -class BasicSwitchExample extends React.Component< - {||}, - SimpleSwitchExampleState, -> { +class BasicSwitchExample extends React.Component<{}, SimpleSwitchExampleState> { state: SimpleSwitchExampleState = { trueSwitchIsOn: true, falseSwitchIsOn: false, @@ -83,7 +80,7 @@ class BasicSwitchExample extends React.Component< } class DisabledSwitchExample extends React.Component< - {||}, + {}, SimpleSwitchExampleState, > { state: SimpleSwitchExampleState = { diff --git a/packages/rn-tester/js/examples/Text/TextExample.android.js b/packages/rn-tester/js/examples/Text/TextExample.android.js index 5d4aa05fb967dd..b77f4359aa03f4 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.android.js +++ b/packages/rn-tester/js/examples/Text/TextExample.android.js @@ -27,7 +27,7 @@ const { View, } = require('react-native'); -class Entity extends React.Component<{|children: React.Node|}> { +class Entity extends React.Component<{children: React.Node}> { render(): React.Node { return ( @@ -84,12 +84,12 @@ class AttributeToggler extends React.Component<{...}, $FlowFixMeState> { } } -type AdjustingFontSizeProps = $ReadOnly<{||}>; +type AdjustingFontSizeProps = $ReadOnly<{}>; -type AdjustingFontSizeState = {| +type AdjustingFontSizeState = { dynamicText: string, shouldRender: boolean, -|}; +}; class AdjustingFontSize extends React.Component< AdjustingFontSizeProps, diff --git a/packages/rn-tester/js/examples/Text/TextExample.ios.js b/packages/rn-tester/js/examples/Text/TextExample.ios.js index 10c6d43a9c12f1..968472ab3fe8a1 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.ios.js +++ b/packages/rn-tester/js/examples/Text/TextExample.ios.js @@ -41,9 +41,9 @@ function InlineView(props) { ); } -type TextAlignExampleRTLState = {| +type TextAlignExampleRTLState = { isRTL: boolean, -|}; +}; class TextAlignRTLExample extends React.Component< {}, @@ -155,12 +155,12 @@ class AttributeToggler extends React.Component<{...}, $FlowFixMeState> { } } -type AdjustingFontSizeProps = $ReadOnly<{||}>; +type AdjustingFontSizeProps = $ReadOnly<{}>; -type AdjustingFontSizeState = {| +type AdjustingFontSizeState = { dynamicText: string, shouldRender: boolean, -|}; +}; class AdjustingFontSize extends React.Component< AdjustingFontSizeProps, diff --git a/packages/rn-tester/js/examples/TextInput/ExampleTextInput.js b/packages/rn-tester/js/examples/TextInput/ExampleTextInput.js index 1034df83b10910..81ffc21945166f 100644 --- a/packages/rn-tester/js/examples/TextInput/ExampleTextInput.js +++ b/packages/rn-tester/js/examples/TextInput/ExampleTextInput.js @@ -15,9 +15,9 @@ import {StyleSheet, TextInput} from 'react-native'; const ExampleTextInput: component( ref: React.RefSetter< - $ReadOnly<{| + $ReadOnly<{ ...React.ElementRef, - |}>, + }>, >, ...props: React.ElementConfig ) = forwardRef((props, ref) => { diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js index d04484191ef55d..d94a57d4b1b069 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js @@ -123,9 +123,9 @@ class TextInputAccessoryViewChangeKeyboardExample extends React.Component< } class TextInputAccessoryViewDefaultDoneButtonExample extends React.Component< - $ReadOnly<{| + $ReadOnly<{ keyboardType: KeyboardType, - |}>, + }>, {text: string}, > { constructor(props: void | $ReadOnly<{keyboardType: KeyboardType}>) { diff --git a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js index ab05ce4f528da4..66d326987f5def 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js @@ -498,10 +498,10 @@ class TokenizedTextExample extends React.Component< } type SelectionExampleState = { - selection: $ReadOnly<{| + selection: $ReadOnly<{ start: number, end: number, - |}>, + }>, value: string, ... }; diff --git a/packages/rn-tester/js/examples/Timer/TimerExample.js b/packages/rn-tester/js/examples/Timer/TimerExample.js index f2a4596c90a813..6a93bcfbcbc932 100644 --- a/packages/rn-tester/js/examples/Timer/TimerExample.js +++ b/packages/rn-tester/js/examples/Timer/TimerExample.js @@ -20,8 +20,8 @@ function burnCPU(milliseconds: number) { while (global.performance.now() < start + milliseconds) {} } -type RequestIdleCallbackTesterProps = $ReadOnly<{||}>; -type RequestIdleCallbackTesterState = {|message: string|}; +type RequestIdleCallbackTesterProps = $ReadOnly<{}>; +type RequestIdleCallbackTesterState = {message: string}; class RequestIdleCallbackTester extends React.Component< RequestIdleCallbackTesterProps, @@ -144,10 +144,10 @@ class RequestIdleCallbackTester extends React.Component< }; } -type TimerTesterProps = $ReadOnly<{| +type TimerTesterProps = $ReadOnly<{ dt?: any, type: string, -|}>; +}>; class TimerTester extends React.Component { _ii = 0; @@ -269,10 +269,10 @@ class TimerTester extends React.Component { } class IntervalExample extends React.Component< - $ReadOnly<{||}>, - {| + $ReadOnly<{}>, + { showTimer: boolean, - |}, + }, > { state: {showTimer: boolean} = { showTimer: true, diff --git a/packages/rn-tester/js/examples/Touchable/TouchableExample.js b/packages/rn-tester/js/examples/Touchable/TouchableExample.js index 41d14034983ac8..0ac36dac0b6aa4 100644 --- a/packages/rn-tester/js/examples/Touchable/TouchableExample.js +++ b/packages/rn-tester/js/examples/Touchable/TouchableExample.js @@ -314,7 +314,7 @@ class TouchableHitSlop extends React.Component<{...}, $FlowFixMeState> { function TouchableNativeMethodChecker< T: component(ref?: React.RefSetter, ...any), ->(props: {|Component: T, name: string|}): React.Node { +>(props: {Component: T, name: string}): React.Node { const [status, setStatus] = useState(null); const ref = useRef(null); diff --git a/packages/rn-tester/js/examples/TurboModule/NativeCxxModuleExampleExample.js b/packages/rn-tester/js/examples/TurboModule/NativeCxxModuleExampleExample.js index e4cb37f89dacd1..ab09da1a832f9c 100644 --- a/packages/rn-tester/js/examples/TurboModule/NativeCxxModuleExampleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/NativeCxxModuleExampleExample.js @@ -26,7 +26,7 @@ import { View, } from 'react-native'; -type State = {| +type State = { testResults: { [string]: { type: string, @@ -35,7 +35,7 @@ type State = {| }, ... }, -|}; +}; type Examples = | 'callback' @@ -71,7 +71,7 @@ type ErrorExamples = | 'getObjectAssert' | 'promiseAssert'; -class NativeCxxModuleExampleExample extends React.Component<{||}, State> { +class NativeCxxModuleExampleExample extends React.Component<{}, State> { static contextType: React$Context = RootTagContext; eventSubscriptions: EventSubscription[] = []; diff --git a/packages/rn-tester/js/examples/TurboModule/SampleLegacyModuleExample.js b/packages/rn-tester/js/examples/TurboModule/SampleLegacyModuleExample.js index 7d389eaeda387a..58227b95e7dbc3 100644 --- a/packages/rn-tester/js/examples/TurboModule/SampleLegacyModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/SampleLegacyModuleExample.js @@ -22,7 +22,7 @@ import { View, } from 'react-native'; -type State = {| +type State = { testResults: { [string]: { type: string, @@ -31,7 +31,7 @@ type State = {| }, ... }, -|}; +}; let triedLoadingModuleOnce = false; let module = null; @@ -67,7 +67,7 @@ function stringify(obj: mixed): string { return (JSON.stringify(obj, replacer) || '').replace(/"/g, "'"); } -class SampleLegacyModuleExample extends React.Component<{||}, State> { +class SampleLegacyModuleExample extends React.Component<{}, State> { static contextType: React$Context = RootTagContext; state: State = { diff --git a/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js b/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js index b017895e9c1be7..36d413618c6cf8 100644 --- a/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js @@ -18,7 +18,7 @@ import {FlatList, RootTagContext, TouchableOpacity, View} from 'react-native'; import NativeSampleTurboModule from 'react-native/Libraries/TurboModule/samples/NativeSampleTurboModule'; import {EnumInt} from 'react-native/Libraries/TurboModule/samples/NativeSampleTurboModule'; -type State = {| +type State = { testResults: { [string]: { type: string, @@ -27,7 +27,7 @@ type State = {| }, ... }, -|}; +}; type Examples = | 'callback' @@ -62,7 +62,7 @@ type ErrorExamples = | 'getObjectAssert' | 'promiseAssert'; -class SampleTurboModuleExample extends React.Component<{||}, State> { +class SampleTurboModuleExample extends React.Component<{}, State> { static contextType: React$Context = RootTagContext; eventSubscriptions: EventSubscription[] = []; diff --git a/packages/rn-tester/js/examples/View/ViewExample.js b/packages/rn-tester/js/examples/View/ViewExample.js index f5280ba3f9d2c8..4546c299f19f17 100644 --- a/packages/rn-tester/js/examples/View/ViewExample.js +++ b/packages/rn-tester/js/examples/View/ViewExample.js @@ -17,8 +17,8 @@ import * as React from 'react'; import {Platform, Pressable, StyleSheet, View} from 'react-native'; class ViewBorderStyleExample extends React.Component< - $ReadOnly<{||}>, - {|showBorder: boolean|}, + $ReadOnly<{}>, + {showBorder: boolean}, > { state: {showBorder: boolean} = { showBorder: true, @@ -82,10 +82,10 @@ const offscreenAlphaCompositingStyles = StyleSheet.create({ }); class OffscreenAlphaCompositing extends React.Component< - $ReadOnly<{|testID?: ?string|}>, - {| + $ReadOnly<{testID?: ?string}>, + { active: boolean, - |}, + }, > { state: {active: boolean} = { active: false, @@ -166,10 +166,10 @@ const ZIndexExampleStyles = StyleSheet.create({ }); class ZIndexExample extends React.Component< - $ReadOnly<{||}>, - {| + $ReadOnly<{}>, + { flipped: boolean, - |}, + }, > { state: {flipped: boolean} = { flipped: false, @@ -310,10 +310,10 @@ function PositionStaticZIndexExample(): React.Node { } class DisplayNoneStyle extends React.Component< - $ReadOnly<{||}>, - {| + $ReadOnly<{}>, + { index: number, - |}, + }, > { state: {index: number} = { index: 0, @@ -376,7 +376,7 @@ class DisplayNoneStyle extends React.Component< }; } -class FlexGapExample extends React.Component<$ReadOnly<{|testID?: ?string|}>> { +class FlexGapExample extends React.Component<$ReadOnly<{testID?: ?string}>> { render(): React.Node { return ( { Linking.openURL(url); } - state: $FlowFixMe | {|type: 'Uint8Array'|} = { + state: $FlowFixMe | {type: 'Uint8Array'} = { type: 'Uint8Array', }; diff --git a/packages/rn-tester/js/types/RNTesterTypes.js b/packages/rn-tester/js/types/RNTesterTypes.js index 83fdaadff7756c..e9635c2b1063ce 100644 --- a/packages/rn-tester/js/types/RNTesterTypes.js +++ b/packages/rn-tester/js/types/RNTesterTypes.js @@ -10,7 +10,7 @@ import * as React from 'react'; -export type RNTesterModuleExample = $ReadOnly<{| +export type RNTesterModuleExample = $ReadOnly<{ name?: string, title: string, platform?: 'ios' | 'android', @@ -19,9 +19,9 @@ export type RNTesterModuleExample = $ReadOnly<{| hidden?: boolean, scrollable?: boolean, render: ({testID?: ?string}) => React.Node, -|}>; +}>; -export type RNTesterModule = $ReadOnly<{| +export type RNTesterModule = $ReadOnly<{ title: string, testTitle?: ?string, description: string, @@ -33,15 +33,15 @@ export type RNTesterModule = $ReadOnly<{| category?: string, documentationURL?: string, showIndividualExamples?: boolean, -|}>; +}>; -export type RNTesterModuleInfo = $ReadOnly<{| +export type RNTesterModuleInfo = $ReadOnly<{ key: string, module: RNTesterModule, category?: string, documentationURL?: string, exampleType?: 'components' | 'apis', -|}>; +}>; export type SectionData = { key: string, @@ -49,10 +49,10 @@ export type SectionData = { data: Array, }; -export type ExamplesList = $ReadOnly<{| +export type ExamplesList = $ReadOnly<{ components: $ReadOnlyArray>, apis: $ReadOnlyArray>, -|}>; +}>; export type ScreenTypes = 'components' | 'apis' | 'playgrounds' | null; diff --git a/packages/virtualized-lists/Lists/ViewabilityHelper.js b/packages/virtualized-lists/Lists/ViewabilityHelper.js index 13bdfc396fb7c9..c250d55ff2b1c4 100644 --- a/packages/virtualized-lists/Lists/ViewabilityHelper.js +++ b/packages/virtualized-lists/Lists/ViewabilityHelper.js @@ -35,7 +35,7 @@ export type ViewabilityConfigCallbackPair = { ... }; -export type ViewabilityConfig = $ReadOnly<{| +export type ViewabilityConfig = $ReadOnly<{ /** * Minimum amount of time (in milliseconds) that an item must be physically viewable before the * viewability callback will be fired. A high number means that scrolling through content without @@ -62,7 +62,7 @@ export type ViewabilityConfig = $ReadOnly<{| * render. */ waitForInteraction?: boolean, -|}>; +}>; /** * A Utility class for calculating viewable items based on current metrics like scroll position and diff --git a/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js b/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js index 830c8b72feb349..d929e78801337a 100644 --- a/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js +++ b/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js @@ -43,10 +43,10 @@ export type Props = { ... }; -type SeparatorProps = $ReadOnly<{| +type SeparatorProps = $ReadOnly<{ highlighted: boolean, leadingItem: ?ItemT, -|}>; +}>; type State = { separatorProps: SeparatorProps, diff --git a/packages/virtualized-lists/Lists/VirtualizedListProps.js b/packages/virtualized-lists/Lists/VirtualizedListProps.js index 0d2730185c1213..1964acc58ee25d 100644 --- a/packages/virtualized-lists/Lists/VirtualizedListProps.js +++ b/packages/virtualized-lists/Lists/VirtualizedListProps.js @@ -52,7 +52,7 @@ export type RenderItemType = ( info: RenderItemProps, ) => React.Node; -type RequiredProps = {| +type RequiredProps = { /** * The default accessor functions assume this is an Array<{key: string} | {id: string}> but you can override * getItem, getItemCount, and keyExtractor to handle any type of index-based data. @@ -66,8 +66,8 @@ type RequiredProps = {| * Determines how many items are in the data blob. */ getItemCount: (data: any) => number, -|}; -type OptionalProps = {| +}; +type OptionalProps = { renderItem?: ?RenderItemType, /** * `debug` will turn on extra logging and visual overlays to aid with debugging both usage and @@ -297,13 +297,13 @@ type OptionalProps = {| * The legacy implementation is no longer supported. */ legacyImplementation?: empty, -|}; +}; -export type Props = {| +export type Props = { ...React.ElementConfig, ...RequiredProps, ...OptionalProps, -|}; +}; /** * Default Props Helper Functions diff --git a/packages/virtualized-lists/Lists/VirtualizedSectionList.js b/packages/virtualized-lists/Lists/VirtualizedSectionList.js index f42e2ef95f8818..ad546b9bf272b7 100644 --- a/packages/virtualized-lists/Lists/VirtualizedSectionList.js +++ b/packages/virtualized-lists/Lists/VirtualizedSectionList.js @@ -44,11 +44,11 @@ export type SectionBase = { ... }; -type RequiredProps> = {| +type RequiredProps> = { sections: $ReadOnlyArray, -|}; +}; -type OptionalProps> = {| +type OptionalProps> = { /** * Default renderer for every item in every section. */ @@ -87,11 +87,11 @@ type OptionalProps> = {| */ stickySectionHeadersEnabled?: boolean, onEndReached?: ?({distanceFromEnd: number, ...}) => void, -|}; +}; type VirtualizedListProps = React.ElementConfig; -export type Props = {| +export type Props = { ...RequiredProps, ...OptionalProps, ...$Diff< @@ -102,14 +102,14 @@ export type Props = {| ... }, >, -|}; -export type ScrollToLocationParamsType = {| +}; +export type ScrollToLocationParamsType = { animated?: ?boolean, itemIndex: number, sectionIndex: number, viewOffset?: number, viewPosition?: number, -|}; +}; type State = {childProps: VirtualizedListProps, ...}; @@ -453,15 +453,15 @@ class VirtualizedSectionList< }; } -type ItemWithSeparatorCommonProps = $ReadOnly<{| +type ItemWithSeparatorCommonProps = $ReadOnly<{ leadingItem: ?Item, leadingSection: ?Object, section: Object, trailingItem: ?Item, trailingSection: ?Object, -|}>; +}>; -type ItemWithSeparatorProps = $ReadOnly<{| +type ItemWithSeparatorProps = $ReadOnly<{ ...ItemWithSeparatorCommonProps, LeadingSeparatorComponent: ?React.ComponentType, SeparatorComponent: ?React.ComponentType, @@ -481,7 +481,7 @@ type ItemWithSeparatorProps = $ReadOnly<{| updatePropsFor: (prevCellKey: string, value: Object) => void, renderItem: Function, inverted: boolean, -|}>; +}>; function ItemWithSeparator(props: ItemWithSeparatorProps): React.Node { const {