Skip to content

Conversation

@sbaiahmed1
Copy link
Owner

@sbaiahmed1 sbaiahmed1 commented Oct 19, 2025

Thanks to https://github.com/DanielAraldi @DanielAraldi

- Implemented a new TargetView component for Android to enable real-time blur effects.
- Updated BlurView to support targetId prop for specifying the target view to blur.
- Added styles and UI elements for toggling between standard and real blur modes.
- Refactored existing components to improve structure and readability.
- Updated TypeScript definitions to include new props and components.
@sbaiahmed1 sbaiahmed1 self-assigned this Oct 19, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 19, 2025

Reviewer's Guide

This pull request adopts Dimezis BlurView v3’s target-based blur architecture on Android by introducing a new TargetView component and extending the existing BlurView API with a targetId prop. The native Android code is refactored to remove the overlay-only approach, implement tag-based view discovery, and simplify initialization/cleanup. TypeScript definitions and exports are updated accordingly, and the example app and README are overhauled to demonstrate and document the migration path.

Sequence diagram for real blur effect with TargetView and BlurView on Android

sequenceDiagram
  participant App
  participant TargetView
  participant BlurView
  participant AndroidNative
  App->>TargetView: Render with id="background"
  App->>BlurView: Render with targetId="background"
  BlurView->>AndroidNative: Find TargetView by targetId
  AndroidNative->>TargetView: Locate and tag as blur target
  AndroidNative->>BlurView: Apply real blur to TargetView content
Loading

Entity relationship diagram for TargetView and BlurView linkage

erDiagram
  TARGET_VIEW {
    id string PK
  }
  BLUR_VIEW {
    targetId string FK
  }
  BLUR_VIEW ||--|{ TARGET_VIEW : "targets"
Loading

Class diagram for new TargetView and updated BlurView components

classDiagram
  class BlurView {
    +blurType: BlurType
    +blurAmount: number
    +targetId: string
    +glassType: GlassType
    +glassTintColor: string
    +glassOpacity: number
    +isInteractive: boolean
    +ignoreSafeArea: boolean
    +children: ReactNode
  }
  class BlurTargetView {
    +id: string
    +style: StyleProp<ViewStyle>
    +children: ReactNode
  }
  class TargetViewNativeComponent {
    +id: string
  }
  BlurView --> "targetId" BlurTargetView : targets
  BlurTargetView --> TargetViewNativeComponent : native implementation
Loading

File-Level Changes

Change Details Files
Refactor Android BlurView to Dimezis BlurView v3 with target-based blur
  • Replace overlay-based fallback with real blur when targetId is set
  • Implement new OverlayColor enum and initialization logic
  • Add setTargetId prop and findRootTargetView for tag-based lookup
  • Simplify setupBlurView, initialize, and cleanup methods
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/ReactNativeBlurPackage.kt
android/build.gradle
Implement TargetView native component for blur targets on Android
  • Create TargetView.kt extending BlurTarget with id support
  • Add TargetViewManager with @ReactProp for id
  • Expose codegen native component and React wrapper BlurTargetView
  • Export alias TargetView in index.tsx
android/src/main/java/com/sbaiahmed1/reactnativeblur/TargetView.kt
android/src/main/java/com/sbaiahmed1/reactnativeblur/TargetViewManager.kt
src/TargetViewNativeComponent.ts
src/BlurTargetView.tsx
src/index.tsx
Extend BlurView API to support targetId and adjust exports
  • Add optional targetId prop to BlurViewProps and pass to native
  • Update codegen signature in ReactNativeBlurViewNativeComponent
  • Simplify BlurView wrapper styling and remove legacy rendering branch
src/BlurView.tsx
src/ReactNativeBlurViewNativeComponent.ts
src/index.tsx
Overhaul example code to demonstrate real vs standard blur using TargetView
  • Wrap background content in TargetView and reference via targetId
  • Introduce UI controls for blur type, radius, and mode toggles
  • Refactor App.tsx with new state, tabs, modal, and header
  • Update ComparisonExamples, MainExample, PracticalExamples, LiquidGlassExample to use targetId
example/src/App.tsx
example/src/components/ComparaisonExample.tsx
example/src/components/MainExample.tsx
example/src/components/PracticalExamples.tsx
example/src/components/LiquidGlassExample.tsx
Document breaking changes and bump BlurView dependency
  • Add Breaking Changes and migration guide to README.md
  • Bump Dimezis BlurView version to 3.1.0 in android/build.gradle
  • Update package.json version and note new exports
README.md
android/build.gradle
package.json

Possibly linked issues

  • #BlurView doesn't work with VideoView/animated backgrounds - Feature Request for video blur support: The PR introduces a TargetView component and targetId prop to BlurView on Android, enabling real-time, hardware-accelerated blur effects by targeting specific views, directly addressing the issue's request for actual video blur support.
  • #Android crash: Failed resolution of: Leightbitlab/com/blurview/RenderEffectBlur: The PR refactors Android BlurView to use a TargetView component, resolving the NoClassDefFoundError crash related to RenderEffectBlur by changing the blur implementation.

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

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

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 - here's some feedback:

  • The PR is very large and touches both UI examples and native Android code—consider splitting it into smaller, focused PRs (e.g. native blur changes vs example updates) to simplify review and testing.
  • The version in package.json was downgraded to 3.1.2 despite introducing a breaking change—please bump it properly to the next major/minor version to reflect the new release.
  • You removed the branch in BlurView that handled rendering without children; this may break use cases where BlurView is used standalone (no children), so either restore that path or verify those scenarios still work.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The PR is very large and touches both UI examples and native Android code—consider splitting it into smaller, focused PRs (e.g. native blur changes vs example updates) to simplify review and testing.
- The version in package.json was downgraded to 3.1.2 despite introducing a breaking change—please bump it properly to the next major/minor version to reflect the new release.
- You removed the branch in BlurView that handled rendering without children; this may break use cases where BlurView is used standalone (no children), so either restore that path or verify those scenarios still work.

## Individual Comments

### Comment 1
<location> `android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt:113-116` </location>
<code_context>
-    removeCallbacks(null)
-    logDebug("View detached, reset state")
+  private fun setupBlurView() {
+    super.setBackgroundColor(this.overlayColor.color)
+    super.clipChildren = true
+    super.clipToOutline = true
+    super.layoutParams = LayoutParams(
+      LayoutParams.MATCH_PARENT,
+      LayoutParams.MATCH_PARENT
</code_context>

<issue_to_address>
**question:** Setting layoutParams in setupBlurView may override parent constraints.

Using MATCH_PARENT for layoutParams here may unintentionally override parent or React Native constraints, potentially causing layout issues. Please verify if this is necessary for all cases.
</issue_to_address>

### Comment 2
<location> `src/BlurView.tsx:130-124` </location>
<code_context>
   return (
-    <View style={[{ position: 'relative', overflow: 'hidden' }, style]}>
-      {/* Blur effect positioned absolutely behind content */}
+    <View style={[style, { overflow: 'hidden' }]}>
       <ReactNativeBlurView
         blurType={blurType}
         blurAmount={blurAmount}
</code_context>

<issue_to_address>
**suggestion:** Absolute positioning of BlurView may not work as expected if parent style does not specify position.

Consider requiring or documenting that the parent View must have a position style (e.g., 'relative') to ensure BlurView overlays correctly.
</issue_to_address>

### Comment 3
<location> `example/src/components/ComparaisonExample.tsx:70` </location>
<code_context>
+      {useRealBlur ? (
+        <View style={styles.realBlurContainer}>
           <BlurView
+            targetId="app-background"
             blurType={currentCard.type as BlurType}
             blurAmount={selectedIntensity}
</code_context>

<issue_to_address>
**issue (bug_risk):** TargetId 'app-background' must match a TargetView id in the app.

If 'app-background' does not match an existing TargetView id, the blur effect will fail.
</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.

@sbaiahmed1
Copy link
Owner Author

@DanielAraldi you can take a look

@sbaiahmed1 sbaiahmed1 linked an issue Oct 19, 2025 that may be closed by this pull request
Copy link
Collaborator

@DanielAraldi DanielAraldi left a comment

Choose a reason for hiding this comment

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

LGTM!

Very happy with this feature!!! 🎉👏

@DanielAraldi
Copy link
Collaborator

DanielAraldi commented Oct 20, 2025

Wait @sbaiahmed1, do you test your example app with @react-navigation/bottom-tabs? It works correctly? Your bottom tabs don't freeze in transactions between screens?

@sbaiahmed1
Copy link
Owner Author

I didn't test it yet
I will test it tonight then merge if it works

@DanielAraldi
Copy link
Collaborator

I didn't test it yet I will test it tonight then merge if it works

Ok 👍

@sbaiahmed1
Copy link
Owner Author

So @DanielAraldi it is not working unfortunately
The issue is with how blur target works
The tab content is going to change everytime we switch tabs
So the tabbar wont understand it because the target has changed ...

I think of ditching the library seriously right now

@DanielAraldi
Copy link
Collaborator

So @DanielAraldi it is not working unfortunately The issue is with how blur target works The tab content is going to change everytime we switch tabs So the tabbar wont understand it because the target has changed ...

I think of ditching the library seriously right now

Exactly, this problem is haunting me a lot, unfortunately we will have to go this way.

@sbaiahmed1
Copy link
Owner Author

Let me give you a solution
I will push another branch and tag you in it
With normal pure blur ( i have a hack for the variants)
You test it and you try it with tabs if it works we ditch the library and go with android blur ( fallback to semi transparent on android 11 and less)

@DanielAraldi
Copy link
Collaborator

Let me give you a solution I will push another branch and tag you in it With normal pure blur ( i have a hack for the variants) You test it and you try it with tabs if it works we ditch the library and go with android blur ( fallback to semi transparent on android 11 and less)

All right, tomorrow night I can test, ok?

@sbaiahmed1
Copy link
Owner Author

Take your time homie! I wont be able to push it today im kinda sick a little

@DanielAraldi
Copy link
Collaborator

Take your time homie! I wont be able to push it today im kinda sick a little

Great, I'll get back to you as soon as possible, hope your flu gets better!

- Created NAVIGATION.md to outline app features and navigation structure.
- Implemented RootNavigator for managing navigation between screens.
- Defined RootStackParamList for type safety in navigation.
- Developed HomeScreen with background image cycling and navigation options.
- Added BlurDemoScreen for interactive blur type and intensity controls.
- Created LiquidGlassScreen showcasing iOS-specific liquid glass effects.
- Implemented CardsScreen to demonstrate various blurred card designs.
- Developed GalleryScreen featuring an image gallery with blurred overlays.
- Updated index.ts to export all screens for easier imports.
@DanielAraldi
Copy link
Collaborator

Hey @sbaiahmed1, this Blur library is interesting:

@sbaiahmed1
Copy link
Owner Author

Hey @sbaiahmed1, this Blur library is interesting:

It is only jetpack compose :(

@DanielAraldi
Copy link
Collaborator

Hey @sbaiahmed1, this Blur library is interesting:

It is only jetpack compose :(

Oh my bad 😅

@sbaiahmed1
Copy link
Owner Author

Hey @sbaiahmed1, this Blur library is interesting:

It is only jetpack compose :(

Oh my bad 😅

I did try blurring from android but it has performance issues ...

@DanielAraldi
Copy link
Collaborator

Hey @sbaiahmed1, this Blur library is interesting:

It is only jetpack compose :(

Oh my bad 😅

I did try blurring from android but it has performance issues ...

I am thinking make a fork of the Dimezis repo and trying another alternatives implementation

@sbaiahmed1
Copy link
Owner Author

Hmm that is a good idea
As for Me I think I'm going to do some research and some performance optimisation
Worst case scenario I'm gonna export two components from my blur view one that should be used for the tabbars et cetera
And the other would be used normally around the app

@DanielAraldi
Copy link
Collaborator

Hmm that is a good idea As for Me I think I'm going to do some research and some performance optimisation Worst case scenario I'm gonna export two components from my blur view one that should be used for the tabbars et cetera And the other would be used normally around the app

That's an excellent idea, if it works, please let me know!

@DanielAraldi
Copy link
Collaborator

Good news @sbaiahmed1! Transactions with bottom tabs work for me! 🤩🚀🥳

happy_cfVX6YJg.mp4

@sbaiahmed1
Copy link
Owner Author

@DanielAraldi , Good Job!!!
Im curious, how was that possible with the v3 ?

@DanielAraldi
Copy link
Collaborator

I did a little workaround to get this to work. Basically, I force the targetId value to change based on the page's index value. See what I did in my branch:

@sbaiahmed1
Copy link
Owner Author

Hey @sbaiahmed1, bad news. I am testing BlurView in Pixel 6 (Android 12 - API 31) and it don't works:

sad.mov
This appears to be a problem with the Dimezis library. I think it would be good to open an issue there...

Is it not working on tabbar or at all ? @DanielAraldi

@DanielAraldi
Copy link
Collaborator

All :(

@sbaiahmed1
Copy link
Owner Author

All :(

Screenshot 2025-10-22 at 22 22 26 I mean your device

can you clone this branch and test on the same device ?

@DanielAraldi
Copy link
Collaborator

I am testing in Pixel 6 (Android 12 on API 31), try on Pixel 6 with this configuration

@DanielAraldi
Copy link
Collaborator

I am testing now in Pixel 4XL (Android 29) and it works, but in Pixel 6 it isn’t working

@sbaiahmed1
Copy link
Owner Author

@DanielAraldi it kinda works i think

Screenshot 2025-10-22 at 22 29 09

@DanielAraldi
Copy link
Collaborator

@sbaiahmed1

This behavior is strange, I suspect that it is actually a problem in the Dimezis library and not in our implementation.

@sbaiahmed1
Copy link
Owner Author

@DanielAraldi I mean it is working not as vibrant but it is android ...

@DanielAraldi
Copy link
Collaborator

I mean it is working not as vibrant but it is android ...

Oh, sorry, you're right, but how different is this behavior compared to API 29 and 36

@sbaiahmed1
Copy link
Owner Author

I think it is with the rendering engine or maybe method (internally)

I think i will release as is right now

@DanielAraldi
Copy link
Collaborator

I think it is with the rendering engine or maybe method (internally)

I think i will release as is right now

Hmmm, I’ll go to see your branch and investigate this problem

@DanielAraldi
Copy link
Collaborator

Hey @sbaiahmed1, warning only, I'll go fix the tiny problem with RenderScript in Android implementation this weekend in your library:

I created an issue in Dimezis's library also. I ask if this problem is in the own implementation or not (I'm curious 😆):

@sbaiahmed1
Copy link
Owner Author

Do as u please @DanielAraldi
I started on liquidGlass on your lib too xD

@DanielAraldi
Copy link
Collaborator

Do as u please @DanielAraldi I started on liquidGlass on your lib too xD

LMAO, you are amazing, brother @sbaiahmed1! Thank you!!!

@DanielAraldi
Copy link
Collaborator

@DanielAraldi
Copy link
Collaborator

Hey @sbaiahmed1, the Dimezis accepts my issue! It fixed the blur update problem in API 31! We update Dimezis's BlurView library to the 3.2v.

@DanielAraldi
Copy link
Collaborator

DanielAraldi commented Oct 24, 2025

Good news!!!!!! 🥳🚀

Dimezis's BlurView library WORKS on version 3.2v in Pixel 6 (SDK 31)

pixel-6-happy.mov

Life is good ✌️ @sbaiahmed1

@sbaiahmed1
Copy link
Owner Author

Good job bruder! I will update my MR and merge it today!

@DanielAraldi
Copy link
Collaborator

Great @sbaiahmed1, I'll make a small commit to this PR soon, I just ask that you test it with nested tabs.

@sbaiahmed1
Copy link
Owner Author

Sure ill wait for you go
Or maybe i will merge and you can create another MR
Ps: nested tabs broke

@DanielAraldi
Copy link
Collaborator

Sure ill wait for you go Or maybe i will merge and you can create another MR Ps: nested tabs broke

Ok! 👍

@DanielAraldi
Copy link
Collaborator

Hey @sbaiahmed1, updated for you!

For me, it worked correctly, I believe that even with the problem with nested tabs, we can still release it and resolve this in another PR.

I thought about messing with your documentation, but it looks so beautiful that I was afraid of ruining it, haha. If you'd like, I'd love for you to include a comparison with my library in your documentation; that would be great, LOL.

Finally, it's good to clarify the implementation with bottom tabs in the documentation, I believe this can cause confusion for those who are going to use it at first, as they are used to BlurView 2v.

Thank you for your collaboration, if you want to exchange ideas and solutions, count on me, without you this would not have been possible. 🚀👊

@DanielAraldi DanielAraldi self-assigned this Oct 25, 2025
@DanielAraldi DanielAraldi added documentation Improvements or additions to documentation enhancement New feature or request android Android only labels Oct 25, 2025
@DanielAraldi
Copy link
Collaborator

Hey @sbaiahmed1, I've found a new issue in Pixel 6 (Android 12 and SDK 31): when zero is provided, the App crashes. Good waiting a bit before releasing the version.

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.

Android crash: Failed resolution of: Leightbitlab/com/blurview/RenderEffectBlur Using RNN will crash on Android

2 participants