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

com.fivehundredpx.android.blur.BlurringView cannot be cast to android.view.ViewGroup #99

Open
newxiaofeng opened this issue Oct 14, 2016 · 16 comments

Comments

@newxiaofeng
Copy link

Hi, I have the same problem with Android, registering the library on MainApplication causes an exception to be thrown

java.lang.ClassCastException: com.fivehundredpx.android.blur.BlurringView cannot be cast to android.view.ViewGroup

Therefore on iOS it works
tested on rn 0.34, Nexus 5

@connected-mgosbee
Copy link

Also having this issue

@grubstarstar
Copy link

same here

@mariotacke
Copy link

mariotacke commented Nov 19, 2016

+1

rn 0.37, Nexus 6

@ttdatt
Copy link

ttdatt commented Nov 23, 2016

+1
rn 0.37, Android 6.0

@fabioruxo
Copy link

+1 :-(

@connected-mgosbee
Copy link

You're going to have to make the BlurView not have any children and absolutely position its sibling ontop of it :-/

@renkangke
Copy link

+1 do it youself.... change it to extends viewgroup

@Kureev
Copy link
Owner

Kureev commented Dec 3, 2016

can you take a look, @cmcewen ?

@cmcewen
Copy link
Collaborator

cmcewen commented Dec 6, 2016

could anyone with this problem post some sample code?

@IjzerenHein
Copy link

I had the problem when I embedded child views inside a BlurView. After removing the children the problem was gone.

<BlurView>
  <View ... />
  <View ... />
</BlurView>

@EgaSetya
Copy link

EgaSetya commented Dec 8, 2016

anyone find workaround for this issue?

@jgkim
Copy link
Contributor

jgkim commented Dec 13, 2016

I guess, as @IjzerenHein mentioned above, this issue is because 500px-android-blur cannot have child views (Cf. #69).

@anubhav756
Copy link

anubhav756 commented Jan 30, 2017

@connected-mgosbee I did what you asked, like so:

<View style={{ flex: 1 }}>
    <BlurView blurType="light" blurAmount={10} style={{ width: 200, height: 200 }} />
    <Image style={{ position: 'absolute', top: 150, width: 100, height: 100 }} source={{ uri }} />
</View>

... basically, removed children from <BlurView> and made them as siblings with absolute positions (so they appear partially on top of the <BlurView>).

Although I don't get the error, I don't see any blurring effect either.

Any explanations, or am I doing it the wrong way?

@Kureev
Copy link
Owner

Kureev commented Jan 30, 2017

Well, BlurView blurs everything behind it, so if you have an Image above it, it won't be blurred.

<View style={{ flex: 1 }}>
    <Image style={{ position: 'absolute', top: 150, width: 100, height: 100 }} source={{ uri }} />
    <BlurView blurType="light" blurAmount={10} style={{ width: 200, height: 200 }} />
</View>

This looks like what you want, @anubhav756

@anubhav756
Copy link

@Kureev Yep, tried that, but it didn't work. However, it DID worked for me when I passed <BlueView> as a child to <Image> and replacing child components of <BlurView> as its siblings, and absolutely positioning <BlueView> (so that it appears over the sibling objects). Thanks anyways :)

@Kureev
Copy link
Owner

Kureev commented Jan 30, 2017

Oh, sorry, idk why I wrote my last comment. It's completely wrong. BlurView should be always contained by the view you want to blur. Everything inside BlurView won't be blurred. You may see it form the basic example in readme:

const { BlurView } = require('react-native-blur');

const Menu = React.createClass({
  render() {
    return (
      <Image source={{uri}} style={styles.menu}>
        <BlurView blurType="light" blurAmount={10} style={styles.blur}>
          <Text>Hi, I am a tiny menu item</Text>
        </BlurView>
      </Image>
    );
  }
});

lxp-git pushed a commit to Flickering-AI/react-native-blur that referenced this issue Mar 7, 2022
Hopefully this should be a native prop and not a UI prop — text color animates after I call `addWhitelistedNativeProps({ color: true })`

Closes Kureev#99
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