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.
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.
applied background color getting overflow out of the border on android
<CardView
style={{
borderWidth: 0.25,
borderColor: colors.secondary400,
backgroundColor: "red",
...shadows.shadowDefault,
shadowOffset: item.shadowOffset,
shadowColor: item.shadowColor,
shadowOpacity: item.shadowOpacity,
shadowOpacity: 0.32,
shadowRadius: spacing.SCALE_05,
shadowColor: Colors.black,
overflow: "hidden",
}}
>
Increase border-radius to 0.5 or 1
Try adding resize mode : 'contain' to your cardView style
This is because of border-width
Please remove border-width from this or provide in px it will fix your issue
My View's shadow not covering all the outside but just the top and the bottom:
Here is the style:
root: {
borderRadius: 20,
elevation: 5,
paddingTop: 22,
paddingHorizontal: 20,
paddingBottom: 20,
marginTop: 16,
borderWidth: 0,
backgroundColor: '#ffffff',
}
How can I make the shadow to cover all the View?
You should give marginHorizonal in your root style.
I'm in need of applying a box shadow to one of my buttons in my react native application but box shadow property is not supported in android. So i'm trying to create a shadow view from LinearGradient and place the button at center of that view. Something like this
<LinearGradient
colors={['transparent', backgroundColor]}
start={{ x: 0.5, y: 0.5 }}
end={{ x: 1, y: 1 }}
style={{
width: '100%',
padding: 5,
height: 60,
justifyContent: 'center',
alignItems: 'flex-start',
marginTop: 0,
borderRadius: 2,
backgroundColor: 'transparent',
zIndex: 2,
bottom: 0,
}}>
<Pressable
onPress={onPress}
disabled={disabled}
style={({ pressed }) => [
{
borderWidth: state === 'primary_link' ? 0 : pressed ? 4 : borderWidth,
},
styles.background,
]}>
<ButtonTitle />
</Pressable>
</LinearGradient>
I tried changing the start and end values but could not get it to start from the center. Is there a way to do this using LinearGradient? I'm trying to get something like this
As the name implies, LinearGradient is for linear gradients only. What you described is a radial gradient. See this issue: https://github.com/react-native-linear-gradient/react-native-linear-gradient/issues/29
You may have box shadows as described here: Creating a UI with box shadow in react native
boxWithShadow: {
shadowColor: '#000',
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.8,
shadowRadius: 2,
elevation: 5
}
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