NativeMaskedView
Supply the mask and content directly to the native masking host.
App.tsx
<NativeMaskedView> <View layout={maskFrame} isUserInteractionEnabled={false} style={{ background: black, cornerRadius: 40 }} /> <Image image={landscape} layout={{ flex: 1 }} /></NativeMaskedView>Photo cutout
NativeMaskedView interprets its first native child as the alpha mask. Each subsequent child supplies content. When composing the host yourself, position the mask over the content and disable touch handling on the mask.
import { NativeMaskedView, Text, View } from 'react-nitro-renderer'
export function RoundLabel() {
return (
<NativeMaskedView layout={{ width: 80, height: 80 }}>
<View
isUserInteractionEnabled={false}
layout={{ position: 'absolute', top: 0, left: 0, width: 80, height: 80 }}
style={{ background: 0x000000ff, cornerRadius: 40 }}
/>
<View layout={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
style={{ background: 0xdce9d5ff }}>
<Text>New</Text>
</View>
</NativeMaskedView>
)
}For ordinary masks, MaskedView sets up the mask layer and its positioning for you. MaskedView