Skip to content

Instantly share code, notes, and snippets.

View youneshenniwrites's full-sized avatar
🎯
Focusing

Younes Henni youneshenniwrites

🎯
Focusing
View GitHub Profile
@youneshenniwrites
youneshenniwrites / ForgetPasswordAWS.js
Last active January 19, 2019 13:37
forget password methods with AWS Amplify Auth
// Request a new password
async forgotPassword() {
const { username } = this.state
await Auth.forgotPassword(username)
.then(data => console.log('New code sent', data))
.catch(err => {
if (! err.message) {
console.log('Error while setting up the new password: ', err)
Alert.alert('Error while setting up the new password: ', err)
} else {
@youneshenniwrites
youneshenniwrites / SignUpAWSAmplify.js
Last active January 19, 2019 10:53
Sign up methods with AWS Amplify Auth
// Sign up user with AWS Amplify Auth
async signUp() {
const { username, password, email, phoneNumber } = this.state
// rename variable to conform with Amplify Auth field phone attribute
const phone_number = phoneNumber
await Auth.signUp({
username,
password,
attributes: { email, phone_number }
})
@youneshenniwrites
youneshenniwrites / AppTabNavigator.js
Created January 15, 2019 11:39
Tabs design in the Auth stack of RNAuthAWS
// Configurations and options for the AppTabNavigator
const configurations = {
Home: {
screen: HomeScreen,
navigationOptions: {
tabBarLabel: 'Home',
tabBarIcon: ({ tintColor }) => (
<Icon name="ios-home" style={{fontSize: 26, color: tintColor}} />
)
}
@youneshenniwrites
youneshenniwrites / SettingsScreen.js
Last active January 14, 2019 09:04
Settings screen layout for RNAuthAWS
export default class SettingsScreen extends React.Component {
// ... same code above this line
render() {
return (
<SafeAreaView style={styles.container}>
<StatusBar/>
<KeyboardAvoidingView style={styles.container} behavior='padding' enabled>
<TouchableWithoutFeedback style={styles.container} onPress={Keyboard.dismiss}>
<View style={styles.container}>
{/*Infos*/}
@youneshenniwrites
youneshenniwrites / ForgetPassword.js
Last active January 14, 2019 11:29
layout of the forget password in RNAuthAWS
export default class ForgetPasswordScreen extends React.Component {
// ...same code above
render() {
return (
<SafeAreaView style={styles.container}>
<StatusBar/>
<KeyboardAvoidingView
style={styles.container}
behavior='padding'
enabled
@youneshenniwrites
youneshenniwrites / SignUpScreen.js
Last active January 13, 2019 16:32
Sign up screen layout for RNAuthAWS
export default class SignUpScreen extends React.Component {
// ... same code above this line
render() {
return (
<SafeAreaView style={styles.container}>
<StatusBar/>
<KeyboardAvoidingView
style={styles.container}
behavior='padding'
enabled>
@youneshenniwrites
youneshenniwrites / SignUpStyles.js
Created January 13, 2019 16:09
styles for sign up screen in RNAuthAWS
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#aa73b7',
justifyContent: 'center',
flexDirection: 'column'
},
input: {
flex: 1,
fontSize: 17,
@youneshenniwrites
youneshenniwrites / SignInScreen.js
Last active January 13, 2019 12:12
Sign in screen layout for RNAuthAWS
export default class SignInScreen extends React.Component {
//... same code as before in the above
render() {
return (
<SafeAreaView style={styles.container}>
<StatusBar/>
<KeyboardAvoidingView style={styles.container} behavior='padding' enabled>
<TouchableWithoutFeedback style={styles.container} onPress={Keyboard.dismiss}>
<View style={styles.container}>
<Container style={styles.infoContainer}>
@youneshenniwrites
youneshenniwrites / stylesSignIn.js
Created January 13, 2019 11:10
Styles of the sign in page for RNAuthAWS
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#aa73b7',
justifyContent: 'center',
flexDirection: 'column'
},
input: {
flex: 1,
fontSize: 17,
@youneshenniwrites
youneshenniwrites / App.js
Created January 9, 2019 19:08
root component for the RNAuthAWS app
import React from 'react';
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native'
import {
createSwitchNavigator,
createStackNavigator ,
createDrawerNavigator,
createBottomTabNavigator
} from 'react-navigation'