Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28468

React Native android: An absolute positioned, touchable element outside of the bounds of its parent is not clickable

$
0
0

I have a TouchableOpacity inside of a view. The view is small (height: 60) and the TouchableOpacity lies outside the bounds of its parent (position: absolute, top: 70). When the child is inside of the parent, i.e. top: 30, it's clickable, but when it's outside, it's not. And only the regions inside of the parent view are clickable (touch events pass through the regions out of bounds). Does anyone know of a way to register TouchableOpacity clicks even when it's outside the bounds of its parent?

Note that this works on iOS. It seems to only be a bug on android.

<View style={{height: 60, width: '100%', zIndex: 1}}>
    <TouchableOpacity onPress={() => console.log('pressed')} style={{position: 'absolute', zIndex: 2, backgroundColor: 'yellow', width: 100, height: 50, top: 70}} />
</View>

Viewing all articles
Browse latest Browse all 28468

Trending Articles