Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions ios/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
7488E33E30EE415291BA5EC2 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B57157CDA44A47A08A7262CC /* MaterialIcons.ttf */; };
B28129E0C77A49E0BC0EB0E7 /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A3FA33E014E348BAB0EF2341 /* Octicons.ttf */; };
C3BF0830856B4081B1B765C4 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 4215E041E3724038988B91EC /* Zocial.ttf */; };
59D0B2F60F324C4C8DD35CFA /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 12374597394B4924847C203E /* Entypo.ttf */; };
603BBF17B2344039B38CE2CF /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 48B6DE8925774B5F8C56500D /* EvilIcons.ttf */; };
ADA72D3C74524C948C8982C6 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 047B4B159BBB4F25A0148FBB /* FontAwesome.ttf */; };
28132C81FA454DC6A12664DA /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F42044CD99184BA89321FB44 /* Foundation.ttf */; };
1544752BB45144F09A3F3AA5 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E96734634E6743E5A2947F0B /* Ionicons.ttf */; };
8D75A5047CB841B2A0B311A2 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8D31C08529F84506964B2DC0 /* MaterialIcons.ttf */; };
CAC3A2DCBFB84BEF87F766AA /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CDE7865F23AA415A98F0A0AA /* Octicons.ttf */; };
4133A1E3125748F195EDD7BB /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = BDF036C851D742D0A2F0FECA /* Zocial.ttf */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -145,6 +153,14 @@
B57157CDA44A47A08A7262CC /* MaterialIcons.ttf */ = {isa = PBXFileReference; name = "MaterialIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
A3FA33E014E348BAB0EF2341 /* Octicons.ttf */ = {isa = PBXFileReference; name = "Octicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
4215E041E3724038988B91EC /* Zocial.ttf */ = {isa = PBXFileReference; name = "Zocial.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
12374597394B4924847C203E /* Entypo.ttf */ = {isa = PBXFileReference; name = "Entypo.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
48B6DE8925774B5F8C56500D /* EvilIcons.ttf */ = {isa = PBXFileReference; name = "EvilIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
047B4B159BBB4F25A0148FBB /* FontAwesome.ttf */ = {isa = PBXFileReference; name = "FontAwesome.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
F42044CD99184BA89321FB44 /* Foundation.ttf */ = {isa = PBXFileReference; name = "Foundation.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Foundation.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
E96734634E6743E5A2947F0B /* Ionicons.ttf */ = {isa = PBXFileReference; name = "Ionicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
8D31C08529F84506964B2DC0 /* MaterialIcons.ttf */ = {isa = PBXFileReference; name = "MaterialIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
CDE7865F23AA415A98F0A0AA /* Octicons.ttf */ = {isa = PBXFileReference; name = "Octicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
BDF036C851D742D0A2F0FECA /* Zocial.ttf */ = {isa = PBXFileReference; name = "Zocial.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -338,6 +354,14 @@
B57157CDA44A47A08A7262CC /* MaterialIcons.ttf */,
A3FA33E014E348BAB0EF2341 /* Octicons.ttf */,
4215E041E3724038988B91EC /* Zocial.ttf */,
12374597394B4924847C203E /* Entypo.ttf */,
48B6DE8925774B5F8C56500D /* EvilIcons.ttf */,
047B4B159BBB4F25A0148FBB /* FontAwesome.ttf */,
F42044CD99184BA89321FB44 /* Foundation.ttf */,
E96734634E6743E5A2947F0B /* Ionicons.ttf */,
8D31C08529F84506964B2DC0 /* MaterialIcons.ttf */,
CDE7865F23AA415A98F0A0AA /* Octicons.ttf */,
BDF036C851D742D0A2F0FECA /* Zocial.ttf */,
);
name = Resources;
path = "";
Expand Down Expand Up @@ -553,6 +577,14 @@
7488E33E30EE415291BA5EC2 /* MaterialIcons.ttf in Resources */,
B28129E0C77A49E0BC0EB0E7 /* Octicons.ttf in Resources */,
C3BF0830856B4081B1B765C4 /* Zocial.ttf in Resources */,
59D0B2F60F324C4C8DD35CFA /* Entypo.ttf in Resources */,
603BBF17B2344039B38CE2CF /* EvilIcons.ttf in Resources */,
ADA72D3C74524C948C8982C6 /* FontAwesome.ttf in Resources */,
28132C81FA454DC6A12664DA /* Foundation.ttf in Resources */,
1544752BB45144F09A3F3AA5 /* Ionicons.ttf in Resources */,
8D75A5047CB841B2A0B311A2 /* MaterialIcons.ttf in Resources */,
CAC3A2DCBFB84BEF87F766AA /* Octicons.ttf in Resources */,
4133A1E3125748F195EDD7BB /* Zocial.ttf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
8 changes: 8 additions & 0 deletions ios/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>Zocial.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>FontAwesome.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>Zocial.ttf</string>
</array>
</dict>
</plist>
128 changes: 126 additions & 2 deletions src/components/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,143 @@
* This screen handles registration for a new user on the app.
* After the user signs up successfully, it'll redirect them to the Dashboard.
**/
import React, {View, StyleSheet, Text, Alert,BackAndroid} from 'react-native';

import React, {View, Text, BackAndroid} from 'react-native';
import API from '../lib/API';
import RPButton from './RPButton'
import RPLink from './RPLink'
import RPRouter from '../lib/RPRouter';
import RPStorage from '../lib/RPStorage';
import RPTextInput from './RPTextInput'
import {COLORS} from '../constants/Colors';

class Register extends React.Component {
constructor(props) {
super(props)
this.state = {
email: '',
password: '',
isLoading: false
}
}
async requestSignup() {
this.setState({ isLoading: true });
try {
let request = await API.register({
email: this.state.email,
password: this.state.password
});
if (request.response.status === 200 ) {
await RPStorage.setUserSession(request.body);
this.props.navigator.push(RPRouter.getHomeRoute());
return;
}
this.setState({
error: request.body,
isLoading: false
});
}
catch (error) {
Alert.alert('Signup Error', 'Error')
this.setState({
error: 'Could not reach the server.',
isLoading: false
});
throw error;
}
}
handleOnLoginTextChanged(textValue) {
this.setState({ email: textValue })
}
handleOnPasswordTextChanged(textValue) {
this.setState({ password: textValue })
}
handlePressLogin() {
this.requestSignup();
}
handlePressGoBack() {
this.props.navigator.pop();
}
render() {
let errorText = null;
if (this.state.error) {
errorText = <Text style={styles.error}>{this.state.error}</Text>
}

return (
<Text>Hello World!</Text>
<View style={styles.container}>
{errorText}
<RPTextInput
placeholder={'Email Address'}
style={styles.textInput}
onChangeText={this.handleOnLoginTextChanged.bind(this)}
value={this.state.email}
/>
<RPTextInput
placeholder={'Password'}
secureTextEntry={true}
style={styles.textInput}
onChangeText={this.handleOnPasswordTextChanged.bind(this)}
value={this.state.password}
/>
<View style={styles.loginButtons}>
<RPButton
style={[styles.loginButton, styles.loginButtonLeft]}
onPress={this.handlePressLogin.bind(this)}
disabled={this.state.isLoading}>
Sign Up!
</RPButton>
<RPButton
style={[styles.loginButton, styles.loginButtonRight]}
color={COLORS.BLUE}
disabled={this.state.isLoading}>
<Text style={{color: COLORS.WHITE}}>
Facebook
</Text>
</RPButton>
</View>
<RPLink onPress={this.handlePressGoBack.bind(this)}>Go Back</RPLink>
</View>
);
}
}

let styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: COLORS.BASE
},
textInput: {
width: 260,
alignSelf: 'center',
borderBottomWidth: 1,
borderColor: COLORS.GRAY,
marginBottom: 8,
color: COLORS.LIGHT_GRAY,
padding: 8
},
error: {
width: 260,
padding: 8,
marginBottom: 8,
backgroundColor: COLORS.RED,
color: COLORS.WHITE
},
loginButtons: {
flexDirection: 'row',
marginBottom: 12
},
loginButton: {
width: 125
},
loginButtonLeft: {
marginRight: 10
},
loginButtonRight: {
}
});

export default Register;
module.exports = Register;
8 changes: 8 additions & 0 deletions src/lib/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ export default API = {
})
});
},
register(data) {
return api.post('/sessions/sign_up', {
body: JSON.stringify({
email: data.email,
password: data.password
})
});
},
getUserRaps(params) {
path = '/raps?' + qs.stringify(params, { encode: false });
return api.get(path);
Expand Down