mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add support for shadowColor on Android (API >= 28) (#28650)
Summary: This PR adds support for the `shadowColor` style on Android. This is possible as of Android P using the `setOutlineAmbientShadowColor` and `setOutlineSpotShadowColor` View methods. The actual rendered color is a multiplication of the color-alpha, shadow-effect and elevation-value. ## Changelog `[Android] [Added] - Add support for shadowColor on API level >= 28` Pull Request resolved: https://github.com/facebook/react-native/pull/28650 Test Plan: - Only execute code on Android P - Added Android `BoxShadow` tests to RNTester app  Reviewed By: mdvacca Differential Revision: D21125479 Pulled By: shergin fbshipit-source-id: 14dcc023977d7a9d304fabcd3c90bcf34482f137
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e96f1e1d83
commit
cfa4260598
@@ -95,6 +95,15 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
ViewCompat.setElevation(view, PixelUtil.toPixelFromDIP(elevation));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = ViewProps.SHADOW_COLOR, defaultInt = Color.BLACK, customType = "Color")
|
||||
public void setShadowColor(@NonNull T view, int shadowColor) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
view.setOutlineAmbientShadowColor(shadowColor);
|
||||
view.setOutlineSpotShadowColor(shadowColor);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ReactProp(name = ViewProps.Z_INDEX)
|
||||
public void setZIndex(@NonNull T view, float zIndex) {
|
||||
|
||||
Reference in New Issue
Block a user