UNPKG

rn-verto-typescript

Version:

Verto Free Switch with React Native Type Script

86 lines (85 loc) 3.28 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = __importStar(require("react")); const react_native_1 = require("react-native"); const LoginScreen = (props) => { const [email, setEmail] = react_1.useState(''); const [url, setUrl] = react_1.useState(''); const [password, setPassword] = react_1.useState(''); react_1.useEffect(() => { if (props.authParams) { setUrl(props.authParams.url); setEmail(props.authParams.login); } }, [props.authParams]); const loginHandler = () => { props.onLoginHandler(email, password, url); }; return (<react_native_1.View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> <react_native_1.View style={styles.inputView}> <react_native_1.TextInput style={styles.textInput} placeholder="url" value={url} onChangeText={(url) => setUrl(url)}/> </react_native_1.View> <react_native_1.View style={styles.inputView}> <react_native_1.TextInput style={styles.textInput} placeholder="Email" value={email} onChangeText={(email) => setEmail(email)}/> </react_native_1.View> <react_native_1.View style={styles.inputView}> <react_native_1.TextInput style={styles.textInput} placeholder="Password" secureTextEntry={true} value={password} onChangeText={(password) => setPassword(password)}/> </react_native_1.View> <react_native_1.TouchableOpacity style={styles.loginBtn} onPress={loginHandler}> <react_native_1.Text style={styles.loginText}>LOGIN</react_native_1.Text> </react_native_1.TouchableOpacity> </react_native_1.View>); }; const styles = react_native_1.StyleSheet.create({ highlight: { fontWeight: '700', }, inputView: { backgroundColor: "white", borderRadius: 10, borderColor: 'black', borderWidth: 1, width: "70%", height: 45, marginBottom: 20 }, textInput: { color: 'black', height: 50, flex: 1, padding: 10, marginLeft: 20, }, loginBtn: { width: "80%", borderRadius: 25, height: 50, alignItems: "center", justifyContent: "center", marginTop: 40, backgroundColor: "#FF1493", }, loginText: { color: 'black' } }); exports.default = LoginScreen;