Open zibs opened 2 years ago
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.
I have the same problem in Android 11
Still facing this issue
Any update about this one ?
I have same problem when use shadows in my buttons, only android
same here, only Android.
I am trying to use elevation in a view inside the TouchableOpacity:
${st.ifProp( 'shadow',
elevation: 2;
shadow-color: #000000;
shadow-offset: 0px 4px;
shadow-opacity: 0.16;
shadow-radius: 8px;, null )}
Still facing this issue...
This issue only occurs on Android
Yes, can reproduce this issue. Using shadow, elevation and associated shadow styles in a view inside TouchableOpacity results in clipping/cutouts/borders/whatever you can name.
The solution is to remove shadow and associated shadow styles from the view and add these styles to the main TouchableOpacity container.
*For reference only
Before:
<TouchableOpacity style={{ flex: 1 }}>
<View
style={{
shadowColor: "grey",
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.1,
elevation: 4,
borderWidth: 1,
borderRadius: 30
width: 60,
height: 60
}}
>
<Text>Some text</Text>
</View>
<Ionicons
name="circle"
size={30}
style={{
position: "absolute",
alignSelf: 'center',
paddingTop: 20,
}}
/>
</TouchableOpacity>
After:
<TouchableOpacity
style={{
flex: 1,
shadowColor: "grey",
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.1,
elevation: 4,
}}
>
<View
style={{
borderWidth: 1,
borderRadius: 30
width: 60,
height: 60
}}
>
<Text>Some text</Text>
</View>
<Ionicons
name="circle"
size={30}
style={{
position: "absolute",
alignSelf: 'center',
paddingTop: 20,
}}
/>
</TouchableOpacity>
Description
Android's
TouchableOpacity
has weird clipping/octagons when it's used withelevation
and an alpha channel background color i.ergba(hex, hex, hex, 0.5)
. This is reproducible both in an expo snack, and with a newreact-native init
using 0.65 etc.It seems like this issue is partially covered by #26544 - but it's been open for a few years and has diverged perhaps from the original issue. I've posted a follow up comment there: https://github.com/facebook/react-native/issues/26544#issuecomment-904910695
iOS is fine:
Android is not:
React Native version:
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
npx react-native init
)TouchableOpacity
component and give it some elevation and anrgba
background colorExpected Results
I'd hope that we could have the same behaviour iOS has?
Snack, code example, screenshot, or link to a repository:
Here's a Snack Here's a mvce using 0.65