Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import type {AnyAttributeType} from '../../Renderer/shims/ReactNativeTypes';
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
import processAspectRatio from '../../StyleSheet/processAspectRatio';
import processBackgroundImage from '../../StyleSheet/processBackgroundImage';
import processBackgroundPosition from '../../StyleSheet/processBackgroundPosition';
import processBackgroundRepeat from '../../StyleSheet/processBackgroundRepeat';
import processBackgroundSize from '../../StyleSheet/processBackgroundSize';
import processBoxShadow from '../../StyleSheet/processBoxShadow';
import processColor from '../../StyleSheet/processColor';
import processFilter from '../../StyleSheet/processFilter';
Expand Down Expand Up @@ -144,11 +147,26 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
: {process: processBoxShadow},

/**
* Linear Gradient
* BackgroundImage
*/
experimental_backgroundImage: ReactNativeFeatureFlags.enableNativeCSSParsing()
? true
: {process: processBackgroundImage},
/**
* BackgroundSize
*/
experimental_backgroundSize: {process: processBackgroundSize},

/**
* BackgroundPosition
*/
experimental_backgroundPosition: {process: processBackgroundPosition},

/**
* BackgroundRepeat
*/
experimental_backgroundRepeat: {process: processBackgroundRepeat},

/**
* View
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ const validAttributesForNonEventProps = {
experimental_backgroundImage: ReactNativeFeatureFlags.enableNativeCSSParsing()
? (true as const)
: {process: require('../StyleSheet/processBackgroundImage').default},
experimental_backgroundSize: {
process: require('../StyleSheet/processBackgroundSize').default,
},
experimental_backgroundPosition: {
process: require('../StyleSheet/processBackgroundPosition').default,
},
experimental_backgroundRepeat: {
process: require('../StyleSheet/processBackgroundRepeat').default,
},
boxShadow: ReactNativeFeatureFlags.enableNativeCSSParsing()
? (true as const)
: {process: require('../StyleSheet/processBoxShadow').default},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const ReactNativeStyleAttributes =
const resolveAssetSource = require('../Image/resolveAssetSource').default;
const processBackgroundImage =
require('../StyleSheet/processBackgroundImage').default;
const processBackgroundPosition =
require('../StyleSheet/processBackgroundPosition').default;
const processBackgroundRepeat =
require('../StyleSheet/processBackgroundRepeat').default;
const processBackgroundSize =
require('../StyleSheet/processBackgroundSize').default;
const processColor = require('../StyleSheet/processColor').default;
const processColorArray = require('../StyleSheet/processColorArray').default;
const processFilter = require('../StyleSheet/processFilter').default;
Expand Down Expand Up @@ -203,6 +209,12 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any {
return processFilter;
case 'BackgroundImage':
return processBackgroundImage;
case 'BackgroundPosition':
return processBackgroundPosition;
case 'BackgroundRepeat':
return processBackgroundRepeat;
case 'BackgroundSize':
return processBackgroundSize;
case 'ImageSource':
return resolveAssetSource;
case 'BoxShadow':
Expand Down
44 changes: 44 additions & 0 deletions packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,43 @@ type RadialGradientValue = {

export type BackgroundImageValue = LinearGradientValue | RadialGradientValue;

export type BackgroundSizeValue =
| {
x: string | number,
y: string | number,
}
| 'cover'
| 'contain';

export type BackgroundRepeatKeyword =
| 'repeat'
| 'space'
| 'round'
| 'no-repeat';

export type BackgroundPositionValue =
| {
top: number | string,
left: number | string,
}
| {
top: number | string,
right: number | string,
}
| {
bottom: number | string,
left: number | string,
}
| {
bottom: number | string,
right: number | string,
};

export type BackgroundRepeatValue = {
x: BackgroundRepeatKeyword,
y: BackgroundRepeatKeyword,
};

export type BoxShadowValue = {
offsetX: number | string,
offsetY: number | string,
Expand Down Expand Up @@ -853,6 +890,13 @@ export type ____ViewStyle_InternalBase = $ReadOnly<{
filter?: $ReadOnlyArray<FilterFunction> | string,
mixBlendMode?: ____BlendMode_Internal,
experimental_backgroundImage?: $ReadOnlyArray<BackgroundImageValue> | string,
experimental_backgroundSize?: $ReadOnlyArray<BackgroundSizeValue> | string,
experimental_backgroundPosition?:
| $ReadOnlyArray<BackgroundPositionValue>
| string,
experimental_backgroundRepeat?:
| $ReadOnlyArray<BackgroundRepeatValue>
| string,
isolation?: 'auto' | 'isolate',
}>;

Expand Down
Loading
Loading