-
Notifications
You must be signed in to change notification settings - Fork 126
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
How to cut a hole in a view using a mask #147
Comments
@MarioUnlam hello! i need exactly the same! did you find solution? |
@pedrogarciyalopez Nope. I ended up using a squared header, and created a page wrapper component that has two backgrounds (one blue, and one white with rounded corners). A better solution would be to create a custom header with that rounded shape, using react-native-svg. |
@pedrogarciyalopez The approach I used (two backgrounds in a page wrapper) didn't work well with iOS transitions, so I used an SVG header instead. Here's my implementation: Place this code in a helper file:
then in the options of your screen or navigator, add this:
You can change the roundness, the colors of the (vertical) gradient, or remove the <Defs> section entirely and use a plain fill color instead. Hope it helps :) |
@MarioUnlam I'm gonna give a try at this that seems to be answering this need... |
I need to make an inverted mask. This means making a "hole" in the rendered view, instead of rendering inside the hole. Since this plugin uses alpha to define the mask, I cannot use a transparent view inside an opaque view, otherwise it will only use the opaque view as the mask. It would be better to use white instead of alpha to change the mask opacity. Is there a way to do this? Here's an example of what I want to do:
I want to remove the bottom part of that rectangle, using another view with rounded corners. But I'm unable to "remove" a piece of the mask. Is there any workaround?
The text was updated successfully, but these errors were encountered: