import React, { Component } from "react"; import { Platform, StyleSheet, View, TextInput, TouchableOpacity, SafeAreaView, Keyboard, ScrollView, TouchableWithoutFeedback } from "react-native"; import { observable } from "mobx"; import { KeyboardAccessoryNavigation } from "react-native-keyboard-accessory"; import { observer, inject } from "mobx-react/native"; import Text from "react-native-text"; import Header from "../../components/Public/signInUpHeader"; import { scale, verticalScale, moderateScale } from "react-native-size-matters"; import Size from "../../config/size"; import theme from "../../config/colors"; import { Fonts } from "../../config/fonts"; import Log from '../../config/log' import { width, height } from "../../config/screen"; import { Button } from "react-native-elements"; import CommonTextInput from "../../components/Public/commonTextInput"; import api from "../../stores/api"; const size = new Size(); import Toast, { DURATION } from "react-native-easy-toast"; import SignUpInformation from "../signUp/signUpInformation"; import Loader from "../../components/Public/loader"; let log = new Log() let inputs = [ { //value: this.account, // onChangeText: this.loginData.pwd, placeholder: "Email/Mobile", secureTextEntry: false // componentRef: this.first }, { //value: this.password, //onChangeText: this.loginData.pwd, placeholder: "Password", secureTextEntry: true // componentRef: this.secound } ]; @inject(["userStore"]) @observer export default class Login extends Component { loginData = { id: "", pwd: "" }; data = [ { value: this.account, onChangeText: this.loginData.pwd, componentRef: this.first }, { value: this.password, onChangeText: this.loginData.pwd, componentRef: this.secound } ]; constructor(props) { super(props); this.store = this.props.userStore; inputs = inputs.map((input, index) => ({ componentRef: React.createRef(), value: this.data[index].value, onChangeText: this.data[index].onChangeText, ...input })); this.state = { activeInputIndex: 0, nextFocusDisabled: false, previousFocusDisabled: false, buttonsDisabled: false, buttonsHidden: false }; } handleFocus = index => () => { this.setState({ nextFocusDisabled: index === inputs.length - 1, previousFocusDisabled: index === 0, activeInputIndex: index }); }; handleFocusNext = () => { const { nextFocusDisabled, activeInputIndex } = this.state; if (nextFocusDisabled) { return; } // this.inputs[activeInputIndex + 1].componentRef.focus(); inputs[1].componentRef.current.focus(); }; handleFocusPrevious = () => { const { previousFocusDisabled, activeInputIndex } = this.state; if (previousFocusDisabled) { return; } inputs[activeInputIndex - 1].componentRef.current.focus(); }; navigatieAction(page) { this.props.navigation.navigate(page); } componentWillMount() { console.log("login componentWillMount"); } loginAction() { this.store.loginPost(this.loginData, this, true); log.firebaseLog('press_login_button',{}) } testing() { var bodyFormData = new FormData(); bodyFormData.append("country_code", "852"); bodyFormData.append("phone_number", "97726727"); this.store.sendsmsVerify(bodyFormData, this); } render() { console.log("state: ", this.props.navigation.state); log.firebaseClass('Login') return (
(this.loginData.id = account)} placeholder="Email" secureTextEntry={false} returnKeyType={"next"} onSubmitEditing={event => { this.passTextInput.focus(); }} /> (this.loginData.pwd = password)} placeholder="Password" inputRef={input => { this.passTextInput = input; }} returnKeyType={"done"} secureTextEntry={true} onSubmitEditing={event => { Keyboard.dismiss() }} /> { this.navigatieAction("ForgetPassword"); }} > Forget Password ? Go Reset this.navigatieAction("SignUpInformation")} // onPress = {()=>this.testing()} > No Account ? Go Register