Skip to content

Instantly share code, notes, and snippets.

@B3rry
Created August 22, 2018 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save B3rry/43692b208fe610208af86b5e036b7cae to your computer and use it in GitHub Desktop.
Save B3rry/43692b208fe610208af86b5e036b7cae to your computer and use it in GitHub Desktop.
RN Accessible Keyboard Events
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