Skip to content

Conversation

@sbaiahmed1
Copy link
Owner

@sbaiahmed1 sbaiahmed1 commented Nov 14, 2025

resolves: #10

Summary by Sourcery

Add a new ProgressiveBlurView component with native Android and iOS implementations for smooth gradient blur effects, update the README and example app to demonstrate its usage, and refine Android blur type handling.

New Features:

  • Introduce ProgressiveBlurView component for variable/gradient blur transitions on both iOS and Android

Enhancements:

  • Refactor Android blur type mapping into a dedicated enum file and update default blurType to 'xlight'

Documentation:

  • Enhance README with ProgressiveBlurView usage, API reference, migration guide, and examples

Chores:

  • Export ProgressiveBlurView and related native modules in index.tsx and package.json
  • Add ProgressiveBlurScreen, navigation tab, constants, and sample code in the example app

sbaiahmed1 and others added 8 commits November 8, 2025 21:47
…sitions

  - Implement VariableBlurView using private CA filters for smooth gradient blur
  - Add ProgressiveBlurView React Native component (iOS only)
  - Support bidirectional blur (top-to-bottom, bottom-to-top)
  - Add startOffset control for gradient positioning
  - Use smoothLinearGradient for improved transition quality
  - Create example screen with locked content use case
  - Add Fabric codegen support and TypeScript definitions
- Add ReactNativeProgressiveBlurView extending QmBlurView's ProgressiveBlurView

- Map blur amounts (0-100) to Android blur radius (0-25) for consistency

- Update docs to reflect Android support for ProgressiveBlurView

- Remove iOS-only platform checks from component and example screen
…radient approach

- implementation using BlurView and linear gradient mask
- Add support for directional gradients and startOffset for improved flexibility
- Simplify reflection-based hacks and improve reliability of blur effect rendering
@sbaiahmed1 sbaiahmed1 linked an issue Nov 14, 2025 that may be closed by this pull request
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 14, 2025

Reviewer's Guide

This PR introduces a brand-new ProgressiveBlurView component built with native Android and iOS modules for gradient blur effects, refactors the existing BlurView’s type handling, updates package exports, and refreshes documentation and example app to cover the new API.

ER diagram for new ProgressiveBlurViewProps and related types

erDiagram
  ProgressiveBlurViewProps {
    blurType string
    blurAmount number
    direction string
    startOffset number
    reducedTransparencyFallbackColor string
    style ViewStyle
    children ReactNode
  }
  ProgressiveBlurViewProps ||--o| ProgressiveBlurDirection : uses
  ProgressiveBlurViewProps ||--o| BlurType : uses
Loading

Class diagram for new ProgressiveBlurView and related types

classDiagram
  class ProgressiveBlurView {
    +blurType: BlurType
    +blurAmount: number
    +direction: ProgressiveBlurDirection
    +startOffset: number
    +reducedTransparencyFallbackColor: string
    +style: ViewStyle
    +children: ReactNode
    +updateBlur()
  }
  class VariableBlurView {
    +maxBlurRadius: CGFloat
    +direction: VariableBlurDirection
    +startOffset: CGFloat
    +updateBlur()
  }
  class ReactNativeProgressiveBlurViewNativeComponent {
    +blurAmount: number
    +blurType: BlurType
    +direction: ProgressiveBlurDirection
    +startOffset: number
    +reducedTransparencyFallbackColor: string
  }
  ProgressiveBlurView --> ReactNativeProgressiveBlurViewNativeComponent
  ProgressiveBlurView --> VariableBlurView
  VariableBlurView <|-- ProgressiveBlurView
Loading

Class diagram for updated BlurType enum (Android)

classDiagram
  class BlurType {
    +XLIGHT
    +LIGHT
    +DARK
    +EXTRA_DARK
    +REGULAR
    +PROMINENT
    +SYSTEM_ULTRA_THIN_MATERIAL
    +SYSTEM_ULTRA_THIN_MATERIAL_LIGHT
    +SYSTEM_ULTRA_THIN_MATERIAL_DARK
    +SYSTEM_THIN_MATERIAL
    +SYSTEM_THIN_MATERIAL_LIGHT
    +SYSTEM_THIN_MATERIAL_DARK
    +SYSTEM_MATERIAL
    +SYSTEM_MATERIAL_LIGHT
    +SYSTEM_MATERIAL_DARK
    +SYSTEM_THICK_MATERIAL
    +SYSTEM_THICK_MATERIAL_LIGHT
    +SYSTEM_THICK_MATERIAL_DARK
    +SYSTEM_CHROME_MATERIAL
    +SYSTEM_CHROME_MATERIAL_LIGHT
    +SYSTEM_CHROME_MATERIAL_DARK
    +fromString(type: String): BlurType
    +overlayColor: Int
  }
Loading

Class diagram for new ReactNativeProgressiveBlurView (Android)

classDiagram
  class ReactNativeProgressiveBlurView {
    -blurView: BlurView
    -gradientPaint: Paint
    -currentBlurRadius: Float
    -currentOverlayColor: Int
    -currentDirection: String
    -currentStartOffset: Float
    -hasExplicitBackground: Boolean
    +setBlurAmount(amount: Float)
    +setDirection(direction: String)
    +setStartOffset(offset: Float)
    +setBlurType(type: String)
    +setReducedTransparencyFallbackColor(color: String?)
    +cleanup()
  }
  ReactNativeProgressiveBlurView --> BlurView
Loading

Class diagram for new ProgressiveBlurView (iOS)

classDiagram
  class ProgressiveBlurView {
    -variableBlurView: VariableBlurView
    +blurAmount: Double
    +direction: String
    +startOffset: Double
    +blurTypeString: String
    +reducedTransparencyFallbackColor: UIColor
    +updateBlur()
  }
  ProgressiveBlurView --> VariableBlurView
Loading

File-Level Changes

Change Details Files
New ProgressiveBlurView component with gradient blur support
  • Add Android native view implementation (ReactNativeProgressiveBlurView) and its view manager
  • Create iOS VariableBlurView (SwiftUI) plus ObjC/Swift bridging and manager
  • Add TypeScript wrapper and codegen definition for ReactNativeProgressiveBlurView
  • Export the new component in index.tsx and update package.json provider
android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt
android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurViewManager.kt
android/src/main/java/com/sbaiahmed1/reactnativeblur/BlurType.kt
src/ProgressiveBlurView.tsx
src/index.tsx
ios/Views/VariableBlurView.swift
ios/ReactNativeProgressiveBlurView.mm
ios/ReactNativeProgressiveBlurViewManager.mm
ios/Helpers/ReactNativeProgressiveBlurViewHelper.swift
ios/Views/ProgressiveBlurView.swift
Documentation updates for progressive blur
  • Revise README tables and formatting across sections
  • Introduce ProgressiveBlurView sections under Features, Usage, Props, and Examples
  • Update feature count to three components and adjust migration guides
README.md
Example app integration of ProgressiveBlurView
  • Add ProgressiveBlurScreen and include it in the tab navigator
  • Extend BLUR_TYPES lists and update ExamplesScreen and ComparaisonExample components
  • Adjust example tsconfig to alias the local package
example/src/screens/ProgressiveBlurScreen.tsx
example/src/navigation/AppNavigator.tsx
example/src/constants/index.ts
example/src/screens/ExamplesScreen.tsx
example/src/components/ComparaisonExample.tsx
example/tsconfig.json
Refactor Android BlurView type handling
  • Remove the old internal BlurType enum from ReactNativeBlurView.kt
  • Introduce a shared BlurType enum with extended material variants
  • Change default blurType fallback in ReactNativeBlurViewManager to 'xlight'
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/BlurType.kt
Package exports and configuration
  • Export ProgressiveBlurView component and its props/types in src/index.tsx
  • Update package.json’s componentProvider to register the new native module
src/index.tsx
package.json

Assessment against linked issues

Issue Objective Addressed Explanation
#10 Implement progressive blur effect support in the library, providing a component that allows for variable/gradient blur transitions.
#10 Document the progressive blur feature and its usage in the README, including API, props, and example code.
#10 Add example/demo code to showcase progressive blur usage in the example app.

Possibly linked issues

  • Progressive blur support #10: This PR's refactor of the blur library, including the BlurView component's implementation, addresses the reported unimplemented component error.

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

@sbaiahmed1
Copy link
Owner Author

@DanielAraldi it is ready finally :D

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 Android mapBlurAmountToRadius helper uses MAX_BLUR_RADIUS in the denominator (clampedAmount / MAX_BLUR_RADIUS * MAX_BLUR_RADIUS) which effectively returns the input; you probably intended to normalize against MAX_BLUR_AMOUNT (0–100) and then scale to MAX_BLUR_RADIUS (0–25).
  • This PR is very large and mixes README/docs changes, Android/iOS native code, and example app updates—consider splitting it into smaller, focused PRs (e.g. docs vs. Android vs. iOS vs. examples) to make review and testing more manageable.
  • Using raw strings for blurType and direction increases the chance of typos—consider surfacing these as typed enums or union types on the JS side to improve discoverability and safety.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Android mapBlurAmountToRadius helper uses MAX_BLUR_RADIUS in the denominator (clampedAmount / MAX_BLUR_RADIUS * MAX_BLUR_RADIUS) which effectively returns the input; you probably intended to normalize against MAX_BLUR_AMOUNT (0–100) and then scale to MAX_BLUR_RADIUS (0–25).
- This PR is very large and mixes README/docs changes, Android/iOS native code, and example app updates—consider splitting it into smaller, focused PRs (e.g. docs vs. Android vs. iOS vs. examples) to make review and testing more manageable.
- Using raw strings for blurType and direction increases the chance of typos—consider surfacing these as typed enums or union types on the JS side to improve discoverability and safety.

## Individual Comments

### Comment 1
<location> `ios/Views/VariableBlurView.swift:81` </location>
<code_context>
+      return
+    }
+
+    let gradientImage = makeGradientImage(
+      startOffset: startOffset,
+      direction: direction
</code_context>

<issue_to_address>
**suggestion:** Gradient image generation uses fixed dimensions; consider adapting to view size for best results.

Currently, the gradient image uses a hardcoded 100x100 size. Generating it based on the view's actual dimensions will improve appearance, particularly for larger or differently shaped views.

Suggested implementation:

```
    let gradientImage = makeGradientImage(
      startOffset: startOffset,
      direction: direction,
      size: bounds.size
    )

```

You will also need to update the `makeGradientImage` function definition to accept a `size: CGSize` parameter and use it to set the image dimensions, replacing any hardcoded values (such as 100x100).
</issue_to_address>

### Comment 2
<location> `README.md:136` </location>
<code_context>
 ## Features

-- � **Two Specialized Components**: 
+- � **Three Specialized Components**:
   - `BlurView` - Dedicated blur effects component with multiple blur types
+  - `ProgressiveBlurView` - Variable/gradient blur transitions (iOS & Android)
</code_context>

<issue_to_address>
**issue (typo):** The '�' character appears to be a corrupted emoji or symbol.

Replace or remove the '�' character to improve clarity.

Suggested implementation:

```
- 🧩 **Three Specialized Components**:

```

```
- 🌊 **Liquid Glass Effects**: Revolutionary glass effects using iOS 26+ UIGlassEffect API

```
</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.

return
}

let gradientImage = makeGradientImage(
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Gradient image generation uses fixed dimensions; consider adapting to view size for best results.

Currently, the gradient image uses a hardcoded 100x100 size. Generating it based on the view's actual dimensions will improve appearance, particularly for larger or differently shaped views.

Suggested implementation:

    let gradientImage = makeGradientImage(
      startOffset: startOffset,
      direction: direction,
      size: bounds.size
    )

You will also need to update the makeGradientImage function definition to accept a size: CGSize parameter and use it to set the image dimensions, replacing any hardcoded values (such as 100x100).

@DanielAraldi DanielAraldi added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 14, 2025
@DanielAraldi
Copy link
Collaborator

Very nice!! I’ll go to testing this feature tomorrow, ok?

@sbaiahmed1
Copy link
Owner Author

@DanielAraldi take your timer brother

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.

That’s works perfectly for me!! ProgressiveBlur implementation is amazing advance!

@DanielAraldi
Copy link
Collaborator

@sbaiahmed1 can merge it 🎉🎉

@sbaiahmed1
Copy link
Owner Author

sbaiahmed1 commented Nov 15, 2025

That’s works perfectly for me!! ProgressiveBlur implementation is amazing advance!

Glad you liked it and it worked!

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

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Progressive blur support

3 participants