GeekyAnts / NativeBase

Mobile-first, accessible components for React Native & Web to build consistent UI across Android, iOS and Web.
https://nativebase.io/
MIT License
20.21k stars 2.39k forks source link

Blur pseudo property #4150

Closed SamuelScheit closed 2 years ago

SamuelScheit commented 3 years ago

Problem I'm currently developing a project where users can submit their own themes, however currently it is not possible to create a glassmorphism theme, because there is no pseudo _blur property.

Solution Just like the _hover and _text pseudo property, there should be an option to specify a background blur effect:

https://github.com/Kureev/react-native-blur blur gif

Alternatives I could instead manually wrap every component inside a native base factory, but this is not very feasible.

Implementation I'm willing to create a PR if this feature request will be approved. Let me know if I have to watch out for certain things other than the COC and contribution guide.

If the _blur property is specified it should get passed to the BlurView of @react-native-community/blur, which will wrap the element.

md-rehman commented 2 years ago

I'm but this feature can't be added soon, as it requires a third-party dependency which we're not looking forward to adding. But you can create a custom component that uses BlurView and relies on _blur prop to render it or not. The code will look something like

const MyBlurComponent = ({children, _blur}) => {
  return _blur ? <BlurView {..._blur}>{children}</BlurView> : children
}

And if you want you can use the factory functioned version of BlurView instead.