|
11 | 11 | import android.os.Build; |
12 | 12 | import android.os.Bundle; |
13 | 13 | import android.util.Base64; |
| 14 | +import android.util.TypedValue; |
14 | 15 | import android.view.View; |
15 | 16 | import android.view.ViewGroup; |
16 | 17 | import android.widget.RemoteViews; |
@@ -179,6 +180,16 @@ private void addClickableArea(RemoteViews widgetView, ViewGroup rootWidget, Clic |
179 | 180 |
|
180 | 181 | clickableRemoteView.setInt(R.id.rn_widget_clickable_area, "setMinimumHeight", offsetViewBounds.height()); |
181 | 182 |
|
| 183 | + // The clickable overlay draws its own ripple, so match it to the view's radius when supported |
| 184 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && clickableView.getBorderRadius() > 0f) { |
| 185 | + clickableRemoteView.setViewOutlinePreferredRadius( |
| 186 | + R.id.rn_widget_clickable_area, |
| 187 | + clickableView.getBorderRadius(), |
| 188 | + TypedValue.COMPLEX_UNIT_DIP |
| 189 | + ); |
| 190 | + clickableRemoteView.setBoolean(R.id.rn_widget_clickable_area, "setClipToOutline", true); |
| 191 | + } |
| 192 | + |
182 | 193 | if (clickableView.getAccessibilityLabel() != null) { |
183 | 194 | clickableRemoteView.setContentDescription(R.id.rn_widget_clickable_area, clickableView.getAccessibilityLabel()); |
184 | 195 | } |
@@ -289,6 +300,7 @@ private Intent createCollectionRemoteAdapterIntent(int widgetId, int collectionI |
289 | 300 | collectionViewMap.putInt("width", offsetViewBounds.width()); |
290 | 301 | collectionViewMap.putString("clickAction", clickableView.getClickAction()); |
291 | 302 | collectionViewMap.putBundle("clickActionData", Arguments.toBundle(clickableView.getClickActionData())); |
| 303 | + collectionViewMap.putFloat("borderRadius", clickableView.getBorderRadius()); |
292 | 304 |
|
293 | 305 | // Add clickable area accessibility label if available |
294 | 306 | if (clickableView.getAccessibilityLabel() != null) { |
@@ -356,6 +368,7 @@ private WritableMap createClickableAreaPreview(ViewGroup rootView, ClickableView |
356 | 368 | clickableViewMap.putDouble("height", RNWidgetUtil.pxToDp(appContext, offsetViewBounds.height())); |
357 | 369 | clickableViewMap.putString("clickAction", clickableView.getClickAction()); |
358 | 370 | clickableViewMap.putMap("clickActionData", Arguments.makeNativeMap(clickableView.getClickActionData().toHashMap())); |
| 371 | + clickableViewMap.putDouble("borderRadius", clickableView.getBorderRadius()); |
359 | 372 |
|
360 | 373 | return clickableViewMap; |
361 | 374 | } |
@@ -421,6 +434,7 @@ private WritableArray createCollectionItemClickableAreas(CollectionViewItem coll |
421 | 434 | collectionViewMap.putDouble("height", RNWidgetUtil.pxToDp(appContext, offsetViewBounds.height())); |
422 | 435 | collectionViewMap.putString("clickAction", clickableView.getClickAction()); |
423 | 436 | collectionViewMap.putMap("clickActionData", Arguments.makeNativeMap(clickableView.getClickActionData().toHashMap())); |
| 437 | + collectionViewMap.putDouble("borderRadius", clickableView.getBorderRadius()); |
424 | 438 |
|
425 | 439 | clickableAreas.pushMap(collectionViewMap); |
426 | 440 | } |
|
0 commit comments