import React, { useState } from "react"; import { View, Text, Image, ActivityIndicator, Dimensions, TextInput, TouchableHighlight, } from "react-native"; import Logo from "./assets/logo.png"; import CustomTextInput from "../../components/CustomTextInput"; import { digitToEn, digitToPersian } from "../../utils"; import services from "./services"; import { asyncAwesomeAlert } from "../../utils/AsyncWrappers"; import tw from "tailwind-rn"; const { width, height } = Dimensions.get("window"); let faNums = ["۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", "۰"]; function Login(props) { const [phone, setPhone] = useState(""); const [loading, setLoading] = useState(false); const onChangePhone = (name, value) => { let items = digitToPersian(value).split(""); for (let item of items) { if (!faNums.includes(item)) { return; } } setPhone(digitToPersian(value)); }; const checkPhoneNumber = () => { return phone.split("").length === 11; }; const submit = async () => { setLoading(true); // if (!checkPhoneNumber()) { // setLoading(false); // return asyncAwesomeAlert("خطا", "شماره وارد شده اشتباه است", { // showCancelButton: false, // }); // } // let res = await services.getSmsCode({ // cellphone: digitToEn(phone), // }); // if (res.ok) { // setLoading(false); props.navigation.navigate("Otp", { phone: digitToEn(phone) }); // } setLoading(false); }; return ( {"سلام"} {/* { "به دانوین خوش اومدی برای عضویت و ادامه شماره موبایلت رو وارد کن و روی گزینه ثبت بزن" } */} submit()} > {loading ? ( ) : ( {"ادامه"} )} ); } export default Login;