Skip to content

Commit 0984d6d

Browse files
authored
Fix strict transform array element type (#57908)
1 parent df5c1a1 commit 0984d6d

3 files changed

Lines changed: 85 additions & 74 deletions

File tree

‎packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type ValueOfUnion<T, K> = T extends any
2121
: empty
2222
: empty;
2323
type MergeUnion<T> = {
24-
[K in KeysOfUnion<T>]?: ValueOfUnion<T, K>,
24+
[K in KeysOfUnion<T>]: ValueOfUnion<T, K>,
2525
};
2626
type MaximumOneOf<T extends {...}> = Values<{
2727
[K in keyof T]: $Exact<{

‎packages/react-native/ReactNativeApi.d.ts‎

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<08c63097104ab811ba2be19ded117820>>
7+
* @generated SignedSource<<83cb6ada8f8cb7c30a4c47d44d892dca>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -3109,7 +3109,7 @@ declare type MeasureOnSuccessCallback = (
31093109
pageX: number,
31103110
pageY: number,
31113111
) => void
3112-
declare type MergeUnion<T> = { [K in KeysOfUnion<T>]?: ValueOfUnion<T, K> }
3112+
declare type MergeUnion<T> = { [K in KeysOfUnion<T>]: ValueOfUnion<T, K> }
31133113
declare type Message = {
31143114
readonly content: string
31153115
readonly substitutions: ReadonlyArray<{
@@ -5893,24 +5893,24 @@ export {
58935893
AccessibilityValue, // cf8bcb74
58945894
ActionSheetIOS, // b558559e
58955895
ActionSheetIOSOptions, // 1756eb5a
5896-
ActivityIndicator, // b7793e9b
5896+
ActivityIndicator, // d3d83f9c
58975897
ActivityIndicatorInstance, // 69299e35
5898-
ActivityIndicatorProps, // 0489dc5e
5898+
ActivityIndicatorProps, // 1c8778b2
58995899
Alert, // a398a509
59005900
AlertButton, // bf1a3b60
59015901
AlertButtonStyle, // ec9fb242
59025902
AlertOptions, // 8a116d2a
59035903
AlertType, // 5ab91217
59045904
AndroidKeyboardEvent, // e03becc8
5905-
Animated, // ba13f2de
5906-
AnimatedFlatList, // 074a4512
5907-
AnimatedImage, // 7efc2e4d
5908-
AnimatedScrollView, // 338d60e0
5909-
AnimatedSectionList, // 78177f8d
5910-
AnimatedText, // c068e60d
5911-
AnimatedView, // 0f3aeb93
5905+
Animated, // 7e828987
5906+
AnimatedFlatList, // f32979ff
5907+
AnimatedImage, // 08521177
5908+
AnimatedScrollView, // 1b410f55
5909+
AnimatedSectionList, // 8614a499
5910+
AnimatedText, // 206f1fc7
5911+
AnimatedView, // 544c0f25
59125912
AppConfig, // 80afc5fa
5913-
AppRegistry, // 2fad6d0e
5913+
AppRegistry, // 41af4d77
59145914
AppState, // db34d225
59155915
AppStateEvent, // 80f034c3
59165916
AppStateStatus, // 447e5ef2
@@ -5922,8 +5922,8 @@ export {
59225922
BackPressEventName, // 4620fb76
59235923
BlurEvent, // 00c596e2
59245924
BoxShadowValue, // b679703f
5925-
Button, // 2ec045d1
5926-
ButtonInstance, // 3bfc75a3
5925+
Button, // a3e7b8d7
5926+
ButtonInstance, // 1fc47df7
59275927
ButtonProps, // 2fe658e4
59285928
CodegenTypes, // d0052fd4
59295929
ColorSchemeName, // 6615edd6
@@ -5941,9 +5941,9 @@ export {
59415941
DimensionsPayload, // 653bc26c
59425942
DisplayMetrics, // 1dc35cef
59435943
DisplayMetricsAndroid, // 872e62eb
5944-
DrawerLayoutAndroid, // 65e3d444
5944+
DrawerLayoutAndroid, // d7de576f
59455945
DrawerLayoutAndroidInstance, // aa243cbf
5946-
DrawerLayoutAndroidProps, // 013b18ba
5946+
DrawerLayoutAndroidProps, // 1ccf53ee
59475947
DrawerSlideEvent, // aa703fa0
59485948
DropShadowValue, // e9df2606
59495949
DynamicColorIOS, // d96c228c
@@ -5959,9 +5959,9 @@ export {
59595959
EventSubscription, // b8d084aa
59605960
ExtendedExceptionData, // 5a6ccf5a
59615961
FilterFunction, // bf24c0e3
5962-
FlatList, // 733aeed0
5963-
FlatListInstance, // e268301f
5964-
FlatListProps, // b23f662a
5962+
FlatList, // 50519124
5963+
FlatListInstance, // 92a00395
5964+
FlatListProps, // e060e11e
59655965
FocusEvent, // f7d67f9b
59665966
FontVariant, // 7c7558bb
59675967
GestureResponderEvent, // cbf6abac
@@ -5972,37 +5972,37 @@ export {
59725972
IEventEmitter, // fbef6131
59735973
IOSKeyboardEvent, // e67bfe3a
59745974
IgnorePattern, // ec6f6ece
5975-
Image, // 9955197c
5976-
ImageBackground, // 5725330b
5977-
ImageBackgroundInstance, // b89488b9
5978-
ImageBackgroundProps, // 69b7bff8
5975+
Image, // c885ba6b
5976+
ImageBackground, // 95cd583e
5977+
ImageBackgroundInstance, // 1e7a8f97
5978+
ImageBackgroundProps, // d8032f13
59795979
ImageErrorEvent, // e2926c20
59805980
ImageInstance, // 46f8deb7
59815981
ImageLoadEvent, // 9b52ad36
59825982
ImageProgressEventIOS, // a97c3831
5983-
ImageProps, // dbe27897
5983+
ImageProps, // bc0897bb
59845984
ImagePropsAndroid, // 283349a4
5985-
ImagePropsBase, // 5cc32b8d
5985+
ImagePropsBase, // 1b309ff5
59865986
ImagePropsIOS, // 4f29f905
59875987
ImageRequireSource, // 681d683b
59885988
ImageResizeMode, // d51106e2
59895989
ImageResolvedAssetSource, // f3060931
59905990
ImageSize, // 1c47cf88
59915991
ImageSource, // bba5e24d
59925992
ImageSourcePropType, // ff97c174
5993-
ImageStyle, // 363a3e5a
5993+
ImageStyle, // bdf1febd
59945994
ImageURISource, // 9bf63692
5995-
InputAccessoryView, // 5cc534c4
5996-
InputAccessoryViewProps, // 01e6ca03
5995+
InputAccessoryView, // 8f1ce5aa
5996+
InputAccessoryViewProps, // d5fcc450
59975997
InputModeOptions, // 4e8581b9
59985998
Insets, // e7fe432a
59995999
KeyDownEvent, // ccd5ec9d
60006000
KeyEvent, // 20fa4267
60016001
KeyUpEvent, // e45aac1c
60026002
Keyboard, // a26f7bd4
6003-
KeyboardAvoidingView, // ec903233
6004-
KeyboardAvoidingViewInstance, // 9512f9c1
6005-
KeyboardAvoidingViewProps, // 13f6fa24
6003+
KeyboardAvoidingView, // 0777fc80
6004+
KeyboardAvoidingViewInstance, // 9cc8dcd1
6005+
KeyboardAvoidingViewProps, // 70793ff3
60066006
KeyboardEvent, // c3f895d4
60076007
KeyboardEventEasing, // af4091c8
60086008
KeyboardEventName, // 59299ad6
@@ -6027,10 +6027,10 @@ export {
60276027
MeasureInWindowOnSuccessCallback, // a285f598
60286028
MeasureLayoutOnSuccessCallback, // 3592502a
60296029
MeasureOnSuccessCallback, // 82824e59
6030-
Modal, // 7910201f
6030+
Modal, // 8b24c4b7
60316031
ModalBaseProps, // 18ba4525
60326032
ModalInstance, // c47ff608
6033-
ModalProps, // 9d78b278
6033+
ModalProps, // 76fd01f8
60346034
ModalPropsAndroid, // 515fb173
60356035
ModalPropsIOS, // 7943cbd7
60366036
ModeChangeEvent, // 9e9a28c4
@@ -6066,25 +6066,25 @@ export {
60666066
PointerEvent, // a3d953b4
60676067
PressabilityConfig, // 5a09717f
60686068
PressabilityEventHandlers, // 4ffc75dd
6069-
Pressable, // 08640c93
6069+
Pressable, // 858e0346
60706070
PressableAndroidRippleConfig, // ee32eaca
60716071
PressableInstance, // 4f7bc23d
6072-
PressableProps, // bd3d6042
6072+
PressableProps, // f3b74cf5
60736073
PressableStateCallbackType, // f83728cd
60746074
ProcessedColorValue, // 33f74304
6075-
ProgressBarAndroid, // d5f7ad5d
6075+
ProgressBarAndroid, // 8e22f9ee
60766076
ProgressBarAndroidInstance, // e049fddf
6077-
ProgressBarAndroidProps, // 4b8826f6
6077+
ProgressBarAndroidProps, // dc17c3d8
60786078
PublicRootInstance, // 8040afd7
60796079
PublicTextInstance, // ab85b323
60806080
PushNotificationEventName, // 84e7e150
60816081
PushNotificationIOS, // b4d1fe78
60826082
PushNotificationPermissions, // c2e7ae4f
60836083
Rationale, // 5df1b1c1
60846084
ReactNativeVersion, // abd76827
6085-
RefreshControl, // 48abafa2
6086-
RefreshControlInstance, // b79668ce
6087-
RefreshControlProps, // 511625b4
6085+
RefreshControl, // 4b4186d8
6086+
RefreshControlInstance, // 8d87c316
6087+
RefreshControlProps, // 80e8d893
60886088
RefreshControlPropsAndroid, // 8ac931ca
60896089
RefreshControlPropsIOS, // 72a36381
60906090
Registry, // e7beb42e
@@ -6093,29 +6093,29 @@ export {
60936093
Role, // af7b889d
60946094
RootTag, // 3cd10504
60956095
RootTagContext, // 38bfc8f6
6096-
RootViewStyleProvider, // bcc31cf3
6096+
RootViewStyleProvider, // dbd25fa3
60976097
Runnable, // 557d13d9
60986098
Runnables, // 75114853
60996099
SafeAreaInsets, // 64d7a605
61006100
SafeAreaInsetsChangeEvent, // ecf5a1e0
6101-
SafeAreaView, // fa1a071b
6101+
SafeAreaView, // 5594e471
61026102
SafeAreaViewInstance, // a873bd17
61036103
ScaledSize, // 07e417c7
61046104
ScrollEvent, // 8dfaa310
6105-
ScrollResponderType, // d9b5b457
6105+
ScrollResponderType, // cff93290
61066106
ScrollToLocationParamsType, // d7ecdad1
6107-
ScrollView, // d57bd638
6108-
ScrollViewImperativeMethods, // eca21efb
6109-
ScrollViewInstance, // 1bb729e1
6110-
ScrollViewProps, // 3a8aadd4
6107+
ScrollView, // c9a216ec
6108+
ScrollViewImperativeMethods, // 057d1f97
6109+
ScrollViewInstance, // c28cd9e4
6110+
ScrollViewProps, // 02b8255f
61116111
ScrollViewPropsAndroid, // 02f3df2e
61126112
ScrollViewPropsIOS, // e93686bd
61136113
ScrollViewScrollToOptions, // 3313411e
61146114
SectionBase, // 9f13db00
6115-
SectionList, // de2387ef
6115+
SectionList, // 8bdbb63e
61166116
SectionListData, // 1a4de01a
6117-
SectionListInstance, // 18cb42a2
6118-
SectionListProps, // 0b896ccd
6117+
SectionListInstance, // 0c0b22e2
6118+
SectionListProps, // f97c16ea
61196119
SectionListRenderItem, // 715b2086
61206120
SectionListRenderItemInfo, // 4a48a922
61216121
Separators, // 6a45f7e3
@@ -6133,19 +6133,19 @@ export {
61336133
StatusBarStyle, // 78f53eea
61346134
StatusBarVerticalBarEdgeIOS, // f0ffbe54
61356135
StyleProp, // fa0e9b4a
6136-
StyleSheet, // c4e999f5
6136+
StyleSheet, // 8056a182
61376137
SubmitBehavior, // c4ddf490
6138-
Switch, // 742d84cf
6138+
Switch, // 67b49ef5
61396139
SwitchChangeEvent, // 459b3e36
61406140
SwitchInstance, // f17ba6e8
6141-
SwitchProps, // f9d89fff
6141+
SwitchProps, // 1904c208
61426142
Systrace, // 2a0a0871
61436143
TVViewPropsIOS, // 1c612e4e
61446144
TargetedEvent, // 16e98910
61456145
TaskProvider, // 266dedf2
6146-
Text, // e5ca453d
6146+
Text, // 9b0ab4e8
61476147
TextContentType, // 239b3ecc
6148-
TextInput, // 2d145d55
6148+
TextInput, // 049f725c
61496149
TextInputAndroidProps, // 9ebbc103
61506150
TextInputBlurEvent, // ac0d8a35
61516151
TextInputChangeEvent, // 4123dc4d
@@ -6155,46 +6155,46 @@ export {
61556155
TextInputIOSProps, // fb3c9327
61566156
TextInputInstance, // e5cb59ab
61576157
TextInputKeyPressEvent, // 5b603a00
6158-
TextInputProps, // e22d3199
6158+
TextInputProps, // b119ebb7
61596159
TextInputSelectionChangeEvent, // 817bea8a
61606160
TextInputSubmitEditingEvent, // 260f6e41
61616161
TextInstance, // c927e793
61626162
TextLayoutEvent, // e9765128
6163-
TextProps, // 8c6d9a0b
6164-
TextStyle, // 3273abd5
6163+
TextProps, // 657544ac
6164+
TextStyle, // c7ab3ab7
61656165
ToastAndroid, // 88a8969a
6166-
TouchableHighlight, // cf3d9aa6
6166+
TouchableHighlight, // 02e4f2a4
61676167
TouchableHighlightInstance, // 7fb6781a
6168-
TouchableHighlightProps, // 9946a487
6169-
TouchableNativeFeedback, // 57e2aa1a
6170-
TouchableNativeFeedbackInstance, // 49aa3150
6171-
TouchableNativeFeedbackProps, // efc2e1d1
6172-
TouchableOpacity, // 1432d33f
6168+
TouchableHighlightProps, // 2dc32490
6169+
TouchableNativeFeedback, // d638766d
6170+
TouchableNativeFeedbackInstance, // 6f4b427e
6171+
TouchableNativeFeedbackProps, // d09e2046
6172+
TouchableOpacity, // e86288ee
61736173
TouchableOpacityInstance, // dca89710
6174-
TouchableOpacityProps, // 8622c6f0
6175-
TouchableWithoutFeedback, // 50494783
6176-
TouchableWithoutFeedbackProps, // 64c9e4df
6177-
TransformsStyle, // 65e70f18
6174+
TouchableOpacityProps, // fdda32ee
6175+
TouchableWithoutFeedback, // 4d30da37
6176+
TouchableWithoutFeedbackProps, // 9926e588
6177+
TransformsStyle, // bd31025f
61786178
TurboModule, // dfe29706
61796179
TurboModuleRegistry, // 4ace6db2
61806180
UIManager, // 6a18fc05
61816181
UTFSequence, // ad625158
61826182
Vibration, // 31e4bbf8
6183-
View, // 7986403b
6183+
View, // 56949be5
61846184
ViewInstance, // 9caf25c4
6185-
ViewProps, // 82e8825a
6185+
ViewProps, // 39488310
61866186
ViewPropsAndroid, // dada44cc
61876187
ViewPropsIOS, // 58ee19bf
6188-
ViewStyle, // 71dee3fb
6188+
ViewStyle, // ab259c7f
61896189
ViewabilityConfig, // eb3f7ed8
61906190
ViewabilityConfigCallbackPair, // bdd0788c
61916191
VirtualViewMode, // 6be59722
61926192
VirtualizedList, // 68c7345e
61936193
VirtualizedListInstance, // 423ee7c0
6194-
VirtualizedListProps, // 372f7a9e
6194+
VirtualizedListProps, // 582c3f20
61956195
VirtualizedSectionList, // 9fd9cd61
61966196
VirtualizedSectionListInstance, // 12b706d5
6197-
VirtualizedSectionListProps, // 0140c701
6197+
VirtualizedSectionListProps, // b2fbff47
61986198
WrapperComponentProvider, // 6ce47ba4
61996199
codegenNativeCommands, // 322f3f4e
62006200
codegenNativeComponent, // 162426af

‎packages/react-native/__typetests__/stylesheet-create.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import * as React from 'react';
1111
// @ts-ignore
1212
import {View, StyleSheet, type ShadowStyleIOS} from 'react-native';
13+
import type {ViewStyle} from 'react-native';
1314

1415
export function App() {
1516
return <View style={styles.container} />;
@@ -70,3 +71,13 @@ const styles4 = StyleSheet.create({
7071
],
7172
},
7273
});
74+
75+
const transforms: ViewStyle['transform'] = [];
76+
transforms.forEach(transform => {
77+
Object.keys(transform);
78+
});
79+
80+
const invalidTransforms: ViewStyle['transform'] = [
81+
// @ts-expect-error Transform objects must not combine multiple properties.
82+
{scale: 1, translateX: 1},
83+
];

0 commit comments

Comments
 (0)