question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RectButton's border radius inheriting border radius of other RectButton

See original GitHub issue

I’m using:

React Navigation v5
Gesture Hander v1.6.0
Styled Components v5

I have a home page with many RectButons inside a FlatList with border-radius: 10px

and another page which I can navigate in, with a ScrollView with RectButtons without any border-radius property configured (already tried to set border-radius: 0; but not works)

But the second one “inherits” the border-radius value

First RectButton

import styled from 'styled-components/native';
import { RectButton } from 'react-native-gesture-handler';

export const Page = styled(RectButton)`
  width: 270px;
  padding: 20px;
  margin-right: ${props => (props.last ? '0px' : '20px')};

  border-radius: 10px;
  background: ${colors.white};
`;

Second (other page)

import styled from 'styled-components/native';
import { RectButton } from 'react-native-gesture-handler';

export const Item = styled(RectButton)`
  padding: 10px 0;
`;

When inspecting those elements, both has the correct style properties, but border-radius stills there

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
marcosabbcommented, Jul 13, 2020

Any fix? Same behavior here.

0reactions
topovikcommented, Aug 4, 2022

Found solution, add background-color: any color and border-radius: -1px

import styled from 'styled-components/native';
import { RectButton } from 'react-native-gesture-handler';

export const Item = styled(RectButton)`
  padding: 10px 0;
  background-color: red;
  border-radius: -1px;
`;
Read more comments on GitHub >

github_iconTop Results From Across the Web

border-radius - CSS: Cascading Style Sheets - MDN Web Docs
The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, ......
Read more >
border-radius - CSS-Tricks
]? The border-radius property takes between one and four length or percentage values, where one value sets the radius for all four corners...
Read more >
React Native Border Radius with background color
In React Native, borderRadius is working but the background color given to the button stays a square. What is going on here?
Read more >
It's not possible to set border radius of single corner of ...
Description. I want to set border radius just of top left and bottom right corners of RectButton . To do this, I use...
Read more >
Borders · Bootstrap v5.2
Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found