Fixed logo not displaying when app is loading or signing to server

This commit is contained in:
Gilmar Quinelato 2017-09-13 19:49:15 -03:00
parent 77b70a265b
commit 99ce659c4f
6 changed files with 62 additions and 44 deletions

View File

@ -1,6 +1,7 @@
import React from 'react';
import { Button } from 'react-native';
import { Text, TouchableOpacity } from 'react-native';
import { StackNavigator } from 'react-navigation';
import Icon from 'react-native-vector-icons/FontAwesome';
import ListServerView from '../../views/ListServerView';
import NewServerView from '../../views/NewServerView';
@ -14,10 +15,12 @@ const PublicRoutes = StackNavigator(
return {
title: 'Servers',
headerRight: (
<Button
title='Add'
<TouchableOpacity
onPress={() => navigation.navigate('AddServer')}
/>
style={{ width: 50, alignItems: 'center' }}
>
<Icon name='plus' size={16} />
</TouchableOpacity>
)
};
}

View File

@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { KeyboardAvoidingView, Platform } from 'react-native';
import { KeyboardAvoidingView } from 'react-native';
export default class KeyboardView extends React.PureComponent {
static propTypes = {
@ -14,7 +14,7 @@ export default class KeyboardView extends React.PureComponent {
render() {
return (
<KeyboardAvoidingView style={this.props.style} behavior={Platform.OS === 'ios' ? 'padding' : null} keyboardVerticalOffset={this.props.keyboardVerticalOffset}>
<KeyboardAvoidingView style={this.props.style} behavior='padding' keyboardVerticalOffset={this.props.keyboardVerticalOffset}>
{this.props.children}
</KeyboardAvoidingView>
);

View File

@ -61,45 +61,52 @@ class LoginView extends React.Component {
// {this.props.login.isFetching && <Text> LOGANDO</Text>}
render() {
return (
<KeyboardView style={styles.view} keyboardVerticalOffset={64}>
<View style={styles.logoContainer}>
<Image style={styles.logo} source={require('../images/logo.png')} />
<KeyboardView style={styles.container} keyboardVerticalOffset={64}>
<View>
<Text style={{ textAlign: 'center' }}>
<Image
style={styles.logo}
source={require('../images/logo.png')}
/>
</Text>
</View>
<View style={styles.formContainer}>
<TextInput
placeholderTextColor={'rgba(255,255,255,.2)'}
style={styles.input}
onChangeText={username => this.setState({ username })}
keyboardType='email-address'
autoCorrect={false}
returnKeyType='done'
autoCapitalize='none'
autoFocus
<View style={styles.loginView}>
<View style={styles.formContainer}>
<TextInput
placeholderTextColor={'rgba(255,255,255,.2)'}
style={styles.input}
onChangeText={username => this.setState({ username })}
keyboardType='email-address'
autoCorrect={false}
returnKeyType='done'
autoCapitalize='none'
autoFocus
underlineColorAndroid='transparent'
onSubmitEditing={this.submit}
placeholder={this.props.Accounts_EmailOrUsernamePlaceholder || 'Email or username'}
/>
<TextInput
placeholderTextColor={'rgba(255,255,255,.2)'}
style={styles.input}
onChangeText={password => this.setState({ password })}
secureTextEntry
autoCorrect={false}
returnKeyType='done'
autoCapitalize='none'
underlineColorAndroid='transparent'
onSubmitEditing={this.submit}
placeholder={this.props.Accounts_EmailOrUsernamePlaceholder || 'Email or username'}
/>
<TextInput
placeholderTextColor={'rgba(255,255,255,.2)'}
style={styles.input}
onChangeText={password => this.setState({ password })}
secureTextEntry
autoCorrect={false}
returnKeyType='done'
autoCapitalize='none'
underlineColorAndroid='transparent'
onSubmitEditing={this.submit}
placeholder={this.props.Accounts_PasswordPlaceholder || 'Password'}
/>
{this.renderTOTP()}
<TouchableOpacity style={styles.buttonContainer}>
<Text style={styles.button} onPress={this.submit}>LOGIN</Text>
</TouchableOpacity>
{this.props.login.error && <Text style={styles.error}>{this.props.login.error}</Text>}
underlineColorAndroid='transparent'
onSubmitEditing={this.submit}
placeholder={this.props.Accounts_PasswordPlaceholder || 'Password'}
/>
{this.renderTOTP()}
<TouchableOpacity style={styles.buttonContainer}>
<Text style={styles.button} onPress={this.submit}>LOGIN</Text>
</TouchableOpacity>
{this.props.login.error && <Text style={styles.error}>{this.props.login.error}</Text>}
</View>
<Spinner visible={this.props.login.isFetching} textContent={'Loading...'} textStyle={{ color: '#FFF' }} />
</View>
<Spinner visible={this.props.login.isFetching} textContent={'Loading...'} textStyle={{ color: '#FFF' }} />
</KeyboardView>
);
}

View File

@ -1,6 +1,16 @@
import { StyleSheet } from 'react-native';
export default StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#2f343d',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'stretch'
},
loginView: {
padding: 20
},
view: {
flex: 1,
flexDirection: 'column',
@ -24,7 +34,6 @@ export default StyleSheet.create({
justifyContent: 'center'
},
logo: {
// width: 80,
borderRadius: 5,
resizeMode: 'contain'
},

View File

@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };

View File

@ -38,7 +38,7 @@
<key>NSCameraUsageDescription</key>
<string>Upload images from camera</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<string/>
<key>NSPhotoLibraryUsageDescription</key>
<string>Upload images from library</string>
<key>UIAppFonts</key>