Skip to content

Feat/soc uivisual effects#38

Merged
sbaiahmed1 merged 8 commits into
mainfrom
feat/soc-uivisual-effects
Nov 5, 2025
Merged

Feat/soc uivisual effects#38
sbaiahmed1 merged 8 commits into
mainfrom
feat/soc-uivisual-effects

Conversation

@sbaiahmed1

@sbaiahmed1 sbaiahmed1 commented Nov 4, 2025

Copy link
Copy Markdown
Owner

LIQUID GLASS 

- Implemented ReactNativeLiquidGlassViewHelper for managing liquid glass view properties.

  • Created LiquidGlassContainerView and LiquidGlassContentView to handle the rendering of the glass effect using SwiftUI.
  • Developed ReactNativeLiquidGlassView and its manager to expose properties to React Native.
  • Added support for various properties including glassType, glassTintColor, glassOpacity, and more.
  • Implemented color parsing utility to handle hex and named colors.
  • Ensured compatibility with iOS 26+ for native glass effects while providing fallbacks for older versions.
  • Updated TypeScript definitions for the LiquidGlassView component in React Native.

Summary by Sourcery

Introduce a new LiquidGlassView component with native iOS 26+ liquid glass effects and fallbacks, remove glass props from BlurView, update examples to use the new component, and add build fixes for glog.

New Features:

  • Add a dedicated LiquidGlassView component exposing glassType, glassTintColor, glassOpacity, isInteractive and ignoreSafeArea props to React Native
  • Implement native iOS 26+ glass effect with UIKit LiquidGlassContainerView and LiquidGlassContentView and fallbacks for older iOS versions
  • Introduce a color parsing utility to handle hex and named color strings in the native view helper

Enhancements:

  • Remove obsolete glass-related props from the existing BlurView component
  • Update example app to replace BlurView liquidGlass usage with the new LiquidGlassView
  • Export the LiquidGlassView and ReactNativeLiquidGlassView from the package index

Build:

  • Add Podfile patches to address glog header and compilation flags issues

- BorderRadius implementation with React Native's built-in style system for consistency.
- Remove SwiftUI wrapper and implement UIKit-only solution following Expo's approach.
- Update component to properly handle border radius through layout metrics.
@sourcery-ai

sourcery-ai Bot commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR introduces a dedicated LiquidGlassView component alongside a native iOS SwiftUI/UIView-based implementation for advanced glass effects, while stripping out legacy liquidGlass code from the existing BlurView, updating example usages, and applying required build fixes for iOS and Android.

Entity relationship diagram for LiquidGlassView props and native mapping

erDiagram
  LiquidGlassView {
    glassType string
    glassTintColor string
    glassOpacity number
    reducedTransparencyFallbackColor string
    isInteractive boolean
    ignoreSafeArea boolean
  }
  ReactNativeLiquidGlassViewNativeComponent {
    glassType string
    glassTintColor string
    glassOpacity number
    reducedTransparencyFallbackColor string
    isInteractive boolean
    ignoreSafeArea boolean
  }
  LiquidGlassView ||--|| ReactNativeLiquidGlassViewNativeComponent : "props mapped"
  ReactNativeLiquidGlassViewNativeComponent ||--|| ReactNativeLiquidGlassView : "native props"
  ReactNativeLiquidGlassView ||--|| LiquidGlassContainerView : "updates properties"
Loading

Class diagram for new LiquidGlassView and related native components

classDiagram
  class LiquidGlassView {
    +glassType: GlassType
    +glassTintColor: string
    +glassOpacity: number
    +reducedTransparencyFallbackColor: string
    +isInteractive: boolean
    +ignoreSafeArea: boolean
    +style: ViewStyle
    +children: React.ReactNode
  }
  class ReactNativeLiquidGlassViewNativeComponent {
    +glassType: GlassType
    +glassTintColor: string
    +glassOpacity: Double
    +reducedTransparencyFallbackColor: string
    +isInteractive: boolean
    +ignoreSafeArea: boolean
  }
  class ReactNativeLiquidGlassView {
    +colorFromString(colorString: NSString): UIColor
    +updateProps(props, oldProps)
    +finalizeUpdates(updateMask)
    +layoutSubviews()
    +updateLayoutMetrics(layoutMetrics, oldLayoutMetrics)
    +mountChildComponentView(childComponentView, index)
    +unmountChildComponentView(childComponentView, index)
  }
  class ReactNativeLiquidGlassViewHelper {
    +createLiquidGlassViewWithFrame(frame: CGRect): LiquidGlassContainerView
    +updateLiquidGlassView(liquidGlassView, withGlassTintColor: UIColor)
    +updateLiquidGlassView(liquidGlassView, withGlassOpacity: Double)
    +updateLiquidGlassView(liquidGlassView, withGlassType: String)
    +updateLiquidGlassView(liquidGlassView, withIsInteractive: Bool)
    +updateLiquidGlassView(liquidGlassView, withIgnoringSafeArea: Bool)
    +updateLiquidGlassView(liquidGlassView, withReducedTransparencyFallbackColor: UIColor)
  }
  class LiquidGlassContainerView {
    +glassTintColor: UIColor
    +glassOpacity: Double
    +glassType: String
    +reducedTransparencyFallbackColor: UIColor
    +isInteractive: Bool
    +ignoreSafeArea: Bool
    +setBorderRadius(radius: CGFloat)
    +getContentView(): UIView
  }
  LiquidGlassView --> ReactNativeLiquidGlassViewNativeComponent
  ReactNativeLiquidGlassViewNativeComponent --> ReactNativeLiquidGlassView
  ReactNativeLiquidGlassView --> ReactNativeLiquidGlassViewHelper
  ReactNativeLiquidGlassViewHelper --> LiquidGlassContainerView
  LiquidGlassContainerView --> UIView
Loading

Class diagram showing removal of liquidGlass props from BlurView

classDiagram
  class BlurView {
    -glassType: GlassType
    -glassTintColor: string
    -glassOpacity: number
    -type: 'blur' | 'liquidGlass'
    -isInteractive: boolean
    -ignoreSafeArea: boolean
    +blurType: BlurType
    +blurAmount: number
    +reducedTransparencyFallbackColor: string
    +style: ViewStyle
    +children: React.ReactNode
  }
  %% The above attributes were removed from BlurView in this PR
Loading

File-Level Changes

Change Details Files
Introduce new LiquidGlassView component with native iOS SwiftUI and UIKit implementation
  • Add TypeScript wrapper (src/LiquidGlassView.tsx) with fallback logic for non‐iOS or pre‐iOS26
  • Define codegen native interface (src/ReactNativeLiquidGlassViewNativeComponent.ts)
  • Implement ReactNativeLiquidGlassView (mm) and manager (mm/h) to expose glassType, tint, opacity, interactivity, safe area
  • Create ReactNativeLiquidGlassViewHelper.swift bridging updates to LiquidGlassContainerView
  • Develop LiquidGlassContainerView.swift as UIKit wrapper handling glassEffect and fallback
  • Implement colorFromString parsing utility in ReactNativeLiquidGlassView.mm
  • Update index.tsx and package.json to export LiquidGlassView and native component provider
src/LiquidGlassView.tsx
src/ReactNativeLiquidGlassViewNativeComponent.ts
ios/ReactNativeLiquidGlassView.mm
ios/ReactNativeLiquidGlassViewManager.mm
ios/ReactNativeLiquidGlassViewManager.h
ios/Helpers/ReactNativeLiquidGlassViewHelper.swift
ios/Views/LiquidGlassContainerView.swift
src/index.tsx
package.json
Remove legacy liquidGlass and blur propagation from existing BlurView
  • Strip liquidGlass‐related props (glassType, tint, opacity, type, isInteractive, ignoreSafeArea) from BlurViewProps and render
  • Remove custom property setters in ReactNativeBlurView.mm and manager; simplify ReactNativeBlurViewHelper
  • Simplify BasicColoredView and AdvancedBlurView to only support standard blur
  • Drop corresponding defaults and TS definitions from ReactNativeBlurViewNativeComponent.ts
  • Clean up Android BlurViewManager by removing legacy overrides and no-op setters
src/BlurView.tsx
src/ReactNativeBlurViewNativeComponent.ts
ios/ReactNativeBlurView.mm
ios/Views/BasicColoredView.swift
ios/Views/AdvancedBlurView.swift
ios/Helpers/ReactNativeBlurViewHelper.swift
ios/ReactNativeBlurViewManager.mm
android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt
Update example demos to use LiquidGlassView in place of BlurView for glass effects
  • Replace <BlurView type="liquidGlass"> usages with <LiquidGlassView>
  • Remove deprecated props from example components and adjust styles (borderRadius, numberOfLines)
  • Update PracticalExamples to drop unused glass props
example/src/components/LiquidGlassExample.tsx
example/src/components/PracticalExamples.tsx
Apply build configuration fixes for iOS C++ modules
  • Extend example/ios/Podfile to set C++20 standard and suppress header warnings
  • Add glog header search paths and compiler flags to fix build issues
example/ios/Podfile

Possibly linked issues

  • #v0.3 build error [ios]: The PR resolves the build error by refactoring the problematic glass effect implementation from ReactNativeBlurView into a new LiquidGlassView component.
  • #version 3.1.1 android build failed: The PR resolves the Android build failure by refactoring glass-related properties out of ReactNativeBlurView, fixing unresolved references.

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

  • There’s a lot of dead/unused code left in native files (e.g. the commented‐out liquidGlass branch in BasicColoredView.swift and unused methods in ReactNativeBlurViewHelper); consider removing those to simplify maintenance.
  • The LiquidGlassView fallback always uses a hardcoded blurAmount={70} on unsupported platforms—consider making that configurable or reusing a prop so appearance is consistent.
  • The Podfile workarounds for glog feel orthogonal to the glass feature—splitting them into a separate commit or PR would keep this feature diff more focused.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- There’s a lot of dead/unused code left in native files (e.g. the commented‐out liquidGlass branch in BasicColoredView.swift and unused methods in ReactNativeBlurViewHelper); consider removing those to simplify maintenance.
- The `LiquidGlassView` fallback always uses a hardcoded `blurAmount={70}` on unsupported platforms—consider making that configurable or reusing a prop so appearance is consistent.
- The Podfile workarounds for glog feel orthogonal to the glass feature—splitting them into a separate commit or PR would keep this feature diff more focused.

## Individual Comments

### Comment 1
<location> `ios/ReactNativeLiquidGlassView.mm:33-42` </location>
<code_context>
+  // Prevent excessively long strings that could cause performance issues
</code_context>

<issue_to_address>
**suggestion (performance):** Color parsing in ReactNativeLiquidGlassView is robust but could be optimized.

Repeated NSLog warnings for invalid colors could clutter logs and impact performance. Consider rate-limiting or aggregating these warnings to reduce overhead.

Suggested implementation:

```
+ (UIColor *)colorFromString:(NSString *)colorString {
  // Rate-limited warning for invalid color strings
  static NSUInteger invalidColorWarningCount = 0;
  static const NSUInteger invalidColorWarningThreshold = 5;
  static BOOL invalidColorWarningThresholdReached = NO;

  // Input validation
  if (!colorString || [colorString isEqualToString:@""] || colorString.length == 0) {
    if (invalidColorWarningCount < invalidColorWarningThreshold) {
      NSLog(@"[ReactNativeLiquidGlassView] Warning: Color string is nil or empty, using default clear color");
      invalidColorWarningCount++;
      if (invalidColorWarningCount == invalidColorWarningThreshold) {
        NSLog(@"[ReactNativeLiquidGlassView] Further invalid color warnings will be suppressed.");
        invalidColorWarningThresholdReached = YES;
      }
    }
    return [UIColor clearColor]; // Default color
  }

  // Prevent excessively long strings that could cause performance issues
  if (colorString.length > 50) {
    if (invalidColorWarningCount < invalidColorWarningThreshold) {
      NSLog(@"[ReactNativeLiquidGlassView] Warning: Color string too long, using default clear color");
      invalidColorWarningCount++;
      if (invalidColorWarningCount == invalidColorWarningThreshold) {
        NSLog(@"[ReactNativeLiquidGlassView] Further invalid color warnings will be suppressed.");
        invalidColorWarningThresholdReached = YES;
      }
    }
    return [UIColor clearColor];
  }

```

If there are other places in `colorFromString:` where invalid color warnings are logged (e.g., for unrecognized color names or invalid hex formats), you should wrap those NSLog statements with the same rate-limiting logic using `invalidColorWarningCount` and the threshold.
</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.

fix: correct QmBlurView dependency notation in build.gradle
refactor: override setIgnoreSafeArea method in ReactNativeBlurViewManager
@sbaiahmed1 sbaiahmed1 merged commit 86f7abf into main Nov 5, 2025
5 of 6 checks passed
@sbaiahmed1 sbaiahmed1 deleted the feat/soc-uivisual-effects branch November 5, 2025 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant