Skip to content

Commit

Permalink
added react-navigation to mobile app
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinFrazier committed Oct 22, 2019
1 parent d616acd commit 285e788
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 6 deletions.
40 changes: 34 additions & 6 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
import React from 'react';
import React, {Component} from 'react';
import {StyleSheet, Text, View } from 'react-native';
import {credentials} from './src/config';
import {createAppContainer, createSwitchNavigator} from "react-navigation";
import {createStackNavigator} from 'react-navigation-stack';

export default function App() {
import Feed from './src/components/Feed'
import Main from './src/components/Main'

credentials(); //firebase api key config

return (
const AppStack = createStackNavigator({

FeedRoute: Feed,
MainRoute: Main


})

export default createAppContainer(createSwitchNavigator({

App: AppStack
}));

/*
export default class App extends Component{
constructor (){
//super()
credentials(); //firebase api key config
}
render(){
return (
<View style={styles.container}>
<Text>updated 7</Text>
</View>
);
);
}
}
*/

const styles = StyleSheet.create({
container: {
flex: 1,
Expand Down
6 changes: 6 additions & 0 deletions database.rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rules": {
".read": true,
".write": true
}
}
20 changes: 20 additions & 0 deletions src/components/Feed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, {Component} from 'react';
import {View, Text, Button} from 'react-native';

import{styles} from '../styles/styles';

export default class Feed extends Component{

render(){

return(
<View style={styles.center}>
<Text> This is the feed</Text>
<Button title = 'Go to Main Menu'
onPress = {()=> this.props.navigation.navigate('MainRoute')} />
</View>

)
}

}
19 changes: 19 additions & 0 deletions src/components/Main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React, {Component} from 'react';
import {View, Text, Button} from 'react-native';

import{styles} from '../styles/styles';

export default class Main extends Component{

render(){

return(
<View style={styles.center}>
<Text> Main Menu </Text>
<Button title = 'Go to Feed' onPress = {()=> this.props.navigation.navigate('FeedRoute')} />
</View>

)
}

}
11 changes: 11 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {StyleSheet, Text, View } from 'react-native';

export const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});

0 comments on commit 285e788

Please sign in to comment.