Recently I tried a lot to draw a semi-ellipse in react native but I didn't get any good result. Here is what I tried
semiEllipse:{
width: '100%',
height: 50,
borderRadius: 0.7*width,
borderBottomLeftRadius: 0,
borderBottomRightRadius: 0,
backgroundColor: 'red',
}
The above code gives me the following output:
but this is not what I am trying to achieve as you guys can see this is not a pure ellipse.
What I am trying to achieve is half of the following:
Please help me with this. Thanks in advance!
width: 100,
height: 100,
backgroundColor: 'red',
borderRadius: 50,
transform: [
{scaleX: 2}
]
This should give you an oval shape. I would then just do a minus margin and overflow:hidden on the parent.
Related
I am using react native and currently have this css code for the navigator function code
<Tabs.Navigator
screenOptions={{
tabBarScrollEnabled: true,
tabBarShowLabel: false,
tabBarActiveTintColor: 'green',
tabBarStyle: {
backgroundColor: theme.backgroundColor,
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
margin: 50,
maxHeight: 50,
borderRadius: 10,
justifyContent: 'center',
...style.shadow
}
}}
>
How do I style the active blue bar selector. I would ideally just want to change the color. What is the best way to go about this. I have tried using tabBarActiveTintColor with no luck.
What I want styled
Use the tabBarIndicatorStyle: { backgroundColor: 'green' }, to change bar color in version 6 :)
please do this
tabBarOptions={{ tabBarActiveTintColor:'blue' }}
It helps you lots.
Having some styling issues on React Native with Shadows.
I'd like to get a shadow on just the image, which has curved edges (not a square) with the borderradius I've given it. But if I apply a shadow on the parent View, it can't seem to 'follow the edges' of the Image. I'd like for the shadow to be around the curved edges of the Image, not around the square view.
Here is my code:
<View style={[styles.closedcontainer]}>
<Image source={{uri: props.food.url}}
style={styles.smallimage}
/>
</View>
And here is my styling:
const styles = StyleSheet.create({
closedcontainer: {
height: 100,
width: 100,
flexDirection: 'row',
flexWrap: 'wrap',
paddingLeft: 50,
paddingRight: 50,
paddingBottom: 0,
paddingTop: 0,
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#fff9f9',
shadowColor: 'black',
shadowOffset: {width: 2, height: 5},
shadowOpacity: .30,
shadowRadius: 5,
// overflow: 'hidden'
},
smallimage: {
height: 100,
width: 100,
borderRadius: 30,
borderColor: "#f97070",
borderWidth: 2.75,
margin: 10,
backgroundColor: 'white',
resizeMode: 'contain'
}
I thought perhaps adding overflow hidden to the parent View's styling (closedcontainer) would do it, but that gets hides the whole shadow altogether.
Any ideas? Thanks!
UPDATE: per suggestion, tried setting the borderRadius directly in the , unfortunately still no luck.
Try setting borderRadius directly as a prop on the image instead using it as a style.
<Image borderRadius={25}/>
Or similar
I am looking for some styling guidance for React-Native. I am wanting to create a border that only has a certain amount of the corners colored. Something like this:
I currently have this:
captureSquare: {
height: 450,
width: 450,
borderWidth: 2,
borderColor: '#FFFFFF,
backgroundColor: 'transparent',
justifyContent: 'center',
alignItems: 'center',
},
I am not sure how to break up the borders. Any ideas?
Was able to do this by adding 4 <View />s to the captureSqaure and giving them the following properties:
topLeftEdge: {
position: 'absolute',
top: 0,
left: 0,
height: 25,
width: 25,
borderColor: '#FFFFFF,
borderLeftWidth: 3,
borderTopWidth: 3,
},
I have this CSS :
shadowColor: '#444',
shadowOffset: { width: 5, height: 5 },
shadowOpacity: 0.2,
shadowRadius: 8,
backgroundColor: 'white',
borderRadius: 10,
I'd like to replicate this style on Sketch.
But it uses 'Blur' and 'Spread' property for the shadow.
And i've noticed it uses box-shadow if you try to do it manually.
My question is :
I have this CSS styling. How could i apply it to my Shape.
(with or without plugin)
Sketch Version 47.1
For me, the style that you have would be translated like this in sketch app :
shadowColor: '#444', // Color #444
shadowOffset: { width: 5, height: 5 }, // X & Y offset to 5px
shadowOpacity: 0.2, // Opacity 20 (the A in HSBA)
shadowRadius: 8, // Look like it's the Blur
backgroundColor: 'white', // Bg color of the shape
borderRadius: 10, // Border radius of the shape
It is what you need ?
PS : This is not some CSS syntax that you have in your code.
I have a view with an icon (from react-native-vector-icons) inside as following:
return (
<View style={styles.iconContainerStyle}>
<Icon name='menu' size={23} style={styles.iconStyle} />
</View>
);
The following is the styling for both the components:
const styles = {
iconContainerStyle: {
justifyContent: 'center',
alignItems: 'center',
height: 30,
width: 35,
borderRadius: 5,
backgroundColor: '#ffffff',
padding: 2
},
iconStyle: {
color: '#2279b4',
}
};
The weird part is that the border radius prop of 5 should give evenly rounded borders, but this is what I get:
Notice that on the right hand side, the borders are sharper then the left part!
I even tried with different borderRaduis values, its still the same concept.
The header you see is provided by react-native-router-flex for my scenes, I think this is also a factor as their styles are also applied on the hamburger button.
A work around (temporarily) is by supplying another parent view with he following style:
<View style={{ justifyContent: 'center', alignItems: 'center', height: 35, width: 40, }}>
The height and width need to be a value bigger then that of the iconContainer.
Please add border: 1px solid #f00; to your code to see if toggle icon is not hidden behind something.
If it looks fine, try to add seperate radius to each angle, Like:
border-top-left-radius: 5px;
border-top-right-radius: 5px;
and so on. Also, try to use border-radius styles with !important.