Android: an outset `boxShadow` whose negative spread empties its shape paints a bar outside the view
維護者通常 2 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
The bug is in OutsetBoxShadowDrawable.kt: draw insets the view bounds by the spread (around lines 96-101), then paints with Canvas.drawRect (around 163-166) or Path.addRoundRect (around 142-160) without checking that the shadow rect is still valid. Start by reading where the inset rect is built and find the point where a negative spread makes it inverted. Done means the first two reproducer boxes paint no shadow while the 60x10 control is unchanged. Open PRs #59081 and #59097 already modify this drawable, so coordinate with them before starting.
由索引模型根據 Issue 內容生成。
描述
Description
On Android, an outset boxShadow whose negative spread is more than half the view's height or width paints a bar outside the view, where its shadow shape is empty and Chrome paints nothing. A 100×50 view with boxShadow: '0 40px 0 -30px black' paints a black 40×10 bar 10 dp below itself, with or without a borderRadius.
OutsetBoxShadowDrawable.draw (L96-L101) insets the view's bounds by the spread and offsets them, and draws the result with Canvas.drawRect (L163-L166) or Path.addRoundRect (L142-L160) without checking it is still a rect. Past half the box it is inverted, and Skia sorts an inverted rect in both calls, so each paints the overlap between its edges. Blink skips a shadow whose spread empties its rect.
#59081 and #59097, open, change this drawable and keep the shadow rect as it is.
Steps to reproduce
The reproducer renders three 100×50 boxes on a white screen: one with boxShadow: '0 40px 0 -30px black', one with the same shadow and borderRadius: 8, and a control with boxShadow: '0 40px 0 -20px black', whose shadow shape is 60×10.
- Clone the reproducer and, with one Android 9 or newer device attached, run
./reproduce.sh. It builds and installs the release APK, takes a screenshot and counts the dark pixels in the 30 dp below each box. - Or by hand:
cd ReproducerApp && yarn install && cd android && ./gradlew assembleRelease && adb install -r app/build/outputs/apk/release/app-release.apk, and open the app.
Expected: the first two boxes paint no shadow, since their spread empties its shape, and the control keeps painting its 60×10 shape 10 dp below itself.
Seen: each of the first two boxes paints a black 40×10 bar 10 dp below itself.
React Native Version
0.90.0-nightly-20261113-6d587e873
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: Windows 11 10.0.26300
CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor "
Memory: 160.50 GB / 255.67 GB
Binaries:
Node:
version: 26.12.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.22
path: C:\Users\<user>\AppData\Roaming\npm\yarn.CMD
npm:
version: 12.2.1
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
Versions:
- 10.0.19041.0
- 10.0.26100.0
IDEs:
Android Studio: AI-262.9437.185.2621.16467767
Visual Studio: Not Found
Languages:
Java:
version: 17.0.20.1
path: C:\Program Files\Microsoft\jdk-17.0.20.101-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 21.0.0-alpha.1
wanted: 21.0.0-alpha.1
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.90.0-nightly-20261113-6d587e873
wanted: 0.90.0-nightly-20261113-6d587e873
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
No error is logged. ./reproduce.sh at the reproducer's 74e6e06, on a Galaxy S23:
device: SM-S911B, Android 14 (API 34), arm64-v8a, 1080x2340 at 480 dpi
react-native 0.90.0-nightly-20261113-6d587e873
== ./gradlew :app:assembleRelease -PreactNativeArchitectures=arm64-v8a
screenshot: screenshots/boxes.png
view whose spread empties its shadow shape: 300x150 px at (391, 266); 3600 dark pixels in the 300x90 px below it, where its shadow shape is empty: spanning 120x30 px (40x10 dp), 30 dp from its left edge and 10 dp below it
rounded view whose spread empties its shadow shape: 300x150 px at (390, 697); 3600 dark pixels in the 300x90 px below it, where its shadow shape is empty: spanning 120x30 px (40x10 dp), 30 dp from its left edge and 10 dp below it
view whose spread leaves a shadow shape: 300x150 px at (391, 1128); 5400 dark pixels in the 300x90 px below it, where its shadow paints a 60x10 dp shape: spanning 180x30 px (60x10 dp), 20 dp from its left edge and 10 dp below it
SUMMARY: the view whose spread empties its shadow shape and the rounded view whose spread empties its shadow shape each paint a bar below them, where the spread empties the shadow shape
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/rn-outset-shadow-negative-spread
Screenshots and Videos
The reproducer's screenshot on the Galaxy S23, cropped to the boxes.
- 主要語言
- C++
- 星號
- 127k
- 分支
- 25.5k
- 平均合併
- 3 天 22 小時
- 30 天內合併 PR
- 235
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
react/react-native 的其他 Issue
-
Needs: Author Feedback Needs: Repro
難度 2/5 1-3 小時 新手友好度 82/100
react/react-native#60059 · 1 則留言 ·
維護者通常 2 天內回覆
-
Needs: Triage :mag:
難度 2/5 1-3 小時 新手友好度 70/100
react/react-native#60000 ·
維護者通常 2 天內回覆
-
`yarn test-ios` exits before building RNTester: `objc-test.sh` launches the WebSocket server script #59433 deleted可能已有人在做 @lazerg 於 4 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
react/react-native#59939 ·
維護者通常 2 天內回覆
-
iOS Fabric pointer-handler reset leaves the next lone touch non-primary可能已有人在做 @alleneubank 於 6 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
react/react-native#59919 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
react/react-native#59722 ·
維護者通常 2 天內回覆
查看 react/react-native 的全部 Issue
相似的 Issue
-
crash generated by fuzzer mlir
難度 2/5 1-3 小時 新手友好度 76/100
llvm/llvm-project#243218 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
petercorke/robotics-toolbox-python#943 · 1 則留言 ·
維護者通常 1 天內回覆
-
realtime
難度 2/5 1-3 小時 新手友好度 69/100
NVIDIA/cuda-quantum#5913 ·
維護者通常 1 天內回覆
-
category:port-update
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 2 天內回覆
-
area:build bug
難度 1/5 1 小時以內 新手友好度 90/100
NatronGitHub/openfx-arena#71 ·
維護者通常 1 天內回覆