Skip to content

Instantly share code, notes, and snippets.

@mastermoo
Created October 31, 2016 18:02
Show Gist options
  • Save mastermoo/e2c8c38a66be58b35fd0aa67c5da53f6 to your computer and use it in GitHub Desktop.
Save mastermoo/e2c8c38a66be58b35fd0aa67c5da53f6 to your computer and use it in GitHub Desktop.
react native flicker bug using touchableopacity
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