Created
October 31, 2016 18:02
-
-
Save mastermoo/e2c8c38a66be58b35fd0aa67c5da53f6 to your computer and use it in GitHub Desktop.
react native flicker bug using touchableopacity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { StyleSheet, Text, View, TouchableOpacity, Dimensions } from 'react-native'; | |
const { width, height } = Dimensions.get('window'); | |
export default class extends React.Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<TouchableOpacity | |
activeOpacity={0.9} | |
onPress={() => {}} | |
style={styles.card} | |
> | |
<Text>Special Card</Text> | |
</TouchableOpacity> | |
</View> | |
) | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
backgroundColor: 'black', | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
}, | |
card: { | |
padding: 5, | |
width: width - 30, | |
height: width - 30, | |
borderRadius: 6, | |
backgroundColor: 'tomato', | |
justifyContent: 'center', | |
alignItems: 'center', | |
margin: 15, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment