How do you mask a react-native <View /> with any shape? -
it seems components in react-native rectangles or rounded-rectangles (which can represent circle).
how mask <view />
arbitrary shape hexagon?
i came conclusion feature isn't available out of box, implemented native component in objective-c called react-native-masked-view.
the basic idea use mask
property of uiview class:
calayer *mask = [calayer layer]; mask.contents = (id)[_maskuiimage cgimage]; mask.frame = self.bounds; //todo custom: cgrectmake(left, top, width, height); self.layer.mask = mask; self.layer.maskstobounds = yes;
and works in javascript:
<maskedview maskimage="mask.png"> ... </maskedview>
Comments
Post a Comment