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

For circle shadow not blending properly from corners #40

Open
ranvirgorai opened this issue Nov 22, 2018 · 9 comments
Open

For circle shadow not blending properly from corners #40

ranvirgorai opened this issue Nov 22, 2018 · 9 comments

Comments

@ranvirgorai
Copy link

ranvirgorai commented Nov 22, 2018

For the circle, the shadow is not blending properly from corners

const shadowOpt1 = {
           width:150,
           height:150,
           color:"#000",
           border:30,
           radius:75,
           opacity:0.2,
           x:0,
           y:0,
           style:{marginVertical:0,marginHorizontal:40,}
       }

screen shot 2018-11-21 at 1 04 39 pm

And if the border-radius is greater then 50% then getting an unexpected result

const shadowOpt1 = {
           width:150,
           height:150,
           color:"#000",
           border:30,
           radius:80,
           opacity:0.2,
           x:0,
           y:0,
           style:{marginVertical:0,marginHorizontal:40,}
       }


screen shot 2018-11-21 at 1 07 03 pm

@ranvirgorai ranvirgorai changed the title For circle shadow not blending properly For circle shadow not blending properly from corners Nov 22, 2018
@dagatsoin
Copy link

I confirm.

@rahamin1
Copy link

@dagatsoin @ranvirgorai

I believe that the problem that I have is the one you are referring to.
I am posting this in order to make sure this is the case... Is it?
And perhaps anybody has found a solution on how to do this in raect-native (android)...

I want to display something like the following:

image

But what I get is:

image

Here is my code:

class ShadowTest extends Component {

  render() {

    const shadowOpt = {
      width: 100,
      height: 100,
      color: "#000",
      border: 2,
      radius: 50,
      opacity: 0.8,
      x: 3,
      y: 3,
      //style: { marginVertical: 5 }
    }

    return (
      <View style={{ flex: 1 }}>
        <View style={{ margin: 10, alignItems: 'center',
            justifyContent: 'center' }}>
          <BoxShadow setting={ shadowOpt }>
            <TouchableHighlight style={{
              position: 'relative',
              width: 100,
              height: 100,
              backgroundColor: "#fff",
              borderRadius: 50,
              borderWidth: 1,
              borderColor: '#aaa',
              // marginVertical:5,
              alignItems: 'center',
              justifyContent: 'center',
              overflow: "hidden" }}>
              <Text>aaaa</Text>
            </TouchableHighlight>
          </BoxShadow>
          </View>
      </View>
    )
  }
}

@dagatsoin
Copy link

dagatsoin commented Apr 16, 2019

I reimplemented this plugin in a way that supports the round corner. It is part of my library but it is isolated enough to be adapted on any project. Just take care to replace the View element.

Demo for android: https://expo.io/@dagatsoin/sproutch
Code: https://github.com/dagatsoin/sproutch/blob/master/src/components/shadow/Shadow.tsx

@rahamin1
Copy link

Thanks @dagatsoin
Which part of the code implements the circular shadow?

@dagatsoin
Copy link

It is those SVG commands: https://github.com/dagatsoin/sproutch/blob/master/src/components/shadow/Shadow.tsx#L193

@rahamin1
Copy link

Thanks!

@Jamyth
Copy link

Jamyth commented Feb 4, 2020

I reimplemented this plugin in a way that supports the round corner. It is part of my library but it is isolated enough to be adapted on any project. Just take care to replace the View element.

Demo for android: https://expo.io/@dagatsoin/sproutch
Code: https://github.com/dagatsoin/sproutch/blob/master/src/components/shadow/Shadow.tsx

I got an Error while updating property 'd' of a view managed by: RNSVGPath

null

UnexecptedData

@dagatsoin
Copy link

@Jamyth try this branch https://github.com/dagatsoin/sproutch/tree/release/0.0.4

This error is due to dependencies mess with the new expo/rn versions.

@SimonChaumet
Copy link

Still no update on this ? Or any workaround ?

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

5 participants