Skip to content
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

Backdrop Filter Not Working on Mobile #2741

Open
jack-beanstalk-2022 opened this issue Nov 17, 2024 · 0 comments
Open

Backdrop Filter Not Working on Mobile #2741

jack-beanstalk-2022 opened this issue Nov 17, 2024 · 0 comments

Comments

@jack-beanstalk-2022
Copy link

jack-beanstalk-2022 commented Nov 17, 2024

I created a simple repo for this https://github.com/jack-beanstalk-2022/RNSkia-BackdropFilter-Error

All it does is render a red transparent circle on top of a blue opaque circle and set the backdrop filter to blur = 12.

function App(): React.JSX.Element {
  const clip = rrect(rect(100, 50, 100, 100), 50, 50);

  return (
    <Canvas style={{flex: 1}}>
      <Group>
        <Circle cx={100} cy={100} r={50} color="blue" />
        <BackdropFilter
          filter={<Blur blur={12}/>}
          clip={clip}>
          <Group
            clip={clip}>
            <Circle cx={150} cy={100} r={50} color="red" opacity={0.7} />
          </Group>
        </BackdropFilter>
      </Group>
    </Canvas>
  );
}

The result I got on Android & IOS simulator:
Image
Image

The result I got using similar code on Web:
Image

My own investigation:
I suspect this is a Skia bug https://issues.skia.org/issues/379330016, but an easy fix is to use the recommended way to implement backdrop blur. That is to pass in a paint to saveLayerRect rather than a ImageFilter here .

Other relevant things:

  1. My project is on
    "@shopify/react-native-skia": "0.1.241",
    "react": "18.3.1",
    "react-native": "0.75.4"
    and Fabric is not enabled

  2. There is a glassmorphism example in RNSkia https://www.youtube.com/watch?v=ao2i_sOD-z0 , it demonstrates the same above mentioned behavior for me. I wonder if it is working for others

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

No branches or pull requests

1 participant