Change login icons to ion & Format
This commit is contained in:
22
src/Login.js
22
src/Login.js
@@ -1,14 +1,24 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View, Text, TextInput, Button, ToastAndroid } from 'react-native';
|
import {Button, Text, TextInput, ToastAndroid, View} from 'react-native';
|
||||||
import SharedPreferences from 'react-native-shared-preferences';
|
import SharedPreferences from 'react-native-shared-preferences';
|
||||||
import Icon from 'react-native-vector-icons/MaterialIcons'
|
import Icon from 'react-native-vector-icons/Ionicons'
|
||||||
import DeviceInfo from 'react-native-device-info';
|
import DeviceInfo from 'react-native-device-info';
|
||||||
import * as axios from "axios";
|
import * as axios from "axios";
|
||||||
|
|
||||||
const urlRegex = new RegExp("^(http|https)://", "i");
|
const urlRegex = new RegExp("^(http|https)://", "i");
|
||||||
const defaultClientName = DeviceInfo.getManufacturer() + ' ' + DeviceInfo.getDeviceId();
|
const defaultClientName = DeviceInfo.getManufacturer() + ' ' + DeviceInfo.getDeviceId();
|
||||||
export default class Login extends React.Component {
|
export default class Login extends React.Component {
|
||||||
state = {tryConnect: null, url: null, error: null, version: null, name: '', pass: '', loggedIn: null, client: defaultClientName};
|
state = {
|
||||||
|
tryConnect: null,
|
||||||
|
url: null,
|
||||||
|
error: null,
|
||||||
|
version: null,
|
||||||
|
name: '',
|
||||||
|
pass: '',
|
||||||
|
loggedIn: null,
|
||||||
|
client: defaultClientName
|
||||||
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
SharedPreferences.getItem("@global:url", (url) => {
|
SharedPreferences.getItem("@global:url", (url) => {
|
||||||
if (url) {
|
if (url) {
|
||||||
@@ -105,7 +115,8 @@ export default class Login extends React.Component {
|
|||||||
style={{alignSelf: 'stretch', flex: 1}}
|
style={{alignSelf: 'stretch', flex: 1}}
|
||||||
keyboardType="url"
|
keyboardType="url"
|
||||||
onChangeText={this.handleChange('url', {tryConnect: false, version: null})}/>
|
onChangeText={this.handleChange('url', {tryConnect: false, version: null})}/>
|
||||||
<Icon.Button name="send" style={{alignSelf: 'flex-end'}} iconStyle={{marginRight: 0}} onPress={this.checkUrl}/>
|
<Icon.Button name="md-send" style={{alignSelf: 'flex-end'}} iconStyle={{marginRight: 0}}
|
||||||
|
onPress={this.checkUrl}/>
|
||||||
</View>
|
</View>
|
||||||
{error && <Text style={{textAlign: 'center', color: 'red'}}>{error}</Text>}
|
{error && <Text style={{textAlign: 'center', color: 'red'}}>{error}</Text>}
|
||||||
{version && <Text style={{textAlign: 'center', color: 'green'}}>Gotify v{version.version}</Text>}
|
{version && <Text style={{textAlign: 'center', color: 'green'}}>Gotify v{version.version}</Text>}
|
||||||
@@ -121,7 +132,8 @@ export default class Login extends React.Component {
|
|||||||
onChangeText={this.handleChange('pass', {loggedIn: null})}
|
onChangeText={this.handleChange('pass', {loggedIn: null})}
|
||||||
style={{alignSelf: 'stretch', flex: 1}}
|
style={{alignSelf: 'stretch', flex: 1}}
|
||||||
/>
|
/>
|
||||||
<Icon.Button name="send" style={{alignSelf: 'flex-end'}} iconStyle={{marginRight: 0}} onPress={this.checkUser}/>
|
<Icon.Button name="md-send" style={{alignSelf: 'flex-end'}} iconStyle={{marginRight: 0}}
|
||||||
|
onPress={this.checkUser}/>
|
||||||
</View>
|
</View>
|
||||||
{loggedIn === true && (
|
{loggedIn === true && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|||||||
Reference in New Issue
Block a user