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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -