Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,19 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
/**
* BackgroundSize
*/
backgroundSize: backgroundSizeAttribute,
experimental_backgroundSize: backgroundSizeAttribute,

/**
* BackgroundPosition
*/
backgroundPosition: backgroundPositionAttribute,
experimental_backgroundPosition: backgroundPositionAttribute,

/**
* BackgroundRepeat
*/
backgroundRepeat: backgroundRepeatAttribute,
experimental_backgroundRepeat: backgroundRepeatAttribute,

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,11 @@ const validAttributesForNonEventProps = {
transformOrigin: true,
backgroundImage: backgroundImageAttribute,
experimental_backgroundImage: backgroundImageAttribute,
backgroundSize: backgroundSizeAttribute,
experimental_backgroundSize: backgroundSizeAttribute,
backgroundPosition: backgroundPositionAttribute,
experimental_backgroundPosition: backgroundPositionAttribute,
backgroundRepeat: backgroundRepeatAttribute,
experimental_backgroundRepeat: backgroundRepeatAttribute,
boxShadow: boxShadowAttribute,
filter: filterAttribute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,14 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
backgroundImage?: ReadonlyArray<BackgroundImageValue> | string | undefined;
experimental_backgroundImage?:
ReadonlyArray<BackgroundImageValue> | string | undefined;
backgroundSize?: ReadonlyArray<BackgroundSizeValue> | string | undefined;
experimental_backgroundSize?:
ReadonlyArray<BackgroundSizeValue> | string | undefined;
backgroundPosition?:
ReadonlyArray<BackgroundPositionValue> | string | undefined;
experimental_backgroundPosition?:
ReadonlyArray<BackgroundPositionValue> | string | undefined;
backgroundRepeat?: ReadonlyArray<BackgroundRepeatValue> | string | undefined;
experimental_backgroundRepeat?:
ReadonlyArray<BackgroundRepeatValue> | string | undefined;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,12 @@ export type ____ViewStyle_InternalBase = Readonly<{
mixBlendMode?: ____BlendMode_Internal,
backgroundImage?: ReadonlyArray<BackgroundImageValue> | string,
experimental_backgroundImage?: ReadonlyArray<BackgroundImageValue> | string,
backgroundSize?: ReadonlyArray<BackgroundSizeValue> | string,
experimental_backgroundSize?: ReadonlyArray<BackgroundSizeValue> | string,
backgroundPosition?: ReadonlyArray<BackgroundPositionValue> | string,
experimental_backgroundPosition?:
ReadonlyArray<BackgroundPositionValue> | string,
backgroundRepeat?: ReadonlyArray<BackgroundRepeatValue> | string,
experimental_backgroundRepeat?: ReadonlyArray<BackgroundRepeatValue> | string,
isolation?: 'auto' | 'isolate',
}>;
Expand Down
6 changes: 6 additions & 0 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -4532,6 +4532,9 @@ public final class com/facebook/react/uimanager/ViewProps {
public static final field ENABLED Ljava/lang/String;
public static final field END Ljava/lang/String;
public static final field EXPERIMENTAL_BACKGROUND_IMAGE Ljava/lang/String;
public static final field EXPERIMENTAL_BACKGROUND_POSITION Ljava/lang/String;
public static final field EXPERIMENTAL_BACKGROUND_REPEAT Ljava/lang/String;
public static final field EXPERIMENTAL_BACKGROUND_SIZE Ljava/lang/String;
public static final field FILTER Ljava/lang/String;
public static final field FLEX Ljava/lang/String;
public static final field FLEX_BASIS Ljava/lang/String;
Expand Down Expand Up @@ -6524,6 +6527,9 @@ public class com/facebook/react/views/view/ReactViewManager : com/facebook/react
public fun setCollapsable (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
public fun setCollapsableChildren (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
public fun setExperimentalBackgroundImage (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setExperimentalBackgroundPosition (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setExperimentalBackgroundRepeat (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setExperimentalBackgroundSize (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setFocusable (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
public fun setHitSlop (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/Dynamic;)V
public fun setNativeBackground (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableMap;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ public object ViewProps {
public const val BACKGROUND_IMAGE: String = "backgroundImage"
// Backwards-compatible alias for the original experimental_ prefixed prop name.
public const val EXPERIMENTAL_BACKGROUND_IMAGE: String = "experimental_backgroundImage"
public const val BACKGROUND_SIZE: String = "experimental_backgroundSize"
public const val BACKGROUND_POSITION: String = "experimental_backgroundPosition"
public const val BACKGROUND_REPEAT: String = "experimental_backgroundRepeat"
public const val BACKGROUND_SIZE: String = "backgroundSize"
// Backwards-compatible alias for the original experimental_ prefixed prop name.
public const val EXPERIMENTAL_BACKGROUND_SIZE: String = "experimental_backgroundSize"
public const val BACKGROUND_POSITION: String = "backgroundPosition"
// Backwards-compatible alias for the original experimental_ prefixed prop name.
public const val EXPERIMENTAL_BACKGROUND_POSITION: String = "experimental_backgroundPosition"
public const val BACKGROUND_REPEAT: String = "backgroundRepeat"
// Backwards-compatible alias for the original experimental_ prefixed prop name.
public const val EXPERIMENTAL_BACKGROUND_REPEAT: String = "experimental_backgroundRepeat"
public const val FOREGROUND_COLOR: String = "foregroundColor"
public const val COLOR: String = "color"
public const val FONT_SIZE: String = "fontSize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
}
}

@ReactProp(name = ViewProps.EXPERIMENTAL_BACKGROUND_SIZE, customType = "BackgroundSize")
public open fun setExperimentalBackgroundSize(
view: ReactViewGroup,
backgroundSize: ReadableArray?,
) {
setBackgroundSize(view, backgroundSize)
}

@ReactProp(name = ViewProps.BACKGROUND_POSITION, customType = "BackgroundPosition")
public open fun setBackgroundPosition(view: ReactViewGroup, backgroundPosition: ReadableArray?) {
if (backgroundPosition != null && backgroundPosition.size() > 0) {
Expand All @@ -191,6 +199,14 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
}
}

@ReactProp(name = ViewProps.EXPERIMENTAL_BACKGROUND_POSITION, customType = "BackgroundPosition")
public open fun setExperimentalBackgroundPosition(
view: ReactViewGroup,
backgroundPosition: ReadableArray?,
) {
setBackgroundPosition(view, backgroundPosition)
}

@ReactProp(name = ViewProps.BACKGROUND_REPEAT, customType = "BackgroundRepeat")
public open fun setBackgroundRepeat(view: ReactViewGroup, backgroundRepeat: ReadableArray?) {
if (backgroundRepeat != null && backgroundRepeat.size() > 0) {
Expand All @@ -208,6 +224,14 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
}
}

@ReactProp(name = ViewProps.EXPERIMENTAL_BACKGROUND_REPEAT, customType = "BackgroundRepeat")
public open fun setExperimentalBackgroundRepeat(
view: ReactViewGroup,
backgroundRepeat: ReadableArray?,
) {
setBackgroundRepeat(view, backgroundRepeat)
}

@ReactProp(name = "nextFocusDown", defaultInt = View.NO_ID)
public open fun nextFocusDown(view: ReactViewGroup, viewId: Int) {
view.nextFocusDownId = viewId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,35 @@ BaseViewProps::BaseViewProps(
backgroundSize(convertRawProp(
context,
rawProps,
"experimental_backgroundSize",
sourceProps.backgroundSize,
"backgroundSize",
convertRawProp(
context,
rawProps,
"experimental_backgroundSize",
sourceProps.backgroundSize,
{}),
{})),
backgroundPosition(convertRawProp(
context,
rawProps,
"experimental_backgroundPosition",
sourceProps.backgroundPosition,
"backgroundPosition",
convertRawProp(
context,
rawProps,
"experimental_backgroundPosition",
sourceProps.backgroundPosition,
{}),
{})),
backgroundRepeat(convertRawProp(
context,
rawProps,
"experimental_backgroundRepeat",
sourceProps.backgroundRepeat,
"backgroundRepeat",
convertRawProp(
context,
rawProps,
"experimental_backgroundRepeat",
sourceProps.backgroundRepeat,
{}),
{})),
mixBlendMode(convertRawProp(
context,
Expand Down Expand Up @@ -338,9 +353,12 @@ void BaseViewProps::setProp(
RAW_SET_PROP_SWITCH_CASE_BASIC(backgroundColor);
RAW_SET_PROP_SWITCH_CASE_BASIC(backgroundImage);
RAW_SET_PROP_SWITCH_CASE(backgroundImage, "experimental_backgroundImage");
RAW_SET_PROP_SWITCH_CASE_BASIC(backgroundSize);
RAW_SET_PROP_SWITCH_CASE(backgroundSize, "experimental_backgroundSize");
RAW_SET_PROP_SWITCH_CASE_BASIC(backgroundPosition);
RAW_SET_PROP_SWITCH_CASE(
backgroundPosition, "experimental_backgroundPosition");
RAW_SET_PROP_SWITCH_CASE_BASIC(backgroundRepeat);
RAW_SET_PROP_SWITCH_CASE(backgroundRepeat, "experimental_backgroundRepeat");
RAW_SET_PROP_SWITCH_CASE_BASIC(shadowColor);
RAW_SET_PROP_SWITCH_CASE_BASIC(shadowOffset);
Expand Down
Loading
Loading