Kureev / react-native-blur

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

Blur a view #204

Open googl3r opened 7 years ago

googl3r commented 7 years ago

Hi, I am trying to blur a view, it works on iOS but on android it doesn't work, is it possible to blur any view ? here is my code

`

          <View style = {MainStyle.footer}>
                <TouchableHighlight style={MainStyle.bottomButtons}>
                    <Text style={MainStyle.footerText}>Accueil</Text>
                </TouchableHighlight>
                <TouchableHighlight style={MainStyle.bottomButtons}>
                    <Text style={MainStyle.footerText}>Livraison</Text>
                </TouchableHighlight>
                <TouchableHighlight style={MainStyle.bottomButtons}>
                    <Text style={MainStyle.footerText}>Mon Compte</Text>
                </TouchableHighlight>
            </View>
            <BlurView
                blurType = "light"
                blurAmount={7}
                viewRef = {this.state.viewRef}
                style={[MainStyle.blurView]} />
            <View style = {MainStyle.footerView}  >

`

Kureev commented 7 years ago

Not sure if I see an assignment of viewRef here. You should store a ref the view you want to blur in this.state.viewRef in order this code to work:

<View ref={ref => this.setState({ viewRef: ref })} style={MainStyle.footer}>
  //...
</View>
cinder92 commented 7 years ago

@googl3r did found a solution?

googl3r commented 7 years ago

@cinder92 no always have the same problem, @Kureev solution doesn't work

cinder92 commented 7 years ago

you are right its work on ios but no on android, this need to be fixed... somehow...

Kureev commented 7 years ago

Did you try https://github.com/react-native-community/react-native-blur/blob/master/examples/Basic/index.android.js ? Does it work for you?

cuongtructran commented 7 years ago

It works for image but not for a view, it's just a semi-transparent effect not blur effect.

dmr07 commented 7 years ago

@cinder92 Were you able to test the blur effect on a physical iOS device? I've found it work on the simulator, but the blur appears as an opaque black box on the device build.

googl3r commented 7 years ago

until now the blur effect doesn't work on a view it works just on image

DanGDroid commented 6 years ago

on ios it works perfect on View as well but not on Android

mileung commented 6 years ago

@googl3r Wouldn't that be mentioned in the limitations if that were the case?

Has anyone been able to blur Views on Android?

kostiantyn-solianyk commented 3 years ago

hello from 2021, still working only with Image component on android?