Created
August 22, 2018 00:03
-
-
Save B3rry/43692b208fe610208af86b5e036b7cae to your computer and use it in GitHub Desktop.
RN Accessible Keyboard Events
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 } from 'react-native'; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {totalCount: 0}; | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<TouchableOpacity | |
onPress={ | |
() => this.setState({totalCount: this.state.totalCount + 1 }) | |
} | |
accessible> | |
<Text>I am touchable</Text> | |
</TouchableOpacity> | |
<Text>Clicked</Text> | |
<Text>{this.state.totalCount} times</Text> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: '#fff', | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment