Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save brodeynewman/fbccd68edbd07c7ff31fbe8f2a752453 to your computer and use it in GitHub Desktop.

Select an option

Save brodeynewman/fbccd68edbd07c7ff31fbe8f2a752453 to your computer and use it in GitHub Desktop.
React Native Navigation Component
import React, { Component } from 'react';
import {
Text,
View,
TouchableOpacity
} from 'react-native';
export default class Nav extends Component {
constructor(props) {
super(props)
}
navigateToProp() {
this.props.navigator.push({
id: this.props.menu
});
}
render() {
return (
<View style={styles.nav}>
<TouchableOpacity onPress={this.navigateToProp.bind(this)}>
<Text>
{this.props.menu}
</Text>
</TouchableOpacity>
</View>
);
}
}
// import Nav
import Nav from './location';
// Render component, passing in the menu prop and navigator from Navigator
<Nav menu="About" navigator={this.props.navigator}/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment