-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/progressive blur #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…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
Reviewer's GuideThis 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 typeserDiagram
ProgressiveBlurViewProps {
blurType string
blurAmount number
direction string
startOffset number
reducedTransparencyFallbackColor string
style ViewStyle
children ReactNode
}
ProgressiveBlurViewProps ||--o| ProgressiveBlurDirection : uses
ProgressiveBlurViewProps ||--o| BlurType : uses
Class diagram for new ProgressiveBlurView and related typesclassDiagram
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
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
}
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
Class diagram for new ProgressiveBlurView (iOS)classDiagram
class ProgressiveBlurView {
-variableBlurView: VariableBlurView
+blurAmount: Double
+direction: String
+startOffset: Double
+blurTypeString: String
+reducedTransparencyFallbackColor: UIColor
+updateBlur()
}
ProgressiveBlurView --> VariableBlurView
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@DanielAraldi it is ready finally :D |
There was a problem hiding this 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>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( |
There was a problem hiding this comment.
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).
|
Very nice!! I’ll go to testing this feature tomorrow, ok? |
|
@DanielAraldi take your timer brother |
DanielAraldi
left a comment
There was a problem hiding this 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!
|
@sbaiahmed1 can merge it 🎉🎉 |
Glad you liked it and it worked! |
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:
Enhancements:
Documentation:
Chores: