Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
preynal authored Sep 24, 2024
2 parents beff214 + af277bf commit 6937c65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
1 change: 0 additions & 1 deletion packages/react-native-reanimated/android/empty.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.UIManagerReanimatedHelper;
import com.facebook.react.uimanager.common.UIManagerType;
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable;
import com.facebook.react.uimanager.events.Event;
import com.facebook.react.uimanager.events.EventDispatcherListener;
import com.facebook.react.uimanager.events.RCTEventEmitter;
import com.facebook.react.views.view.ReactViewBackgroundDrawable;
import com.swmansion.reanimated.layoutReanimation.AnimationsManager;
import com.swmansion.reanimated.nativeProxy.NoopEventHandler;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
Expand Down Expand Up @@ -458,26 +457,17 @@ public String obtainProp(int viewTag, String propName) {
}
case "backgroundColor" -> {
Drawable background = view.getBackground();
int actualColor = -1;
try {
Method getColor = background.getClass().getMethod("getColor");
int actualColor = (int) getColor.invoke(background);

// ReactViewBackgroundDrawable got deprecated in react-native 0.75.
//noinspection deprecation
if (background instanceof ReactViewBackgroundDrawable) {
//noinspection deprecation
actualColor = ((ReactViewBackgroundDrawable) background).getColor();
}
String invertedColor = String.format("%08x", (0xFFFFFFFF & actualColor));
// By default transparency is first, color second
return "#" + invertedColor.substring(2, 8) + invertedColor.substring(0, 2);

if (background instanceof CSSBackgroundDrawable) {
actualColor = ((CSSBackgroundDrawable) background).getColor();
}

if (actualColor == -1) {
} catch (Exception e) {
return "Unable to resolve background color";
}

String invertedColor = String.format("%08x", actualColor);
// By default transparency is first, color second
return "#" + invertedColor.substring(2, 8) + invertedColor.substring(0, 2);
}
default -> {
throw new IllegalArgumentException(
Expand Down

0 comments on commit 6937c65

Please sign in to comment.