Masked images do not render on Android
See original GitHub issueI’m using the react-native-figma-squircle package alongside this package, for whatever reason the following code renders nothing of the underlying image at all on Android, however it works perfectly fine on iOS:
type Props = { uri: string; size: number; style?: ViewStyle };
function PerkLogo({ uri, size, style }: Props) {
const dimensionsStyle = { width: size, height: size };
return (
<View style={[styles.imageContainer, dimensionsStyle, style]}>
<MaskedView
// style={[mainStyles.overflowHidden]}
maskElement={
<SquircleView
style={StyleSheet.absoluteFill}
squircleParams={{
cornerSmoothing: 1,
fillColor: colors.white,
cornerRadius: 30,
}}
/>
}>
<Image source={{ uri: CDN(uri) }} style={[styles.image, dimensionsStyle]} />
</MaskedView>
</View>
);
}
const styles = StyleSheet.create({
imageContainer: {
// backgroundColor: '#fff',
borderRadius: defaultBorderRadius,
overflow: 'hidden',
},
image: {
...mainStyles.imageBorderRadius,
resizeMode: 'contain',
},
});
react-native: 0.63.3 react-native-masked-view: 0.2.5 react-native-figma-squircle: 0.1.2
I’ve wasted hours on this between forcing a re-render using a key
prop on MaskedView
to changing all the styles of every element in this code. Every once in a while randomly the image shows up when I navigate away from the screen using this component. Otherwise it seems to be completely broken on Android.
Any suggestions? Is this a known bug on Android with image masking?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:7
Top Results From Across the Web
Image as a mask for another image not rendering on Android
Trying to apply some image shape masking using .png image. Everything works as expected on iOS, but android doesn't render anything, just empty....
Read more >Android Image Masking not rendering as intended
UPDate : I tried the mask Image from the blog post with my own JPEG . IT works perfect so the issue is...
Read more >Masking Bitmaps. The problem of image masking often…
The problem of image masking often comes up in Android development. Rounded image corners or rounded images are required most of all.
Read more >CSS image mask only works on Firefox for Android - Reddit
I've been trying to apply an image mask to a div, but it only seems to be working on a single browser: Firefox...
Read more >-webkit-mask-box-image - CSS: Cascading Style Sheets | MDN
Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have you tried applying the prop
androidRenderingMode
introduced in this PRthanks @lyubo-and it looks like its working for me!