React Native show vertically overflowing items in a horizontal ScrollView

473 Views Asked by At

When I have a simple View with another View inside it that has a higher height, it looks like this:

<View horizontal={true} style={{height: 100, width: 100, backgroundColor: "red"}}>
    <View style={{height: 150, width: 50, backgroundColor: "blue"}}></View>
</View>

A View being shown that is higher than its parent View

In other words, I can see the 50px of the blue View that overflow the red one.

When I change the parent View into a horizontal ScrollView however, the overflowing 50px of the blue one are clipped, like this:

<ScrollView horizontal={true} contentContainerStyle={{height: 100, width: 100, backgroundColor: "red"}}>
    <View style={{height: 150, width: 50, backgroundColor: "blue"}}></View>
</ScrollView>

A view that is higher than its parent horizontal ScrollView and therefore being clipped

I want the ScrollView to not clip the overflowing blue part of its child. How do I do this?

I already tried adding overflow: "visible" to the styles, but that didn't work.

0

There are 0 best solutions below