Skip to content

Instantly share code, notes, and snippets.

View diego3g's full-sized avatar
🚀
Launching a rocket

Diego Fernandes diego3g

🚀
Launching a rocket
View GitHub Profile
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.receitafacil"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
import React from 'react';
import { Platform } from 'react-native';
import { StackNavigator } from 'react-navigation';
import List from './pages/list';
import Recipe from './pages/recipe';
const Router = StackNavigator({
List: { screen: List },
Recipe: {
/* Core */
import React, { Component } from 'react';
/* Presentational */
import { View, Platform, Linking } from 'react-native';
export default class List extends Component {
static navigationOptions = {
title: 'Lista de receitas',
};
/* Core */
import React, { Component } from 'react';
/* Presentational */
import { View, Text } from 'react-native';
export default class Recipe extends Component {
static navigationOptions = {
title: 'Detalhe da receita'
};
/* Core */
import React, { Component } from 'react';
/* Presentational */
import { View, Platform, Linking } from 'react-native';
export default class List extends Component {
async componentDidMount() {
if (Platform.OS === 'android') {
const url = await Linking.getInitialURL();
// store/ducks/auth.js
// Action Types
export const Types = {
LOGIN: 'auth/LOGIN',
LOGOUT: 'auth/LOGOUT',
};
// Reducer
import React from 'react';
import { View, TextInput, Button } from 'react-native';
import { withFormik } from 'formik';
const Form = (props) => (
<View style={styles.container}>
<TextInput
value={props.values.email}
onChangeText={text => props.setFieldValue('email', text)}
@diego3g
diego3g / form.js
Last active October 31, 2017 22:47
handleSubmit: (values, { setSubmitting, setErrors }) => {
apiService.post('/authenticate', values)
.then(/* sucesso */)
.catch(err => {
setSubmitting(false);
setErrors({ message: err.message });
});
}
@diego3g
diego3g / form.js
Last active October 31, 2017 23:00
export default withFormik({
mapPropsToValues: () => ({ email: '', password: '' }),
validationSchema: Yup.object().shape({
email: Yup.string()
.email('Digite um e-mail válido')
.required('Preencha o campo de e-mail'),
password: Yup.string()
.min(6, 'A senha deve ter no mínimo 6 caracteres')
.required('Preencha o campo de senha'),