Skip to content

Commit

Permalink
Merge pull request #2 from GantMan/add_drawer_stacks
Browse files Browse the repository at this point in the history
drawer stacks in place
  • Loading branch information
GantMan authored Aug 27, 2017
2 parents 4354a93 + c1e82a2 commit dab9c8d
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 7 deletions.
4 changes: 1 addition & 3 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export default class App extends React.Component {
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#fff'
},
})
22 changes: 22 additions & 0 deletions Containers/ForgottenPasswordScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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>I am Forgotten Password
</Text>
</View>
)
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
})
24 changes: 23 additions & 1 deletion Containers/LoginScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,25 @@ export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>HIYA!!!!!</Text>
<Text>I am Login Screen</Text>

<Text
style={styles.linky}
onPress={() => this.props.navigation.navigate('signupScreen')} >
Go to Signup
</Text>

<Text
style={styles.linky}
onPress={() => this.props.navigation.navigate('forgottenPasswordScreen')} >
Go to Forgot Password
</Text>

<Text
style={styles.linky}
onPress={() => this.props.navigation.navigate('drawerStack')} >
Pretend we logged in
</Text>
</View>
)
}
Expand All @@ -18,4 +36,8 @@ const styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
},
linky: {
color: 'blue',
paddingTop: 10
}
})
25 changes: 25 additions & 0 deletions Containers/Screen1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import { StyleSheet, Text, View } from 'react-native'

export default class App extends React.Component {
static navigationOptions = {
drawerLabel: 'Screen One'
}

render() {
return (
<View style={styles.container}>
<Text>Screen 1</Text>
</View>
)
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
})
25 changes: 25 additions & 0 deletions Containers/Screen2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import { StyleSheet, Text, View } from 'react-native'

export default class App extends React.Component {
static navigationOptions = {
drawerLabel: 'Screen Two'
}

render() {
return (
<View style={styles.container}>
<Text>Screen2</Text>
</View>
)
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
})
25 changes: 25 additions & 0 deletions Containers/Screen3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import { StyleSheet, Text, View } from 'react-native'

export default class App extends React.Component {
static navigationOptions = {
drawerLabel: 'Screen Three'
}

render() {
return (
<View style={styles.container}>
<Text>Screen3</Text>
</View>
)
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
})
21 changes: 21 additions & 0 deletions Containers/SignupScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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>I am Signup Screen</Text>
</View>
)
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
})
49 changes: 46 additions & 3 deletions Navigation/AppNavigation.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
import { StackNavigator } from 'react-navigation'
import React from 'react'
import { Text } from 'react-native'
import { StackNavigator, DrawerNavigator } from 'react-navigation'
import LoginScreen from '../Containers/LoginScreen'
import SignupScreen from '../Containers/SignupScreen'
import ForgottenPasswordScreen from '../Containers/ForgottenPasswordScreen'
import Screen1 from '../Containers/Screen1'
import Screen2 from '../Containers/Screen2'
import Screen3 from '../Containers/Screen3'

// drawer stack
const DrawerStack = DrawerNavigator({
screen1: { screen: Screen1 },
screen2: { screen: Screen2 },
screen3: { screen: Screen3 },
}, {
gesturesEnabled: false
})

const DrawerNavigation = StackNavigator({
DrawerStack: { screen: DrawerStack }
}, {
headerMode: 'float',
navigationOptions: ({navigation}) => ({
headerStyle: {backgroundColor: 'green'},
title: 'Logged In to your app!',
gesturesEnabled: false,
headerLeft: <Text onPress={() => navigation.navigate('DrawerOpen')}>Menu</Text>
})
})

// login stack
const LoginStack = StackNavigator({
loginScreen: { screen: LoginScreen },
signupScreen: { screen: SignupScreen },
forgottenPasswordScreen: { screen: ForgottenPasswordScreen, navigationOptions: { title: 'Forgot Password' } }
}, {
headerMode: 'float',
navigationOptions: {
headerStyle: {backgroundColor: 'red'},
title: 'You are not logged in'
}
})

// Manifest of possible screens
const PrimaryNav = StackNavigator({
LoginScreen: { screen: LoginScreen }
loginStack: { screen: LoginStack },
drawerStack: { screen: DrawerNavigation }
}, {
// Default config for all screens
headerMode: 'none',
initialRouteName: 'LoginScreen'
title: 'Main',
initialRouteName: 'loginStack'
})

export default PrimaryNav

0 comments on commit dab9c8d

Please sign in to comment.