diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js index c7f1dde4ac0..edda6b7e43b 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -1002,6 +1002,7 @@ export type ____ImageStyle_InternalCore = $ReadOnly<{ objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none', tintColor?: ____ColorValue_Internal, overlayColor?: string, + overflow?: 'visible' | 'hidden', }>; export type ____ImageStyle_Internal = $ReadOnly<{ 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 8313e30dd17..23d220166cd 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 @@ -7518,6 +7518,7 @@ export type ____ImageStyle_InternalCore = $ReadOnly<{ objectFit?: \\"cover\\" | \\"contain\\" | \\"fill\\" | \\"scale-down\\" | \\"none\\", tintColor?: ____ColorValue_Internal, overlayColor?: string, + overflow?: \\"visible\\" | \\"hidden\\", }>; export type ____ImageStyle_Internal = $ReadOnly<{ ...____ImageStyle_InternalCore, diff --git a/packages/react-native/src/private/styles/composeStyles.js b/packages/react-native/src/private/styles/composeStyles.js index 8f47ba0f4ff..6ae46a75ce5 100644 --- a/packages/react-native/src/private/styles/composeStyles.js +++ b/packages/react-native/src/private/styles/composeStyles.js @@ -4,19 +4,26 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict * @format */ +import type { + ImageStyle, + TextStyle, + ViewStyle, +} from '../../../Libraries/StyleSheet/StyleSheet'; +import type {StyleProp} from '../../../Libraries/StyleSheet/StyleSheetTypes'; + /** * Combines two styles such that `style2` will override any styles in `style1`. * If either style is null or undefined, the other one is returned without * allocating an array, saving allocations and enabling memoization. */ -export default function composeStyles( - style1: ?T1, - style2: ?T2, -): ?(T1 | T2 | $ReadOnlyArray) { +export default function composeStyles< + T: ViewStyle | ImageStyle | TextStyle, + U: T, + V: T, +>(style1: ?StyleProp, style2: ?StyleProp): ?StyleProp { if (style1 == null) { return style2; } diff --git a/packages/rn-tester/js/examples/Filter/FilterExample.js b/packages/rn-tester/js/examples/Filter/FilterExample.js index 1f02a2a366e..46642348c78 100644 --- a/packages/rn-tester/js/examples/Filter/FilterExample.js +++ b/packages/rn-tester/js/examples/Filter/FilterExample.js @@ -34,6 +34,7 @@ function StaticViewAndImage(props: Props): React.Node { Hello world! + {/* $FlowFixMe - ImageStyle is not compatible with ViewStyle */} + {/* $FlowFixMe - ImageStyle is not compatible with ViewStyle */}