-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Guilherme Banci <guibanci@gmail.com>
- Loading branch information
Showing
4 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React, {useState} from 'react'; | ||
import {Alert, Platform} from 'react-native'; | ||
import ScrollView from 'components/UI/ScrollView'; | ||
import Input from 'components/UI/Input'; | ||
import required from 'validators/required'; | ||
import phoneValidator from 'validators/phone'; | ||
import phoneMask from 'masks/phoneMask'; | ||
import Btn from 'components/UI/Btn'; | ||
import api from 'services/api'; | ||
import Text from 'components/UI/Text'; | ||
import {useDispatch} from 'react-redux'; | ||
import * as Actions from 'store/actions'; | ||
import theme from 'theme/theme'; | ||
import {Container} from './styles'; | ||
|
||
const Page1 = ({navigation}) => { | ||
const dispatch = useDispatch(); | ||
|
||
const [phone, setPhone] = useState({ | ||
isValid: false, | ||
value: '', | ||
}); | ||
|
||
const [name, setName] = useState({ | ||
isValid: false, | ||
value: '', | ||
}); | ||
|
||
const formIsValid = () => { | ||
return phone.isValid && name.isValid; | ||
}; | ||
|
||
const onPress = async () => { | ||
navigation.navigate('Page2') | ||
// dispatch(Actions.enableLoader()); | ||
// const params = {} | ||
// try { | ||
// await api.post('/route/', params); | ||
// } catch (error) { | ||
// Alert.alert('Cartografia Social', 'Ocorreu um erro ao se conectar com o servidor'); | ||
// dispatch(Actions.disableLoader()); | ||
// } | ||
}; | ||
|
||
return ( | ||
<ScrollView> | ||
<Container> | ||
<Text alignSelf="center" fontSize={theme.font.sizes.L} my={3}> | ||
Texto exemplo | ||
</Text> | ||
<Input | ||
label="Seu nome" | ||
onChange={(value) => setName(value)} | ||
value={name.value} | ||
autoCapitalize="words" | ||
rules={[required]} | ||
/> | ||
<Input | ||
label="Número de telefone" | ||
onChange={(value) => setPhone(value)} | ||
value={phone.value} | ||
inputMask={phoneMask} | ||
keyboardType="numeric" | ||
rules={[required, phoneValidator]} | ||
/> | ||
<Btn | ||
disabled={!formIsValid()} | ||
style={{marginVertical: 50}} | ||
title="Próximo" | ||
onPress={onPress} | ||
/> | ||
</Container> | ||
</ScrollView> | ||
); | ||
}; | ||
|
||
export default Page1; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styled from 'styled-components/native'; | ||
|
||
export const Container = styled.View` | ||
padding: 20px; | ||
`; | ||
|
||
export const FirstInput = styled.View` | ||
flex-direction: row; | ||
align-items: center; | ||
`; | ||
|
||
export const InputView = styled.View` | ||
flex: 1; | ||
`; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import {View, Text} from 'components/UI'; | ||
|
||
const Page2 = () => { | ||
return ( | ||
<View flex={1} alignItems="center" justifyContent="center"> | ||
<Text>Page 2</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export default Page2; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styled from 'styled-components/native'; | ||
|
||
export const Container = styled.View` | ||
padding: 20px; | ||
`; | ||
|
||
export const FirstInput = styled.View` | ||
flex-direction: row; | ||
align-items: center; | ||
`; | ||
|
||
export const InputView = styled.View` | ||
flex: 1; | ||
`; |