This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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', | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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' | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // store/ducks/auth.js | |
| // Action Types | |
| export const Types = { | |
| LOGIN: 'auth/LOGIN', | |
| LOGOUT: 'auth/LOGOUT', | |
| }; | |
| // Reducer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| handleSubmit: (values, { setSubmitting, setErrors }) => { | |
| apiService.post('/authenticate', values) | |
| .then(/* sucesso */) | |
| .catch(err => { | |
| setSubmitting(false); | |
| setErrors({ message: err.message }); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'), |