Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Max#refactor verification #205

Merged
merged 5 commits into from
Jun 18, 2019
Merged
Changes from 1 commit
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
36 changes: 27 additions & 9 deletions src/Screens/Verification/verification.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
View,
Text,
StyleSheet,
Linking,
TouchableOpacity,
BackHandler
BackHandler,
Alert
} from "react-native"
import LinearGradient from "react-native-linear-gradient"
import CodeInput from "react-native-confirmation-code-input"
Expand All @@ -16,7 +16,8 @@ export default class Verificacao extends Component {
constructor() {
super()
this.state = {
code: ""
code: "",
confirmResult: null
}
}

Expand All @@ -40,8 +41,11 @@ export default class Verificacao extends Component {

confirmChoice = code => {
const { navigation } = this.props
const confirmResult = navigation.getParam("confirmResultFirebase")

const { confirmResult } = this.state
const cR = navigation.getParam("confirmResultFirebase")
if (!confirmResult) {
this.setState({ confirmResult: cR })
}
if (confirmResult && code.length) {
confirmResult
.confirm(code)
Expand All @@ -64,6 +68,20 @@ export default class Verificacao extends Component {
}
}

reenviarCodigo = () => {
Alert.alert("Clicou", "clicou")
Mex978 marked this conversation as resolved.
Show resolved Hide resolved
const { navigation } = this.props
const phoneNumber = navigation.getParam("phoneNumber")

firebase
.auth()
.signInWithPhoneNumber(phoneNumber)
.then(_confirmResult => {
this.setState({ confirmResult: _confirmResult })
})
.catch(erro => Alert.alert("Erro", erro))
}

render() {
return (
<View style={styles.principal}>
Expand Down Expand Up @@ -96,9 +114,9 @@ export default class Verificacao extends Component {
</TouchableOpacity>
<View style={styles.containerText2}>
<Text>Não recebeu o código de verificação?</Text>
<Text style={styles.text2} onPress={() => Linking.openURL("#")}>
Reenviar código
</Text>
<TouchableOpacity onPress={this.reenviarCodigo}>
<Text style={styles.text2}>Reenviar código</Text>
</TouchableOpacity>
</View>
</View>
)
Expand Down Expand Up @@ -127,7 +145,7 @@ const styles = StyleSheet.create({
},
text2: {
marginLeft: 1,
color: "black",
color: "#007AFF",
fontWeight: "bold"
},
button: {
Expand Down