Skip to content

Commit

Permalink
Merge pull request #34 from urbantumbleweed/mobile-navigation
Browse files Browse the repository at this point in the history
Mobile navigation
  • Loading branch information
rebeccaryang committed Jan 26, 2016
2 parents cc7284e + ad6540b commit dad5219
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ node_modules/
bower_components/

keys.sh
Client/ios/Lantern.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ var {
} = FBSDKCore;

var Login = React.createClass({
componentDidMount: function() {
FBSDKAccessToken.getCurrentAccessToken((result) => {
if (result) {
this.props.navigator.push({name: 'home'});
}
})
},

render: function() {
return (
<View style={this.props.style}>
Expand All @@ -40,14 +48,13 @@ var Login = React.createClass({
if (result.isCancelled) {
alert('Login cancelled.');
} else {
alert('Logged in.');
console.log('logging result',result);
this.props.navigator.push({ name: 'home'})
}
}
{/*calling function again to get acess token after log in*/}
FBSDKAccessToken.getCurrentAccessToken((data) => {
console.log('data',data);
});
console.log('data',data);
});
}
}

Expand Down
29 changes: 29 additions & 0 deletions Client/Src/Facebook/Signin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

var React = require('react-native');
var {
StyleSheet,
Text,
View,
} = React;

var Login = require('./Login-button');

/**
* A sample app that demonstrates use of the FBSDK login button, native share dialog, and graph requests.
*/
var Signin = React.createClass({
render: function() {
return (
<View style={styles.container} >
<Text style={styles.text} >We dont need no stinking image background yet!!</Text>
<Login navigator={this.props.navigator} style={styles.loginContainer}/>
</View>
);
}
});

// importing styles
var styles = StyleSheet.create(require('../styles.js'));

module.exports = Signin;
26 changes: 26 additions & 0 deletions Client/Src/Home/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

var React = require('react-native');
var {
StyleSheet,
Text,
View,
} = React;

/**
* A sample app that demonstrates use of the FBSDK login button, native share dialog, and graph requests.
*/
var Home = React.createClass({
render: function() {
return (
<View style={styles.container} >
<Text style={styles.text} > let me do it as it would be on the home screen</Text>
</View>
);
}
});

// importing styles
var styles = StyleSheet.create(require('../styles.js'));

module.exports = Home;
31 changes: 19 additions & 12 deletions Client/Src/main.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
Image,
Navigator
} = React;

var Login = require('./Facebook/Login');
var Signin = require('./Facebook/Signin');
var Home = require('./Home/Home');

var ROUTES = {
signin: Signin,
home: Home
};

/**
* A sample app that demonstrates use of the FBSDK login button, native share dialog, and graph requests.
*/
var Main = React.createClass({
renderScene: function(route, navigator){
var Component = ROUTES[route.name];
return <Component route={route} navigator={navigator}/>;
},
render: function() {
return (
<View style={styles.container}>
<View style={styles.textContainer}>
<Text style={styles.text}>We dont need no stinking image background yet!!</Text>
</View>
{/*this is the log in button*/}
<Login style={styles.loginContainer}/>
</View>
<Navigator
style={styles.navigator}
initialRoute={{name: 'signin'}}
renderScene={this.renderScene}
configureScene={() => {
return Navigator.SceneConfigs.FloatFromRight; }}
/>
);
}
});
Expand Down
7 changes: 5 additions & 2 deletions Client/Src/styles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


'use strict';

module.exports = {
Expand All @@ -9,6 +7,10 @@ module.exports = {
alignItems: 'center',
},

navigator: {
flex: 1
},

textContainer: {
alignItems: 'center',
justifyContent: 'center',
Expand All @@ -28,6 +30,7 @@ module.exports = {
shadowColor: '#000000',
shadowOpacity: 1,
shadowOffset: {width: 0, height: 0},
borderRadius: 10
},

text: {
Expand Down
6 changes: 1 addition & 5 deletions Client/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
Image,
AppRegistry
} = React;

var Main = require('./Src/main');
Expand Down
2 changes: 1 addition & 1 deletion Client/ios/Lantern.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = P6SKWH9N8E;
DevelopmentTeam = EGN2S7YVJH;
SystemCapabilities = {
com.apple.Maps.iOS = {
enabled = 1;
Expand Down

0 comments on commit dad5219

Please sign in to comment.