Skip to content

feat(android): draw backdrop-filter natively on SDK 37.2+ - #60208

Open
kagantemizkan wants to merge 2 commits into
react:mainfrom
kagantemizkan:native-backdrop-37-2
Open

kagantemizkan wants to merge 2 commits into
react:mainfrom
kagantemizkan:native-backdrop-37-2

Conversation

@kagantemizkan

@kagantemizkan kagantemizkan commented Nov 21, 2026 •

Copy link
Copy Markdown

Depends on #59141 (Android backdropFilter) and #59138 (JS). This branch is on top of #59141, so its commit shows up here too. The change in this PR is only the last commit: kagantemizkan@cc5d61b

Summary:

Android 17 QPR (SDK 37.2) adds RenderNode.setBackdropRenderEffect / View.setBackdropRenderEffect: the platform applies a RenderEffect to whatever is already drawn behind a node, on the RenderThread. This PR uses it for backdropFilter when available and keeps the bitmap snapshot path from #59141 on older versions.

What the native path changes compared with the snapshot:

  • The backdrop covers everything behind the view, not only the parent's background and earlier siblings. A view over a sibling ScrollView now blurs the list as it scrolls.
  • No bitmap: no parent-sized ARGB_8888 allocation and no per-frame software redraw of siblings.
  • Follows native-driver animations: a ReactViewGroup draws the effect node at the start of its own draw(), so the node is part of the view's display list and inherits its transform, opacity and visibility, which native-driver animations change without re-recording the parent.
  • Border radius without clipping content: the effect is on a separate empty RenderNode clipped to the view's outline, so overflow: visible children are not clipped (putting the effect on the view itself would need clipToOutline on the view).

It also fixes two issues found while testing #59141:

  • ViewShadowNode now treats backdropFilter as forming a view (like filter). Before, a view whose only visual props were backdropFilter and borderRadius was flattened away and nothing was filtered, on both paths.
  • When layout-only ancestors are flattened, a filtered view can end up directly under ReactSurfaceView, where ReactViewGroup.drawChild never runs. On the native path the view draws its own backdrop, so the parent type doesn't matter. Below 37.2 the parent still draws it, as in feat: Add backdrop-filter support for Android #59141.

Notes:

  • The method is resolved by reflection because compileSdk is 37.0, which doesn't have it. It is gated on Build.VERSION.SDK_INT_FULL >= 37.2; on older versions nothing changes. Once compileSdk is 37.2 or later the reflection can be replaced by a direct call.
  • The background drawable's bounds are set before its outline is read. A view sets them while drawing its background, which happens after the backdrop node is drawn, and an empty rounded outline clips everything.

Changelog:

[ANDROID] [ADDED] - Draw backdropFilter with the platform backdrop API on Android 17 QPR (SDK 37.2) and later

Test Plan:

RNTester BackdropFilterExample from #59138 plus extra cases, on an Android 17 QPR emulator (Google APIs 16 KB page size image, ro.build.version.sdk_full=37.2), new architecture.

All filter functions from #59138's examples render on the native path.

Screenshots (SDK 37.2 emulator, native path):

borderRadius: 30 (left: no filter, right: blur(10px))

rounded

blur(2px), blur(4px), blur(8px) with borderRadius: 40

small-blur-rounded

borderRadius + child overflowing with overflow: visible: backdrop clipped, child not

rounded-overflow

opacity: 0.5 / backgroundColor: rgba(255,255,255,0.4) on top

opacity-and-tint

View over a sibling ScrollView, before and after scrolling (snapshot path: no blur here)

scroll-behind

Animated translate + scale with the native driver, 0.7 s apart (snapshot path: stays in place)

native-driver

Not tested: real SDK 37.2 hardware (none available yet), SurfaceView/TextureView content behind the view, RTL.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 21, 2026
On Android 17 QPR (SDK 37.2) RenderNode.setBackdropRenderEffect applies a
RenderEffect to whatever is already drawn behind a node, on the RenderThread.
Use it for backdropFilter when available and keep the bitmap snapshot path
below 37.2.

- No snapshot bitmap: the backdrop includes content outside the parent
  (sibling ScrollViews, ancestors), not only the parent's background and
  earlier siblings.
- A ReactViewGroup draws the effect node in its own draw(), so it follows
  native-driver transform and opacity animations without the parent
  re-recording its display list.
- The node is clipped to the view's outline (border radius) without
  clipToOutline on the view, so overflow: visible content is not clipped.
- A view with only backdropFilter is no longer flattened away.

The method is resolved by reflection because compileSdk is 37.0.
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants