Giter Site home page Giter Site logo

Comments (9)

Jackman3005 avatar Jackman3005 commented on May 18, 2024 1

Interesting, when I tried paint inside before I did not expect it to be underneath the background-color. But it does appear to give the result I'm looking for.

It's worth noting that I imagine you should be able to resolve this because the behavior is identical across android,iOS, and web, so I don't think it's just caused by a difference in the internal react-native or web-specific engines. Strangely in our implementation it is identical across iOS/Android/web but in the snack it is not. Possibly caused by some of our nested views in the local implementation. Or potentially something with expo 49, but for some reason there are errors running it on expo 49 in the snack...

I will give your solution a try and see how it works in our environment. Cheers

from react-native-shadow-2.

SrBrahma avatar SrBrahma commented on May 18, 2024

Is it iOS?

from react-native-shadow-2.

SrBrahma avatar SrBrahma commented on May 18, 2024

Also, please provide me a reproducible example in Expo Snack

from react-native-shadow-2.

Jackman3005 avatar Jackman3005 commented on May 18, 2024

Web, iOS, and Android. I'll hopefully be able to work on a snack for you soon.

from react-native-shadow-2.

Jackman3005 avatar Jackman3005 commented on May 18, 2024

Hi @SrBrahma I found the time to create a snack that exhibits the issue.

The modal is opened with transparent={true} on top of a view that has a red background. You can clearly see the red leaking through on the edges of the modal before the shadow begins. See accompanying screenshots.
Screenshot 2023-10-04 at 11 33 18 am

Screenshot 2023-10-04 at 11 35 56 am

Let me know what you think or if there is another way I can help you out with this.

from react-native-shadow-2.

SrBrahma avatar SrBrahma commented on May 18, 2024

The thing is that the borderRadius is handled differently by React Native styles and the SVG engine, and that engine depends on the platform.

In that example, you can put the View with the white background as a child of the Shadow component, and change the paintInside to true. This way, any gap caused by the different borderRadiuses will just have the Shadow color filling it; the red won't be visible between the two components.

from react-native-shadow-2.

SrBrahma avatar SrBrahma commented on May 18, 2024

Also, in your example, you can just simply put that white background color inside the style property of the Shadow instead of having it on the wrapping View, together with the paintInside=true.

from react-native-shadow-2.

Jackman3005 avatar Jackman3005 commented on May 18, 2024

The solution you mentioned has worked for us and we've gone ahead with that for now.

I wish there was some way I could have guessed this behavior and come up with the solution on my own. I did try paintInside={true} but saw that it covered the whole of the component and did not expect that setting a background would paint the background on top of the shadow :/

Thanks again for your help. Maybe this would be worth adding to the FAQ section?

from react-native-shadow-2.

SrBrahma avatar SrBrahma commented on May 18, 2024

I believe the reason it covered the whole component is because the white background you had was caused by the parent component, so the child component is rendered after the parent, that's why the paintInside was on top of the parent's background.

Any idea how to write about that on the README? Either on FAQ or on the paintInside/style props description.

from react-native-shadow-2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.