diff --git a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js index 0c2abd7faa0a..46f54894e716 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js +++ b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js @@ -21,7 +21,7 @@ type ValueOfUnion = T extends any : empty : empty; type MergeUnion = { - [K in KeysOfUnion]?: ValueOfUnion, + [K in KeysOfUnion]: ValueOfUnion, }; type MaximumOneOf = Values<{ [K in keyof T]: $Exact<{ diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index b5127f242a2f..b4ff97b432f9 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<08c63097104ab811ba2be19ded117820>> + * @generated SignedSource<<83cb6ada8f8cb7c30a4c47d44d892dca>> * * This file was generated by scripts/js-api/build-types/index.js. */ @@ -3109,7 +3109,7 @@ declare type MeasureOnSuccessCallback = ( pageX: number, pageY: number, ) => void -declare type MergeUnion = { [K in KeysOfUnion]?: ValueOfUnion } +declare type MergeUnion = { [K in KeysOfUnion]: ValueOfUnion } declare type Message = { readonly content: string readonly substitutions: ReadonlyArray<{ @@ -5893,24 +5893,24 @@ export { AccessibilityValue, // cf8bcb74 ActionSheetIOS, // b558559e ActionSheetIOSOptions, // 1756eb5a - ActivityIndicator, // b7793e9b + ActivityIndicator, // d3d83f9c ActivityIndicatorInstance, // 69299e35 - ActivityIndicatorProps, // 0489dc5e + ActivityIndicatorProps, // 1c8778b2 Alert, // a398a509 AlertButton, // bf1a3b60 AlertButtonStyle, // ec9fb242 AlertOptions, // 8a116d2a AlertType, // 5ab91217 AndroidKeyboardEvent, // e03becc8 - Animated, // ba13f2de - AnimatedFlatList, // 074a4512 - AnimatedImage, // 7efc2e4d - AnimatedScrollView, // 338d60e0 - AnimatedSectionList, // 78177f8d - AnimatedText, // c068e60d - AnimatedView, // 0f3aeb93 + Animated, // 7e828987 + AnimatedFlatList, // f32979ff + AnimatedImage, // 08521177 + AnimatedScrollView, // 1b410f55 + AnimatedSectionList, // 8614a499 + AnimatedText, // 206f1fc7 + AnimatedView, // 544c0f25 AppConfig, // 80afc5fa - AppRegistry, // 2fad6d0e + AppRegistry, // 41af4d77 AppState, // db34d225 AppStateEvent, // 80f034c3 AppStateStatus, // 447e5ef2 @@ -5922,8 +5922,8 @@ export { BackPressEventName, // 4620fb76 BlurEvent, // 00c596e2 BoxShadowValue, // b679703f - Button, // 2ec045d1 - ButtonInstance, // 3bfc75a3 + Button, // a3e7b8d7 + ButtonInstance, // 1fc47df7 ButtonProps, // 2fe658e4 CodegenTypes, // d0052fd4 ColorSchemeName, // 6615edd6 @@ -5941,9 +5941,9 @@ export { DimensionsPayload, // 653bc26c DisplayMetrics, // 1dc35cef DisplayMetricsAndroid, // 872e62eb - DrawerLayoutAndroid, // 65e3d444 + DrawerLayoutAndroid, // d7de576f DrawerLayoutAndroidInstance, // aa243cbf - DrawerLayoutAndroidProps, // 013b18ba + DrawerLayoutAndroidProps, // 1ccf53ee DrawerSlideEvent, // aa703fa0 DropShadowValue, // e9df2606 DynamicColorIOS, // d96c228c @@ -5959,9 +5959,9 @@ export { EventSubscription, // b8d084aa ExtendedExceptionData, // 5a6ccf5a FilterFunction, // bf24c0e3 - FlatList, // 733aeed0 - FlatListInstance, // e268301f - FlatListProps, // b23f662a + FlatList, // 50519124 + FlatListInstance, // 92a00395 + FlatListProps, // e060e11e FocusEvent, // f7d67f9b FontVariant, // 7c7558bb GestureResponderEvent, // cbf6abac @@ -5972,17 +5972,17 @@ export { IEventEmitter, // fbef6131 IOSKeyboardEvent, // e67bfe3a IgnorePattern, // ec6f6ece - Image, // 9955197c - ImageBackground, // 5725330b - ImageBackgroundInstance, // b89488b9 - ImageBackgroundProps, // 69b7bff8 + Image, // c885ba6b + ImageBackground, // 95cd583e + ImageBackgroundInstance, // 1e7a8f97 + ImageBackgroundProps, // d8032f13 ImageErrorEvent, // e2926c20 ImageInstance, // 46f8deb7 ImageLoadEvent, // 9b52ad36 ImageProgressEventIOS, // a97c3831 - ImageProps, // dbe27897 + ImageProps, // bc0897bb ImagePropsAndroid, // 283349a4 - ImagePropsBase, // 5cc32b8d + ImagePropsBase, // 1b309ff5 ImagePropsIOS, // 4f29f905 ImageRequireSource, // 681d683b ImageResizeMode, // d51106e2 @@ -5990,19 +5990,19 @@ export { ImageSize, // 1c47cf88 ImageSource, // bba5e24d ImageSourcePropType, // ff97c174 - ImageStyle, // 363a3e5a + ImageStyle, // bdf1febd ImageURISource, // 9bf63692 - InputAccessoryView, // 5cc534c4 - InputAccessoryViewProps, // 01e6ca03 + InputAccessoryView, // 8f1ce5aa + InputAccessoryViewProps, // d5fcc450 InputModeOptions, // 4e8581b9 Insets, // e7fe432a KeyDownEvent, // ccd5ec9d KeyEvent, // 20fa4267 KeyUpEvent, // e45aac1c Keyboard, // a26f7bd4 - KeyboardAvoidingView, // ec903233 - KeyboardAvoidingViewInstance, // 9512f9c1 - KeyboardAvoidingViewProps, // 13f6fa24 + KeyboardAvoidingView, // 0777fc80 + KeyboardAvoidingViewInstance, // 9cc8dcd1 + KeyboardAvoidingViewProps, // 70793ff3 KeyboardEvent, // c3f895d4 KeyboardEventEasing, // af4091c8 KeyboardEventName, // 59299ad6 @@ -6027,10 +6027,10 @@ export { MeasureInWindowOnSuccessCallback, // a285f598 MeasureLayoutOnSuccessCallback, // 3592502a MeasureOnSuccessCallback, // 82824e59 - Modal, // 7910201f + Modal, // 8b24c4b7 ModalBaseProps, // 18ba4525 ModalInstance, // c47ff608 - ModalProps, // 9d78b278 + ModalProps, // 76fd01f8 ModalPropsAndroid, // 515fb173 ModalPropsIOS, // 7943cbd7 ModeChangeEvent, // 9e9a28c4 @@ -6066,15 +6066,15 @@ export { PointerEvent, // a3d953b4 PressabilityConfig, // 5a09717f PressabilityEventHandlers, // 4ffc75dd - Pressable, // 08640c93 + Pressable, // 858e0346 PressableAndroidRippleConfig, // ee32eaca PressableInstance, // 4f7bc23d - PressableProps, // bd3d6042 + PressableProps, // f3b74cf5 PressableStateCallbackType, // f83728cd ProcessedColorValue, // 33f74304 - ProgressBarAndroid, // d5f7ad5d + ProgressBarAndroid, // 8e22f9ee ProgressBarAndroidInstance, // e049fddf - ProgressBarAndroidProps, // 4b8826f6 + ProgressBarAndroidProps, // dc17c3d8 PublicRootInstance, // 8040afd7 PublicTextInstance, // ab85b323 PushNotificationEventName, // 84e7e150 @@ -6082,9 +6082,9 @@ export { PushNotificationPermissions, // c2e7ae4f Rationale, // 5df1b1c1 ReactNativeVersion, // abd76827 - RefreshControl, // 48abafa2 - RefreshControlInstance, // b79668ce - RefreshControlProps, // 511625b4 + RefreshControl, // 4b4186d8 + RefreshControlInstance, // 8d87c316 + RefreshControlProps, // 80e8d893 RefreshControlPropsAndroid, // 8ac931ca RefreshControlPropsIOS, // 72a36381 Registry, // e7beb42e @@ -6093,29 +6093,29 @@ export { Role, // af7b889d RootTag, // 3cd10504 RootTagContext, // 38bfc8f6 - RootViewStyleProvider, // bcc31cf3 + RootViewStyleProvider, // dbd25fa3 Runnable, // 557d13d9 Runnables, // 75114853 SafeAreaInsets, // 64d7a605 SafeAreaInsetsChangeEvent, // ecf5a1e0 - SafeAreaView, // fa1a071b + SafeAreaView, // 5594e471 SafeAreaViewInstance, // a873bd17 ScaledSize, // 07e417c7 ScrollEvent, // 8dfaa310 - ScrollResponderType, // d9b5b457 + ScrollResponderType, // cff93290 ScrollToLocationParamsType, // d7ecdad1 - ScrollView, // d57bd638 - ScrollViewImperativeMethods, // eca21efb - ScrollViewInstance, // 1bb729e1 - ScrollViewProps, // 3a8aadd4 + ScrollView, // c9a216ec + ScrollViewImperativeMethods, // 057d1f97 + ScrollViewInstance, // c28cd9e4 + ScrollViewProps, // 02b8255f ScrollViewPropsAndroid, // 02f3df2e ScrollViewPropsIOS, // e93686bd ScrollViewScrollToOptions, // 3313411e SectionBase, // 9f13db00 - SectionList, // de2387ef + SectionList, // 8bdbb63e SectionListData, // 1a4de01a - SectionListInstance, // 18cb42a2 - SectionListProps, // 0b896ccd + SectionListInstance, // 0c0b22e2 + SectionListProps, // f97c16ea SectionListRenderItem, // 715b2086 SectionListRenderItemInfo, // 4a48a922 Separators, // 6a45f7e3 @@ -6133,19 +6133,19 @@ export { StatusBarStyle, // 78f53eea StatusBarVerticalBarEdgeIOS, // f0ffbe54 StyleProp, // fa0e9b4a - StyleSheet, // c4e999f5 + StyleSheet, // 8056a182 SubmitBehavior, // c4ddf490 - Switch, // 742d84cf + Switch, // 67b49ef5 SwitchChangeEvent, // 459b3e36 SwitchInstance, // f17ba6e8 - SwitchProps, // f9d89fff + SwitchProps, // 1904c208 Systrace, // 2a0a0871 TVViewPropsIOS, // 1c612e4e TargetedEvent, // 16e98910 TaskProvider, // 266dedf2 - Text, // e5ca453d + Text, // 9b0ab4e8 TextContentType, // 239b3ecc - TextInput, // 2d145d55 + TextInput, // 049f725c TextInputAndroidProps, // 9ebbc103 TextInputBlurEvent, // ac0d8a35 TextInputChangeEvent, // 4123dc4d @@ -6155,46 +6155,46 @@ export { TextInputIOSProps, // fb3c9327 TextInputInstance, // e5cb59ab TextInputKeyPressEvent, // 5b603a00 - TextInputProps, // e22d3199 + TextInputProps, // b119ebb7 TextInputSelectionChangeEvent, // 817bea8a TextInputSubmitEditingEvent, // 260f6e41 TextInstance, // c927e793 TextLayoutEvent, // e9765128 - TextProps, // 8c6d9a0b - TextStyle, // 3273abd5 + TextProps, // 657544ac + TextStyle, // c7ab3ab7 ToastAndroid, // 88a8969a - TouchableHighlight, // cf3d9aa6 + TouchableHighlight, // 02e4f2a4 TouchableHighlightInstance, // 7fb6781a - TouchableHighlightProps, // 9946a487 - TouchableNativeFeedback, // 57e2aa1a - TouchableNativeFeedbackInstance, // 49aa3150 - TouchableNativeFeedbackProps, // efc2e1d1 - TouchableOpacity, // 1432d33f + TouchableHighlightProps, // 2dc32490 + TouchableNativeFeedback, // d638766d + TouchableNativeFeedbackInstance, // 6f4b427e + TouchableNativeFeedbackProps, // d09e2046 + TouchableOpacity, // e86288ee TouchableOpacityInstance, // dca89710 - TouchableOpacityProps, // 8622c6f0 - TouchableWithoutFeedback, // 50494783 - TouchableWithoutFeedbackProps, // 64c9e4df - TransformsStyle, // 65e70f18 + TouchableOpacityProps, // fdda32ee + TouchableWithoutFeedback, // 4d30da37 + TouchableWithoutFeedbackProps, // 9926e588 + TransformsStyle, // bd31025f TurboModule, // dfe29706 TurboModuleRegistry, // 4ace6db2 UIManager, // 6a18fc05 UTFSequence, // ad625158 Vibration, // 31e4bbf8 - View, // 7986403b + View, // 56949be5 ViewInstance, // 9caf25c4 - ViewProps, // 82e8825a + ViewProps, // 39488310 ViewPropsAndroid, // dada44cc ViewPropsIOS, // 58ee19bf - ViewStyle, // 71dee3fb + ViewStyle, // ab259c7f ViewabilityConfig, // eb3f7ed8 ViewabilityConfigCallbackPair, // bdd0788c VirtualViewMode, // 6be59722 VirtualizedList, // 68c7345e VirtualizedListInstance, // 423ee7c0 - VirtualizedListProps, // 372f7a9e + VirtualizedListProps, // 582c3f20 VirtualizedSectionList, // 9fd9cd61 VirtualizedSectionListInstance, // 12b706d5 - VirtualizedSectionListProps, // 0140c701 + VirtualizedSectionListProps, // b2fbff47 WrapperComponentProvider, // 6ce47ba4 codegenNativeCommands, // 322f3f4e codegenNativeComponent, // 162426af diff --git a/packages/react-native/__typetests__/stylesheet-create.tsx b/packages/react-native/__typetests__/stylesheet-create.tsx index 20f2bcd4eaed..ccafd37b657a 100644 --- a/packages/react-native/__typetests__/stylesheet-create.tsx +++ b/packages/react-native/__typetests__/stylesheet-create.tsx @@ -10,6 +10,7 @@ import * as React from 'react'; // @ts-ignore import {View, StyleSheet, type ShadowStyleIOS} from 'react-native'; +import type {ViewStyle} from 'react-native'; export function App() { return ; @@ -70,3 +71,13 @@ const styles4 = StyleSheet.create({ ], }, }); + +const transforms: ViewStyle['transform'] = []; +transforms.forEach(transform => { + Object.keys(transform); +}); + +const invalidTransforms: ViewStyle['transform'] = [ + // @ts-expect-error Transform objects must not combine multiple properties. + {scale: 1, translateX: 1}, +];