Skip to content

Instantly share code, notes, and snippets.

@ibrahimcanbaz
Last active December 9, 2017 19:00
Show Gist options
  • Save ibrahimcanbaz/04a9928e5187bb47835c03557d4bf626 to your computer and use it in GitHub Desktop.
Save ibrahimcanbaz/04a9928e5187bb47835c03557d4bf626 to your computer and use it in GitHub Desktop.
Navigation App
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
import React from 'react';
import { StyleSheet, Text,View ,TouchableOpacity} from 'react-native';
import {FontAwesome} from '@expo/vector-icons';
const Drawer = (props) => (
<View style={styles.container}>
<View>
<Text style={[styles.text,{fontSize:30,textDecorationLine:'underline'}]}>MENU</Text>
<Text onPress={()=>{
//This is workaround to prevent loading first screen ever and over
const { state } = props.navigation;
if (state.routes[0].routes[state.routes[0].routes.length-1].routeName=='First'){
return null
}
//End of workaround
props.navigation.navigate('First')}} style={styles.text}>Go to First</Text>
<Text onPress={()=>props.navigation.navigate('Second')} style={styles.text}>Go to Second</Text>
<Text onPress={()=>props.navigation.navigate('Third')} style={styles.text}>Go to Third</Text>
</View>
</View>
)
const styles = StyleSheet.create({
container: {
flex:1,
backgroundColor: 'rgb(103, 235, 148)',
justifyContent:'center',
alignItems:'center',
paddingTop:50,
},
text: {
fontSize: 24,
fontWeight: 'bold',
color: 'rgb(43, 167, 85)'
}
})
export default Drawer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment