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 天内回复