Repository navigation
Description
Description
A View's outline is drawn below its children on both platforms. CSS paints an element's outline after its in-flow content (CSS 2.1 Appendix E, steps 7 and 10), so with a negative outlineOffset, which draws the outline inside the border box, the ring shows over a child that covers the box. In React Native, a child that covers the View hides the ring.
- Android draws the outline as the last layer of
CompositeBackgroundDrawable, the view's background (L66-L76), whichView.drawpaints beforedispatchDrawdraws the children. - iOS gives the outline layer
zPositionBACKGROUND_COLOR_ZPOSITION + 2, -1022 (L1304, L43), under every subview's layer at 0.
Both came in with the outline itself, #46284 on Android and #46444 on iOS.
Steps to reproduce
The reproducer renders two light blue 100x100 Views with outlineWidth: 8, outlineStyle: 'solid', outlineColor: '#0000ff' and outlineOffset: -16, so a blue ring 8 to 16 points inside each box: the first holds a pink child View of 100x100 that fills it, the second holds nothing.
- Clone the reproducer and, with one Android device attached, run
bash ./reproduce.sh. It builds and installs the release APK, takes a screenshot, and reads the colour 12 dp inside each View's left edge, where the ring is, and at its centre. It exits 1 while the ring shows on the empty View and the pink child shows where the ring is on the other. - Or by hand:
cd ReproducerApp && yarn install && cd android && ./gradlew assembleRelease && adb install -r app/build/outputs/apk/release/app-release.apkand open the app. The second View shows the blue ring; the first shows only its pink child.
Expected: the blue ring over the pink child, as on the empty View. A child that does not reach the ring, and an outline outside the box, draw as now.
Seen: the pink child where the ring is.
React Native Version
0.90.0-nightly-20261128-32260ddbe
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx @react-native-community/cli info
[…]
info Fetching system and libraries information...
System:
OS: Windows 11 10.0.26300
CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor "
Memory: 101.51 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: 22.0.0-alpha.0
wanted: 22.0.0-alpha.0
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.90.0-nightly-20261128-32260ddbe
wanted: 0.90.0-nightly-20261128-32260ddbe
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. bash ./reproduce.sh at the reproducer's 9a33ee3, on a Galaxy S23:
[…]
device: SM-S911B, Android 14 (API 34), arm64-v8a
react-native 0.90.0-nightly-20261128-32260ddbe
== ./gradlew :app:assembleRelease -PreactNativeArchitectures=arm64-v8a
screenshot: screenshot.png
outline over a child: 300x300 px; 12 dp inside its left edge, where the ring is: pink (the child); its centre: pink (the child)
outline, no child: 300x300 px; 12 dp inside its left edge, where the ring is: blue (the outline); its centre: light blue (the background)
SUMMARY: the outline lies under the child that covers the view, so the child hides it; exit 1
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/rn-outline-under-children
Screenshots and Videos
No response
Activity