-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[0.61.*] Broken shadow on android #26544
[0.61.*] Broken shadow on android #26544
Comments
Hi @mikebouwmans , does it happen for you with every API level? |
I took the liberty to create a minimal example repository which demonstrates the issue without using third party libraries: https://github.com/forsen/shadowTest This is how the repository is created:
|
@forsen unfortunately, this repository will not help to reproduce the bug |
I will check this later today |
I met with this issue about a week ago. I use the react-navigation and react-navigation-stack libraries and after upgrading to rn 0.61.0-rc.0 I noticed that when I switch from the root screen to any other, the views disappear, the shadows are drawn on top of the modal screens and the background is drawn on the outlined TextInput ( from the react-native-paper library). However, after making any screen root, everything in it is rendered correctly. To reproduce this bug, I created a repository https://github.com/B27/React-Native-borderRadius-test based on rn-diff-purge (branch release/0.61.0-rc.3). The project contains two screens with the same content. After switching to the second screen, the modal window and the other views with borderRadius break until you set their borderRadius to undefined The following screenshots are from api 28 (also tested on api 21, 25 with the same result) Normal: With bugs: Bug suppression by setting borderRadius to undefined: |
Setting |
Is it related to styled-components/css-to-react-native#117 ? I though it was specific for styled components but I'm experiencing strange issues with background and positions relative since 0.61-rcX |
I could reproduce the exact same issue just using a When you press the element it becomes transparent and shows the exact same issue. |
I have the same issue on react native 0.59.10 so that's not something new I guess :/ |
@zwenza, @billouboq you are talking about normal shadow behavior in android not related to this issue.
I created a new project with react-native 0.54.4 added |
Thanks @B27 , will give this a try today! |
@zwenza I forgot that for TouchableOpacity there is a simpler way - apply elevation to TouchableOpacity itself. Instead of |
@gaearon Looks like a serious bug that went though the net :p On android. I think the minimal example of React native isn't enough to detect those kind of issue between versions and too many people are updating to rc to test :( |
Since it is not immediately clear what the problem is (#26544 (comment)), I recorded a video of the application from the repository https://github.com/B27/React-Native-borderRadius-test showing a bug: https://www.youtube.com/watch?v=wA6H2m153Yg |
As i Posted in the linked topic here: styled-components/css-to-react-native#117 Here is an small example with a border radius (it's commented but try with uncommenting it) const Bug = () => {
return (
<View style={{ flex: 1 }}>
<BuggingView />
<PageWrapper>
<Text>
This should appear above backgroundThis should appear above background This should appear above background This should appear
above above background This should appear above background This should appear above background This should appear above background
This This should appear above background This should appear above background This should appear above background This should
appear above background This should appear above background This should appear above background This should appear above
background This should appear above background This should appear above background This should appear above background This should
appear above background This should appear above background This should appear above background This should appear above
background This should appear above background This should appear above background This should appear above background This should
appear above background This should appear above background This should appear above background This should appear above
background This should appear above background
</Text>
</PageWrapper>
</View>
);
};
const BuggingView = styled.View`
height: 200;
position: absolute;
background-color: blue;
top: 0;
right: 0;
left: 0;
`;
const PageWrapper = styled.View`
background-color: red;
padding: 20px;
/* border-radius: 8px; */
flex: 1;
margin: 20px;
`; The red box text is going front, and the red is missing behind the blue. definitely related to border-radius on 0.61 (was also not working in rc-3) |
Can confirm that it has something to do with borderRadius! |
Yes, indeed the problem is about:
One of those (or all of them) is having issue with android since 0.61.x EDIT: @B27 Elements with borderRadius as if losing their zIndex |
remove borderRadius on button and it will be in the foreground again |
@ScreamZ borderRadius only |
In 0.61.1 it works when applied on a white background |
Same problem here, would be awesome it this problem gets a quick fix |
I'm experiencing this in a few different situations:
This happened when I upgraded to 0.61.1 from 0.60.5. Everything shows up as expected on iOS. |
I am facing this problem and hope to solve it as soon as possible. |
set activeOpacity to 1 on parent TouchableOpacity will fix it. |
just set elevation to 0 |
How does that solve anything? |
I'm also facing this issue on
|
I am having the same issue in "0.61.4" |
just add a |
Unluckily this issue was opened because the elevation did not work with https://github.com/santomegonzalo/react-native-floating-action Everybody with similar issue may have joined this thread instead of reporting a new issue This thread should be closed and you should open a new thread with a minimal reproducible example build with react-native only. Most of the messages in this thread are not relevant for react-native, as they descrive an issue of https://github.com/santomegonzalo/react-native-floating-action open an issue in https://github.com/santomegonzalo/react-native-floating-action Thanks |
could still confirm this issue with "react-native": "0.63.4" |
Hello everyone, please read on renderToHardwareTextureAndroid to resolve this issue |
How is this still being ignored? Its obvious that even in 62+ of react native this is still an issue. |
I also analyzed this bug, here is what I found and how it can be worked around (in some cases) |
I'm still seeing this - here's a really basic snack that reproduces this issue: https://snack.expo.dev/F3qj5M_AM. Run it on Android and see the weird octagons |
Are there any updates on this issue? |
until the bug is resolved, you can use this library |
Also present on 0.64.2. This is easily reproducible with a simple view with elevation + touchable opacity on top. |
can confirm, this problem is present in 0.64.3 as well, all components get this inset shadow effect when a fade transition occurs from react-navigation-bottom-tabs navigator |
So the thing here is that the shadows on a TouchableOpacity child is not displayed properly when it is pressed.
Note: in the second example, if the View is replaced for another TouchableOpacity that it can also call "doSomething", the shadow will automatically be recalculated correctly displaying a neat shadow when pressing but if the user presses on the Text outside area (or anywhere where the child touchable is not covering the parent), shadow will continue to show incorrectly (since the parent TouchableOpacity is doing the calculation of the shadow for the inner child and fails). |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Reproduced the same bug today. If someone still experiencing troubles with And check documentation here. |
Looks like shadow/elevation is broken on android on react-native@0.61.*, see pictures below
It only happens when the https://github.com/santomegonzalo/react-native-floating-action is being used. I'm not able to reproduce it without this.
To receive the expected result uncomment App.js:25-35 and restart react-native using
react-native run-android
.It looks like other packages have this problem aswell, eg callstack/react-native-paper#1341 ,
React Native version:
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 3.25 GB / 15.86 GB
Binaries:
Node: 11.9.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.10.1 - C:\Users\bouwm\AppData\Roaming\npm\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5692245
Steps To Reproduce
npm install
andreact-native run-android
Describe what you expected to happen:
The circle in the middle should look like this:
But it looks like this:
Snack, code example, screenshot, or link to a repository:
Git repo: https://github.com/mikebouwmans/ShadowTest
The text was updated successfully, but these errors were encountered: