Skip to content

feat(android): add blur rounds support#104

Merged
sbaiahmed1 merged 2 commits into
mainfrom
feat/add-blur-rounds-android
May 5, 2026
Merged

feat(android): add blur rounds support#104
sbaiahmed1 merged 2 commits into
mainfrom
feat/add-blur-rounds-android

Conversation

@DanielAraldi
Copy link
Copy Markdown
Collaborator

@DanielAraldi DanielAraldi commented May 2, 2026

Requested by @nexquery

Comment link: #100 (comment)

Add support for blur rounds in Android only. This property controls blur interactions during blur draw.

Depends on:

Summary by CodeRabbit

  • New Features

    • Added blurRounds prop to BlurView, ProgressiveBlurView, and BlurSwitch to control Android blur iterations (integer 1–15, default 5).
  • Documentation

    • README and TypeScript examples updated to document blurRounds and include it in examples; README formatting for blurAmount default adjusted (10 → 10.0).

@DanielAraldi DanielAraldi requested a review from sbaiahmed1 May 2, 2026 20:25
@DanielAraldi DanielAraldi self-assigned this May 2, 2026
@DanielAraldi DanielAraldi added documentation Improvements or additions to documentation enhancement New feature or request android Android only labels May 2, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

📝 Walkthrough

Walkthrough

Adds an Android-facing blurRounds prop (integer 1–15, default 5) across JS types, codegen native props, React wiring, and Android native views/managers; updates README examples and BlurSwitch styling.

Changes

blurRounds Prop Addition

Layer / File(s) Summary
Data Shape / Types
src/BlurView.tsx, src/BlurSwitch.tsx, src/ProgressiveBlurView.tsx
Add blurRounds?: number (Android, integer 1–15, default 5) to public prop interfaces and destructure with defaults.
React Component Wiring
src/BlurView.tsx, src/BlurSwitch.tsx, src/ProgressiveBlurView.tsx
Forward blurRounds to native components via props/commonProps; BlurSwitch refactors Android style to use StyleSheet (styles.switch).
Codegen Props
src/ReactNativeBlurViewNativeComponent.ts, src/ReactNativeProgressiveBlurViewNativeComponent.ts, src/ReactNativeBlurSwitchNativeComponent.ts
Add blurRounds?: WithDefault<Int32, 5> to native NativeProps; import Int32.
Android Native State & API
android/.../ReactNativeBlurView.kt, .../ReactNativeProgressiveBlurView.kt, .../ReactNativeBlurSwitch.kt
Introduce DEFAULT_BLUR_ROUNDS = 5, currentBlurRounds, initialize blur from that state, and add setRounds(rounds: Int) that clamps to 1..15, updates state, logs, and forwards to underlying blur with try/catch.
Android Prop Managers
android/.../ReactNativeBlurViewManager.kt, .../ReactNativeProgressiveBlurViewManager.kt, .../ReactNativeBlurSwitchManager.kt
Add @ReactProp(name = "blurRounds") handlers that call view?.setRounds(...).
Documentation & Examples
README.md
Document blurRounds for BlurView, ProgressiveBlurView, and BlurSwitch (1–15, default 5), update TypeScript examples, and display BlurSwitch.blurAmount default as 10.0.
Misc
example/package.json
Trailing EOF/closing-brace formatting adjustment only.

Sequence Diagram(s)

sequenceDiagram
  participant JS as React (JS)
  participant CG as Codegen Native Component
  participant RM as Manager (ReactProp)
  participant AV as Android View
  participant BL as Blur Engine

  JS->>CG: render native component with prop blurRounds
  CG->>RM: codegen forwards prop to manager setter
  RM->>AV: call setRounds(blurRounds)
  AV->>AV: clamp to 1..15, update currentBlurRounds
  AV->>BL: apply blurRounds to native blur implementation
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • sbaiahmed1

Poem

🐇 I count the rounds from one to fifteen,

Five by default, the edges gently seen,
Props hop from JS to Kotlin's gentle hands,
Native blur obeys the rabbit's commands,
Hooray — soft focus across the land.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(android): add blur rounds support' clearly and accurately describes the main feature addition across the changeset—the new blurRounds property implemented for Android blur views and switches.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-blur-rounds-android

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitch.kt`:
- Around line 175-188: The setRounds method currently calls super.setBlurRounds
but does not store the chosen value, so if the parent resets state on reattach
the custom value is lost; add a private backing field (e.g., private var
cachedBlurRounds = 5) in ReactNativeBlurSwitch, update cachedBlurRounds inside
setRounds before calling super.setBlurRounds, and ensure initializeSwitch()
and/or onAttachedToWindow() re-applies cachedBlurRounds by calling
super.setBlurRounds(cachedBlurRounds) so the value survives reattachments.

In `@android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt`:
- Around line 273-286: The setter setRounds currently computes blurRounds but
doesn't persist it, so add a backing field (e.g., currentBlurRounds: Int) to
store the coerced value and update it inside setRounds; then modify
initializeBlur() to re-apply the stored value by calling
super.setBlurRounds(currentBlurRounds) (ensuring you coerceIn(1,15) when
assigning/using it). Also ensure currentBlurRounds has a sensible default that
matches QmBlurView's default so re-attaches preserve expected behavior.

In `@README.md`:
- Line 629: The README props tables are missing the platform qualifier for the
blurRounds prop; update the description for the blurRounds property in the
BlurView, ProgressiveBlurView, and BlurSwitch props tables to append " (Android
only)" so it matches the TSDoc/@platform and the other platform qualifiers
(e.g., blurAmount and ignoreSafeArea), ensuring the blurRounds entries now read
like "The number of blur interactions must be an integer value (1-15) (Android
only)".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fa7c65d8-ede4-4576-91e1-90854f80aab1

📥 Commits

Reviewing files that changed from the base of the PR and between 292fbde and ed8ad86.

📒 Files selected for processing (14)
  • README.md
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitch.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitchManager.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurViewManager.kt
  • example/package.json
  • src/BlurSwitch.tsx
  • src/BlurView.tsx
  • src/ProgressiveBlurView.tsx
  • src/ReactNativeBlurSwitchNativeComponent.ts
  • src/ReactNativeBlurViewNativeComponent.ts
  • src/ReactNativeProgressiveBlurViewNativeComponent.ts

Comment thread README.md
@DanielAraldi DanielAraldi marked this pull request as draft May 2, 2026 20:38
@DanielAraldi DanielAraldi marked this pull request as ready for review May 2, 2026 20:58
Copy link
Copy Markdown
Owner

@sbaiahmed1 sbaiahmed1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sbaiahmed1
Copy link
Copy Markdown
Owner

Hey @DanielAraldi, small conflict after i merged the dark mode one

@DanielAraldi
Copy link
Copy Markdown
Collaborator Author

Hey @DanielAraldi, small conflict after i merged the dark mode one

Fixed 😅

@sbaiahmed1
Copy link
Copy Markdown
Owner

Sorry for being picky, can you do a rebase not a merge :( we always merge with a rebase and it wont be possible if you do merge

@DanielAraldi
Copy link
Copy Markdown
Collaborator Author

No problem my friend! 🫡

@sbaiahmed1
Copy link
Copy Markdown
Owner

No problem my friend! 🫡

You are the 🐐

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt (1)

94-99: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Re-apply currentBlurRounds during initialization.

setupView() seeds the value, but initializeBlur() still rehydrates only radius, overlay, and corner radius. If QmBlurView resets rounds on attach, this prop will be lost again after a detach/reattach cycle. Please verify that behavior against QmBlurView 1.1.4 and, if needed, restore the cached rounds here as well.

🔧 Suggested fix
   private fun initializeBlur() {
     if (isBlurInitialized) return

     try {
       super.setBlurRadius(currentBlurRadius)
       super.setOverlayColor(currentOverlayColor)
+      super.setBlurRounds(currentBlurRounds)
       updateCornerRadius()
       isBlurInitialized = true

Also applies to: 244-251

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt`
around lines 94 - 99, The setupView() currently seeds blurRounds with
currentBlurRounds but initializeBlur() only rehydrates radius, overlay and
cornerRadius, so blurRounds can be reset on attach/reattach by QmBlurView;
update initializeBlur() (or the attach path where QmBlurView resets state) to
explicitly restore blurRounds = currentBlurRounds (or call setupView()’s rounds
logic) and ensure you reference the currentBlurRounds field when reapplying
props so the cached rounds persist across detach/reattach cycles (verify
behavior against QmBlurView 1.1.4 and mirror its rehydration order).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt`:
- Around line 94-99: The setupView() currently seeds blurRounds with
currentBlurRounds but initializeBlur() only rehydrates radius, overlay and
cornerRadius, so blurRounds can be reset on attach/reattach by QmBlurView;
update initializeBlur() (or the attach path where QmBlurView resets state) to
explicitly restore blurRounds = currentBlurRounds (or call setupView()’s rounds
logic) and ensure you reference the currentBlurRounds field when reapplying
props so the cached rounds persist across detach/reattach cycles (verify
behavior against QmBlurView 1.1.4 and mirror its rehydration order).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d3b8a1c4-c8f8-42ff-bd01-0bcd79af4116

📥 Commits

Reviewing files that changed from the base of the PR and between ed8ad86 and c2ba382.

📒 Files selected for processing (6)
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitch.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt
  • src/BlurView.tsx
  • src/ProgressiveBlurView.tsx
  • src/ReactNativeBlurSwitchNativeComponent.ts
✅ Files skipped from review due to trivial changes (1)
  • src/ReactNativeBlurSwitchNativeComponent.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitch.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt

@DanielAraldi
Copy link
Copy Markdown
Collaborator Author

Hey @sbaiahmed1, will I have to revert the merge? Do a revert? Or just do a git fetch on the origin and then a rebase? I'm a little confused haha 🤣

@sbaiahmed1
Copy link
Copy Markdown
Owner

Hahaha @DanielAraldi dont worry
I will handle it tonight

@sbaiahmed1 sbaiahmed1 force-pushed the feat/add-blur-rounds-android branch from c2ba382 to 756e924 Compare May 5, 2026 09:54
@sbaiahmed1 sbaiahmed1 force-pushed the feat/add-blur-rounds-android branch from 756e924 to 91af23e Compare May 5, 2026 09:56
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt (1)

244-257: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

initializeBlur() still does not re-apply currentBlurRounds on reattach

The backing field currentBlurRounds and the correct update in setRounds() (lines 299-301) address part of the previous review, but initializeBlur() — the only recovery point after a detach→reattach cycle — still does not call super.setBlurRounds(currentBlurRounds). Because cleanup() resets isBlurInitialized = false, every navigation detach/reattach will run initializeBlur() again and leave blurRounds at whatever QmBlurView's internal default is, silently discarding the configured prop value. setupView() only runs in the constructor and does not help here.

🛡️ Proposed fix
   private fun initializeBlur() {
     if (isBlurInitialized) return

     try {
       super.setBlurRadius(currentBlurRadius)
       super.setOverlayColor(currentOverlayColor)
       updateCornerRadius()
+      super.setBlurRounds(currentBlurRounds)
       isBlurInitialized = true

       logDebug("QmBlurView initialized with blurRadius: $currentBlurRadius, overlayColor: $currentOverlayColor")
     } catch (e: Exception) {
       logError("Failed to initialize blur view: ${e.message}", e)
     }
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt`
around lines 244 - 257, initializeBlur() doesn't re-apply the backing field
currentBlurRounds after a detach→reattach, so blurRounds falls back to the
QmBlurView default; modify initializeBlur() to call
super.setBlurRounds(currentBlurRounds) (similar to setRounds()) before marking
isBlurInitialized = true so the stored rounds value is restored after
cleanup()/reattach.
🧹 Nitpick comments (1)
android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitchManager.kt (1)

43-46: ⚡ Quick win

Add defaultInt = 5 to @ReactProp to align with the documented default.

When a prop that was previously set is subsequently removed (old architecture / Paper), React Native calls the setter with the @ReactProp default. Without defaultInt, the implicit default is 0, so setRounds(0) is called instead of setRounds(5). The native clamp would floor this to 1 rather than the intended 5. Compare blurAmount's @ReactProp(name = "blurAmount", defaultDouble = 10.0) pattern on Line 38.

🛠️ Proposed fix
-  `@ReactProp`(name = "blurRounds")
+  `@ReactProp`(name = "blurRounds", defaultInt = 5)
   fun setBlurRounds(view: ReactNativeBlurSwitch?, blurRounds: Int) {
     view?.setRounds(blurRounds)
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitchManager.kt`
around lines 43 - 46, The `@ReactProp` annotation on setBlurRounds currently has
no default so removed props become 0; update the annotation on the setBlurRounds
method to include defaultInt = 5 (matching the documented default and the
pattern used for blurAmount) so that when React passes the default the
view?.setRounds(blurRounds) call receives 5 instead of 0; locate ReactProp,
setBlurRounds, and the setRounds call to make this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt`:
- Around line 244-257: initializeBlur() doesn't re-apply the backing field
currentBlurRounds after a detach→reattach, so blurRounds falls back to the
QmBlurView default; modify initializeBlur() to call
super.setBlurRounds(currentBlurRounds) (similar to setRounds()) before marking
isBlurInitialized = true so the stored rounds value is restored after
cleanup()/reattach.

---

Nitpick comments:
In
`@android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitchManager.kt`:
- Around line 43-46: The `@ReactProp` annotation on setBlurRounds currently has no
default so removed props become 0; update the annotation on the setBlurRounds
method to include defaultInt = 5 (matching the documented default and the
pattern used for blurAmount) so that when React passes the default the
view?.setRounds(blurRounds) call receives 5 instead of 0; locate ReactProp,
setBlurRounds, and the setRounds call to make this change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fcdc85fd-49d1-4158-88f3-e85115d0dd10

📥 Commits

Reviewing files that changed from the base of the PR and between c2ba382 and 91af23e.

📒 Files selected for processing (14)
  • README.md
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitch.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitchManager.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurViewManager.kt
  • example/package.json
  • src/BlurSwitch.tsx
  • src/BlurView.tsx
  • src/ProgressiveBlurView.tsx
  • src/ReactNativeBlurSwitchNativeComponent.ts
  • src/ReactNativeBlurViewNativeComponent.ts
  • src/ReactNativeProgressiveBlurViewNativeComponent.ts
✅ Files skipped from review due to trivial changes (3)
  • example/package.json
  • src/BlurView.tsx
  • README.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/ReactNativeBlurViewNativeComponent.ts
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurSwitch.kt
  • src/ReactNativeBlurSwitchNativeComponent.ts
  • android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurViewManager.kt

@sbaiahmed1 sbaiahmed1 merged commit 9a07af2 into main May 5, 2026
6 checks passed
@sbaiahmed1 sbaiahmed1 deleted the feat/add-blur-rounds-android branch May 5, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

android Android only documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants