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

Touchable doesn't work with position: absolute

$
0
0

I can't figure out how to make my component touchable. I have one wrapper which has position: relative and two elements with position: absolute. I would like to make this wrapper touchable but it doesn't work with any Touchable component from react-native.

This backgroundColor is just for testing.

<View style={styles.container}><TouchableHighlight onPress={() => { console.log('touched') }}><View style={styles.wrapper}><View style={styles.wrapperForImage} /><Text style={styles.text} >{text.toUpperCase()}</Text></View></TouchableHighlight></View>const styles = StyleSheet.create({   container: {   flex: 1,   alignItems: 'center',   justifyContent: 'center' }, wrapper: {   position: 'relative',   flex: 1,   alignItems: 'center',   justifyContent: 'center' }, wrapperForImage: {   position: 'absolute',   width: 200,   height: 200,   backgroundColor: 'red' }, text: {   position: 'absolute',   width: 100,   height: 100,   zIndex: 10,   textAlign: 'center',   color: '#000',   fontSize: 14,   lineHeight: 23 }

});

Dependencies:

"dependencies": {"expo": "^31.0.0","react": "16.5.0","react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz","react-native-extended-stylesheet": "^0.10.0","tslib": "^1.9.3" }

Viewing all articles
Browse latest Browse all 29791

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>