Skip to content

[iOS] filter: brightness is applied incorrectly to transparent pixels #60238

Open

Description

@SimpleCreations

Description

On iOS, applying filter: [{ brightness: x }] to a view whose content has transparent pixels — for example an <Image> showing a PNG with an alpha channel and no backgroundColor — fills the transparent areas with a solid grey of value x instead of leaving them transparent. The closer x is to 1, the lighter the grey: brightness: 0.5 gives mid grey, and brightness: 0.9 gives an off-white box behind the image. Opaque pixels are darkened as expected.

Android renders the same code correctly: only the RGB channels are scaled and transparent pixels stay transparent.

The cause seems to be how brightness is implemented on iOS (introduced in #44457). RCTViewComponentView adds a _filterLayer sublayer covering the view's bounds, with backgroundColor = rgb(x, x, x) and compositingFilter = @"multiplyBlendMode". Multiplying only darkens pixels that have something opaque beneath them. Where the view's content is transparent there is nothing to multiply, so the grey overlay layer itself shows through.

Per the CSS Filter Effects spec, brightness() is a linear transfer applied to the R, G and B channels only. Alpha is unchanged, so transparent pixels should stay transparent, as they do on Android.

Steps to reproduce

  1. Open the Snack below and run it on an iOS device or simulator.
  2. It renders the same transparent PNG twice: on the left without a filter, on the right with filter: [{ brightness: 0.5 }].
  3. On iOS, the right image is drawn over a solid grey square where the PNG is transparent.
  4. Run the same Snack on Android: the transparent areas of the right image stay transparent and only the opaque pixels are darkened.

React Native Version

0.88.1

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 27.2.1
  CPU: (18) arm64 Apple M5 Pro
  Memory: 154.28 MB / 48.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 26.12.1
  Yarn: Not Found
  npm:
    version: 11.20.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2026.10.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.17.0
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 27.2
      - iOS 27.2
      - macOS 27.2
      - tvOS 27.2
      - visionOS 27.2
      - watchOS 27.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2026.2 AI-262.10968.63.2622.16975389
  Xcode:
    version: 27.2/27B52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.11
    path: /usr/bin/javac
  Ruby:
    version: 4.0.5
    path: /opt/homebrew/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.2.0
    wanted: 20.2.0
  react:
    installed: 19.3.1
    wanted: 19.3.1
  react-native:
    installed: 0.88.1
    wanted: 0.88.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

N/A

MANDATORY Reproducer

https://snack.expo.dev/@simplecreations/ios-transparent-image-brightness-issue

Screenshots and Videos

Android (correct) iOS (incorrect)
frame frame (1)

Activity

  1. Prerna2024-cyber commented on Nov 23, 2026

    @Prerna2024-cyber

    /assign

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions