Skip to content

Commit d7766fa

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Move background drawing code from "react/views/view" to "react/uimanager/drawable" (#43720)
Summary: Pull Request resolved: #43720 This lets us use BG drawing code in rules which view depends on. I also removed some lib usage. The original class is still present, subclassing the class in its new location, but is marked deprecated. Next diffs in stack clean up some of our own now deprecated usage. Changelog: [Android][Breaking] - Deprecate `ReactViewBackgroundDrawable` in favor of `CSSBackgroundDrawable` Reviewed By: javache Differential Revision: D55565035 fbshipit-source-id: 501b3e2f674c09a88b1825657ba6349823054e8c
1 parent 1b152f6 commit d7766fa

File tree

5 files changed

+1512
-1526
lines changed

5 files changed

+1512
-1526
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5448,6 +5448,53 @@ public abstract interface class com/facebook/react/uimanager/debug/NotThreadSafe
54485448
public abstract fun onViewHierarchyUpdateFinished ()V
54495449
}
54505450

5451+
public class com/facebook/react/uimanager/drawable/CSSBackgroundDrawable : android/graphics/drawable/Drawable {
5452+
public fun <init> (Landroid/content/Context;)V
5453+
public fun borderBoxPath ()Landroid/graphics/Path;
5454+
public fun draw (Landroid/graphics/Canvas;)V
5455+
public fun getAlpha ()I
5456+
public fun getBorderColor (I)I
5457+
public fun getBorderRadius (Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;)F
5458+
public fun getBorderRadiusOrDefaultTo (FLcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;)F
5459+
public fun getBorderWidthOrDefaultTo (FI)F
5460+
public fun getDirectionAwareBorderInsets ()Landroid/graphics/RectF;
5461+
public fun getFullBorderRadius ()F
5462+
public fun getFullBorderWidth ()F
5463+
public fun getOpacity ()I
5464+
public fun getOutline (Landroid/graphics/Outline;)V
5465+
public fun getResolvedLayoutDirection ()I
5466+
public fun hasRoundedBorders ()Z
5467+
protected fun onBoundsChange (Landroid/graphics/Rect;)V
5468+
public fun onResolvedLayoutDirectionChanged (I)Z
5469+
public fun paddingBoxPath ()Landroid/graphics/Path;
5470+
public fun setAlpha (I)V
5471+
public fun setBorderColor (IFF)V
5472+
public fun setBorderStyle (Ljava/lang/String;)V
5473+
public fun setBorderWidth (IF)V
5474+
public fun setColor (I)V
5475+
public fun setColorFilter (Landroid/graphics/ColorFilter;)V
5476+
public fun setRadius (F)V
5477+
public fun setRadius (FI)V
5478+
public fun setResolvedLayoutDirection (I)Z
5479+
}
5480+
5481+
public final class com/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation : java/lang/Enum {
5482+
public static final field BOTTOM_END Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5483+
public static final field BOTTOM_LEFT Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5484+
public static final field BOTTOM_RIGHT Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5485+
public static final field BOTTOM_START Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5486+
public static final field END_END Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5487+
public static final field END_START Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5488+
public static final field START_END Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5489+
public static final field START_START Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5490+
public static final field TOP_END Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5491+
public static final field TOP_LEFT Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5492+
public static final field TOP_RIGHT Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5493+
public static final field TOP_START Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5494+
public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5495+
public static fun values ()[Lcom/facebook/react/uimanager/drawable/CSSBackgroundDrawable$BorderRadiusLocation;
5496+
}
5497+
54515498
public abstract interface class com/facebook/react/uimanager/events/BatchEventDispatchedListener {
54525499
public abstract fun onBatchEventDispatched ()V
54535500
}
@@ -7672,8 +7719,6 @@ public final class com/facebook/react/views/unimplementedview/ReactUnimplemented
76727719

76737720
public final class com/facebook/react/views/view/ColorUtil {
76747721
public static final field INSTANCE Lcom/facebook/react/views/view/ColorUtil;
7675-
public static final fun getOpacityFromColor (I)I
7676-
public static final fun multiplyColorAlpha (II)I
76777722
public static final fun normalize (DDDD)I
76787723
}
76797724

@@ -7706,49 +7751,8 @@ public class com/facebook/react/views/view/ReactDrawableHelper {
77067751
public static fun createDrawableFromJSDescription (Landroid/content/Context;Lcom/facebook/react/bridge/ReadableMap;)Landroid/graphics/drawable/Drawable;
77077752
}
77087753

7709-
public class com/facebook/react/views/view/ReactViewBackgroundDrawable : android/graphics/drawable/Drawable {
7754+
public class com/facebook/react/views/view/ReactViewBackgroundDrawable : com/facebook/react/uimanager/drawable/CSSBackgroundDrawable {
77107755
public fun <init> (Landroid/content/Context;)V
7711-
public fun draw (Landroid/graphics/Canvas;)V
7712-
public fun getAlpha ()I
7713-
public fun getBorderColor (I)I
7714-
public fun getBorderRadius (Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;)F
7715-
public fun getBorderRadiusOrDefaultTo (FLcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;)F
7716-
public fun getBorderWidthOrDefaultTo (FI)F
7717-
public fun getDirectionAwareBorderInsets ()Landroid/graphics/RectF;
7718-
public fun getFullBorderRadius ()F
7719-
public fun getFullBorderWidth ()F
7720-
public fun getOpacity ()I
7721-
public fun getOutline (Landroid/graphics/Outline;)V
7722-
public fun getResolvedLayoutDirection ()I
7723-
public fun hasRoundedBorders ()Z
7724-
protected fun onBoundsChange (Landroid/graphics/Rect;)V
7725-
public fun onResolvedLayoutDirectionChanged (I)Z
7726-
public fun setAlpha (I)V
7727-
public fun setBorderColor (IFF)V
7728-
public fun setBorderStyle (Ljava/lang/String;)V
7729-
public fun setBorderWidth (IF)V
7730-
public fun setColor (I)V
7731-
public fun setColorFilter (Landroid/graphics/ColorFilter;)V
7732-
public fun setRadius (F)V
7733-
public fun setRadius (FI)V
7734-
public fun setResolvedLayoutDirection (I)Z
7735-
}
7736-
7737-
public final class com/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation : java/lang/Enum {
7738-
public static final field BOTTOM_END Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7739-
public static final field BOTTOM_LEFT Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7740-
public static final field BOTTOM_RIGHT Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7741-
public static final field BOTTOM_START Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7742-
public static final field END_END Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7743-
public static final field END_START Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7744-
public static final field START_END Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7745-
public static final field START_START Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7746-
public static final field TOP_END Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7747-
public static final field TOP_LEFT Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7748-
public static final field TOP_RIGHT Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7749-
public static final field TOP_START Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7750-
public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
7751-
public static fun values ()[Lcom/facebook/react/views/view/ReactViewBackgroundDrawable$BorderRadiusLocation;
77527756
}
77537757

77547758
public class com/facebook/react/views/view/ReactViewBackgroundManager {

0 commit comments

Comments
 (0)