On android when I apply a border radius to a scroll view the inner container ignores the outer border radius and I can't figure out how to make it conform. This is on Pixel 2 simulator, the red dotted lines show the underlying border radius and where the overlap is. The code is just a standard scrollview I made to double check it happens on the simplest scrollview implementation which it does.
<ScrollView
contentContainerStyle={{
alignItems: 'center',
justifyContent: 'space-between',
}}
style={{
padding: 20,
backgroundColor: 'green',
borderTopLeftRadius: 45,
borderTopRightRadius: 45,
}}>
<View
style={{
width: '100%',
height: 400,
borderRadius: 20,
backgroundColor: 'red',
}}
/>
<View
style={{
width: '100%',
height: 400,
borderRadius: 20,
backgroundColor: 'red',
}}
/>
<View
style={{
width: '100%',
height: 400,
borderRadius: 20,
backgroundColor: 'red',
}}
/>
<View
style={{
width: '100%',
height: 400,
borderRadius: 20,
backgroundColor: 'red',
}}
/>
</ScrollView>
React Native ScrollView. The ScrollView is a generic scrollable container, which scrolls multiple child components and views inside it. In the ScrollView, we can scroll the components in both direction vertically and horizontally. By default, the ScrollView container scrolls its components and views in vertical.
The children overlap the border radius when scrolling On android when I apply a border radius to a scroll view the inner container ignores the outer border radius and I can't figure out how to make it conform. This is on Pixel 2 simulator, the red dotted lines show the underlying border radius and where the overlap is.
In the ScrollView, we can scroll the components in both direction vertically and horizontally. By default, the ScrollView container scrolls its components and views in vertical. To scroll its components in horizontal, it uses the props horizontal: true (default, horizontal: false).
When true, the scroll view stops on the next index (in relation to scroll position at release) regardless of how fast the gesture is. This can be used for pagination when the page is less than the width of the horizontal ScrollView or the height of the vertical ScrollView.
Just wrap Scrollview with View and set overflow: 'hidden'
, structure your views like bellow code. It will force all children views to hidden
if overflow.
<View
style={{
borderRadius: 45l
overflow: 'hidden',
}}
>
// ->> Put your scrollview in here
<Scrollview>
{...children}
</Scrollview>
</View>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With