Kureev / react-native-blur

React Native Blur component
MIT License
3.76k stars 556 forks source link

Support for React Native Windows #133

Open leonskim opened 7 years ago

leonskim commented 7 years ago

Is there any plan to support for React Native Windows?

kevinvangelder commented 7 years ago

I did some research on this and it appears that blurring the background of an area is not possible in WPF, you can only blur the foreground of an image. Additionally, UWP only allows background blurring if you have the Anniversary Update.

http://stackoverflow.com/questions/36276856/uwp-app-realtime-blur-background-using-dx-compositor/36441888#36441888

Kureev commented 7 years ago

Ideally, I'd like to re-write blur to use a custom algorithm written in C and port it to all platforms. Way easier to maintain one codebase instead of 3. Can somebody give me a hand? Just DM me on twitter.

cmcewen commented 7 years ago

@Kureev how would that work? snapshotting views to images and blurring those images? react-native-gl has a blur effect but that requires OpenGL https://github.com/ProjectSeptemberInc/gl-react/blob/master/docs/examples/8.md

Kureev commented 7 years ago

btw, gl-react-native looks promising. I'll consider using it for a next major version 👍 👍 👍

ndbroadbent commented 7 years ago

@Kureev - just wanted to give some feedback on your idea to rewrite using a shared blur algorithm. I don't think that's actually a good idea, because on Android you would need to use the RenderScript API (which is what the 500px blur library is already doing), and on iOS I think it's better to just use the built-in blur effects. I think the only other platforms are Windows, Mac, and web. Mac is pretty much the same as iOS (with NSVisualEffectView), and web would just be a single div with a CSS3 blur filter (I might send a PR for that soon, since I need it for my app.)

I'm not sure how to handle Windows, but also note that right now Android isn't a real-time blur, it just generates a static blurred image. So that shouldn't be too hard to do in Windows.

Sorry, train of thought here, but we could probably do a real-time blur for Android. I would just need to invalidate the view 60 times per second. It's already hardware accelerated, so performance should be fine. But maybe you could turn on real-time blur as an option.