Borderradius Style Property Not Rounding The Edges in Reactjs

giving border radius to ant-design card in react

Adding overflow:hidden with borderRadius to the card style will fix the issue of the actions container's corners not being round.

<Card
style={{
width: 300,
margin: "20px",
borderRadius: "20px",
overflow: "hidden"
}}
actions={[
<h4 style={{ paddingTop: "6px" }} key="Name">
Table Name{" "}
</h4>
]}
>
<p>Card content</p>
<p>Card content</p>
<p>Card content</p>
</Card>

Edit antd reproduction template (forked)

border-radius not working

To whomever may have this issue. My problem was border-collapse. It was set to:

border-collapse: collapse;

I set it to:

border-collapse: separate; 

and it fixed the issue.

This code should change the border-radius with React hooks. Why doesn't it work?

The style config shoule be :

style={{ borderRadius: radius }}

or

function ShapeChangerButton() {
const [radius, setRadius] = useState("0px");

function changeShape() {
if (radius === "0px") {
setRadius((radius) => "30px");
} else {
setRadius((radius) => "0px");
}
}

return (
<div>
<button
className="standardBtn"
style={{ borderRadius: radius }}
onClick={changeShape}
>
change shape
</button>
</div>
);
}

How to use border radius only for 1 corner (react-native)?

Did you already try with the following?

- borderBottomLeftRadius: number

- borderBottomRightRadius: number

- borderTopLeftRadius: number

- borderTopRightRadius: number

Also, you can find more info in the view component docs.

React Native Border Radius with background color

Try moving the button styling to the TouchableHighlight itself:

Styles:

submit: {
marginRight: 40,
marginLeft: 40,
marginTop: 10,
paddingTop: 20,
paddingBottom: 20,
backgroundColor: '#68a0cf',
borderRadius: 10,
borderWidth: 1,
borderColor: '#fff',
},
submitText: {
color: '#fff',
textAlign: 'center',
}

Button (same):

<TouchableHighlight
style={styles.submit}
onPress={() => this.submitSuggestion(this.props)}
underlayColor='#fff'>
<Text style={[this.getFontSize(),styles.submitText]}>Submit</Text>
</TouchableHighlight>

Sample Image



Related Topics



Leave a reply



Submit