Skip to content

feat: update Android blur implementation to use QmBlurView library and improve performance#36

Merged
sbaiahmed1 merged 9 commits into
mainfrom
feat/implement-qmblur
Nov 4, 2025
Merged

feat: update Android blur implementation to use QmBlurView library and improve performance#36
sbaiahmed1 merged 9 commits into
mainfrom
feat/implement-qmblur

Conversation

@sbaiahmed1

@sbaiahmed1 sbaiahmed1 commented Nov 2, 2025

Copy link
Copy Markdown
Owner

Changed library to keep the same usages and methods (avoid blurTarget)

Summary by Sourcery

Migrate Android blur to QmBlurView to improve performance and simplify setup, update build configurations and documentation.

New Features:

  • Integrate QmBlurView for Android to provide high-performance native blur effects.

Enhancements:

  • Replace legacy RenderScript/RenderEffect setup with direct QmBlurView API calls for blur radius, overlay color, and corner radius.
  • Simplify ReactNativeBlurView by removing manual root view scanning, deferred setup, and fallback logic.
  • Switch ReactNativeBlurViewManager from ViewGroupManager to SimpleViewManager.

Build:

  • Bump Android compileSdkVersion, targetSdkVersion, and buildToolsVersion to 36.
  • Upgrade Android Gradle Plugin to 8.9.1 and replace com.github.Dimezis:BlurView with com.github.QmDeve:QmBlurView dependency.

Documentation:

  • Update README to reference QmBlurView in blur quality table, installation examples, and dependency instructions.

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

@DanielAraldi Hey Daniel can you test this? so much better and same API so no need for BlurTarget and hacks

@sourcery-ai

sourcery-ai Bot commented Nov 2, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Migrates Android blur implementation from the Dimezis BlurView to QmBlurView, streamlines initialization and setter logic by removing legacy setup/teardown code, updates dependencies, build scripts, and documentation, and switches the view manager to SimpleViewManager.

Class diagram for updated ReactNativeBlurView (Android)

classDiagram
  class ReactNativeBlurView {
    - currentBlurRadius: Float
    - currentOverlayColor: Int
    - currentCornerRadius: Float
    - originalBackgroundColor: Int?
    - hasExplicitBackground: Boolean
    - glassTintColor: Int
    + setBlurAmount(amount: Float)
    + setBlurType(type: String)
    + setReducedTransparencyFallbackColor(color: String?)
    + setGlassTintColor(color: String?)
    + setIsInteractive(isInteractive: Boolean)
    + cleanup()
    - initializeBlur()
    - updateGlassEffect()
    - updateViewType()
    - mapBlurAmountToRadius(amount: Float): Float
    - logDebug(message: String)
    - logError(message: String, e: Exception)
    - setBackgroundColor(color: Int)
    - onDetachedFromWindow()
  }
  class BlurView
  ReactNativeBlurView --|> BlurView
  BlurView <.. QmBlurViewLibrary

  class QmBlurViewLibrary
  QmBlurViewLibrary : <<library>>
Loading

Class diagram for updated ReactNativeBlurViewManager (Android)

classDiagram
  class ReactNativeBlurViewManager {
    - mDelegate: ViewManagerDelegate<ReactNativeBlurView>
    + getName(): String
    + createViewInstance(context: ThemedReactContext): ReactNativeBlurView
    + setBlurAmount(view: ReactNativeBlurView, amount: Float)
    + setBlurType(view: ReactNativeBlurView, type: String)
    + setReducedTransparencyFallbackColor(view: ReactNativeBlurView, color: String?)
    + setGlassTintColor(view: ReactNativeBlurView, color: String?)
    + setIsInteractive(view: ReactNativeBlurView, isInteractive: Boolean)
  }
  class SimpleViewManager
  ReactNativeBlurViewManager --|> SimpleViewManager
  ReactNativeBlurViewManager ..> ReactNativeBlurView
Loading

File-Level Changes

Change Details Files
Swapped BlurView library to QmBlurView and updated dependencies/docs
  • Replaced Dimezis BlurView imports with QmBlurView
  • Updated Gradle dependency strings in android and example builds
  • Revised README.md to reference QmBlurView and usage
ReactNativeBlurView.kt
android/build.gradle
example/android/build.gradle
README.md
Revamped initialization to use QmBlurView's API
  • Merged constructors and removed obsolete overloads
  • initializeBlur now directly calls super.setBlurRadius/OverlayColor/CornerRadius
  • Wrapped setup calls in try/catch with logging
ReactNativeBlurView.kt
Removed legacy blur setup and teardown routines
  • Deleted setupBlurView, findOptimalBlurRoot, and findRootView methods
  • Removed isSetup, isConfigured, and pendingStyleUpdate flags
  • Simplified onDetachedFromWindow to call cleanup only
ReactNativeBlurView.kt
Simplified setter methods and property management
  • Renamed blurRadius/overlayColor to currentBlurRadius/currentOverlayColor
  • setBlurAmount and setBlurType call super methods directly
  • Replaced Color.parseColor with toColorInt for color parsing
ReactNativeBlurView.kt
Bumped Android SDK and Gradle plugin versions
  • Increased buildToolsVersion, compileSdkVersion, targetSdkVersion to 36
  • Updated Android Gradle plugin to 8.9.1 in project and example
android/build.gradle
example/android/build.gradle
Changed view manager base class to SimpleViewManager
  • Switched from ViewGroupManager to SimpleViewManager
  • Adjusted import and class signature accordingly
ReactNativeBlurViewManager.kt

Possibly linked issues

  • feat(android): add Android version compatibility for blur effects #3.1.1: The PR resolves the Android build failure by migrating the blur implementation from Dimezis BlurView to QmBlurView library, fixing unresolved reference errors.
  • #[Issue ID]: The PR replaces the eightbitlab/BlurView library, resolving the NoClassDefFoundError for RenderEffectBlur that caused the Android crash.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt:133` </location>
<code_context>
     originalBackgroundColor = null
-    pendingStyleUpdate = false
-    // Clear any pending runnables to prevent memory leaks
     removeCallbacks(null)
-    logDebug("View detached, reset state")
-  }
</code_context>

<issue_to_address>
**issue (bug_risk):** removeCallbacks(null) may not clear all pending runnables as intended.

According to Android documentation, removeCallbacks(null) only removes callbacks with a null Runnable. To clear all pending runnables, you should track and remove them individually.
</issue_to_address>

### Comment 2
<location> `android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt:142` </location>
<code_context>
   fun setBlurAmount(amount: Float) {
-    blurRadius = mapBlurAmountToRadius(amount)
-    logDebug("setBlurAmount: $amount -> $blurRadius (mapped from 0-100 to 0-25 range, isSetup: $isSetup)")
+    currentBlurRadius = mapBlurAmountToRadius(amount)
+    logDebug("setBlurAmount: $amount -> $currentBlurRadius (mapped from 0-100 to 0-25 range)")

</code_context>

<issue_to_address>
**suggestion (bug_risk):** No validation for blur amount input range.

Please add input validation to ensure the blur amount is within 0-100 to avoid unexpected behavior.

Suggested implementation:

```
  /**
   * @param amount The blur amount value (0-100), will be mapped to Android's 0-25 radius range
   */
  fun setBlurAmount(amount: Float) {
    var validatedAmount = amount
    if (amount < 0f || amount > 100f) {
      logDebug("Warning: blur amount $amount is out of range (0-100). Clamping to valid range.")
      validatedAmount = amount.coerceIn(0f, 100f)
    }

```

```
    currentBlurRadius = mapBlurAmountToRadius(validatedAmount)
    logDebug("setBlurAmount: $validatedAmount -> $currentBlurRadius (mapped from 0-100 to 0-25 range)")

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Hello @sbaiahmed1, I gave a star to the library this Thursday. I'll go test your implementation as soon as possible!

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Hello @sbaiahmed1, I gave a star to the library this Thursday. I'll go test your implementation as soon as possible!

OMGGGGGG this is called fucking blur
Screenshot 2025-11-02 at 17 17 56

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Hello @sbaiahmed1, I gave a star to the library this Thursday. I'll go test your implementation as soon as possible!

OMGGGGGG this is called fucking blur Screenshot 2025-11-02 at 17 17 56

NICE, wonderful, do you testing the new implementation in SDK <= 31?

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Hello @sbaiahmed1, I gave a star to the library this Thursday. I'll go test your implementation as soon as possible!

OMGGGGGG this is called fucking blur Screenshot 2025-11-02 at 17 17 56

NICE, wonderful, do you testing the new implementation in SDK <= 31?

I couldnt test on android SDK 31, simulator wont launch
I tested on android 29 SDK and it is perfect
Screenshot 2025-11-02 at 18 14 50

@DanielAraldi

Copy link
Copy Markdown
Collaborator

OMG, very beautiful, I'll test for you

- Added AppNavigator for managing navigation between Home, Examples, and Settings screens.
- Created BlurTabBar for custom tab navigation with blur effects.
- Developed ExamplesScreen to showcase different blur types and intensities.
- Implemented HomeScreen with blur cards demonstrating features of the blur library.
- Created SettingsScreen to provide information about the library and its features.
- Updated package.json to include necessary dependencies for navigation.
@DanielAraldi DanielAraldi added documentation Improvements or additions to documentation enhancement New feature or request android Android only labels Nov 2, 2025
@DanielAraldi

Copy link
Copy Markdown
Collaborator

Hey @sbaiahmed1, I'm looking forward to testing this implementation, I was planning to change to it in the future. This library has ProgressiveBlur, soon we can add it, I'm excited about this!

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Thank you @DanielAraldi, I'm waiting for your test then I will merge this one :D I will also close the MR for BlurTarget (phew)
Also im implementing them on separate MRs (progressive blur for android and iOS etc )

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Thank you @DanielAraldi, I'm waiting for your test then I will merge this one :D I will also close the MR for BlurTarget (phew) Also im implementing them on separate MRs (progressive blur for android and iOS etc )

That's great! I'll test your PR later today, around 8 PM here in Brazil. I'll be following these ProgressiveBlur MRs. So far I haven't seen any library that implements it natively. This library would be the first and would greatly help the community 🤝🎉

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Hey @sbaiahmed1, I am starting the tests here!

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Hey @sbaiahmed1, I am starting the tests here!

Perfect!! Quick as usual 🙏

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Hey @sbaiahmed1, I noticed a small issue with the first render of the BlurView when changing tabs. Current tab in first rendering makes white:

I tested in the SDK 31, Android 12, Pixel 6. In SDK 36, Android LTS, Pixel 9 the same problem.

white
video_3IJKzjD4.mp4

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Hey @sbaiahmed1, Just so you know, I've added some settings to make our development easier in Xcode and Android Studio, if necessary.

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Good morning @DanielAraldi , the thing is for android i dont recommend putting these manually, I want it to inherit directly the project config if possible. Do you agree ? it would make it less painful for us

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

as for the SDK 31, I think the package QM has an apk in their repo so we can test

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

take a look at this
I have tested on these simulators and it works perfectly
Screenshot 2025-11-03 at 10 52 09
Screenshot 2025-11-03 at 10 51 05

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Good morning @DanielAraldi , the thing is for android i dont recommend putting these manually, I want it to inherit directly the project config if possible. Do you agree ? it would make it less painful for us

Hello @sbaiahmed1, my bad brother, I'll go to revert these changes

@DanielAraldi

Copy link
Copy Markdown
Collaborator

as for the SDK 31, I think the package QM has an apk in their repo so we can test

Good idea!

@DanielAraldi

Copy link
Copy Markdown
Collaborator

take a look at this I have tested on these simulators and it works perfectly Screenshot 2025-11-03 at 10 52 09 Screenshot 2025-11-03 at 10 51 05

Interesting, I'm thinking, could it be my computer? Maybe it's just too slow, LOL. We test with the APK of the QM, which will help us.

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

@DanielAraldi The phones in picture are sdk 35 35 and 31 so i dont know really what to do 🥹

@DanielAraldi

Copy link
Copy Markdown
Collaborator

The phones in picture are sdk 35 35 and 31 so i dont know really what to do 🥹

I'll test the Qm APK on my physical device as soon as possible, and also on my other machine. I want to see if the behavior will be the same.

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Keep me updated if all is good for you
I will merge and discard the Dimezis

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Keep me updated if all is good for you I will merge and discard the Dimezis

Hey @sbaiahmed1, I tested the Qm APK on my device and didn't have the same problem as with the emulators, I'm a little confused. Maybe the problem I described occurred because of my machine itself, that's the only thing I can think of right now, haha 😂

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Hahahahaha I will merge the branch then and let the community test it ?

@DanielAraldi

Copy link
Copy Markdown
Collaborator

Hahahahaha I will merge the branch then and let the community test it ?

Yep, let's go!

@DanielAraldi DanielAraldi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@sbaiahmed1 sbaiahmed1 merged commit 9b0dba1 into main Nov 4, 2025
5 of 6 checks passed
@sbaiahmed1 sbaiahmed1 deleted the feat/implement-qmblur branch November 4, 2025 00:19
@QmDeve

QmDeve commented Nov 5, 2025

Copy link
Copy Markdown

Good👍

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Good👍

Thank you for the amazing library 🙏 really appreciate it man

@QmDeve

QmDeve commented Nov 5, 2025

Copy link
Copy Markdown

Good👍

Thank you for the amazing library 🙏 really appreciate it man

Hey friend, I have migrated from jitpack to Maven Central

implementation 'com.qmdeve:QmBlurView:1.0.4.3'

💗

@sbaiahmed1

Copy link
Copy Markdown
Owner Author

Will update it
Then release asap !! Thanks

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.

3 participants