Skip to content

Instantly share code, notes, and snippets.

@vidux
Created June 30, 2020 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vidux/2082169dee569be7ef9ce9ae64b19a56 to your computer and use it in GitHub Desktop.
Save vidux/2082169dee569be7ef9ce9ae64b19a56 to your computer and use it in GitHub Desktop.
Add keyboard avoiding view react native
import React, {Component} from 'react';
const App =()=>
<ScrollView scrollEnabled={false} contentContainerStyle={{flex: 1}}>
<SafeAreaView style={{flex: 1, backgroundColor: 'white'}}>
<KeyboardAvoidingView behavior='position' contentContainerStyle={{flex: 1}} style={styles.mainContainer}>
<View style={styles.logoView}>
<Image source={logo} />
<Text style={{fontSize: deviceHeight/33, marginTop: deviceHeight/60}}>Welcome</Text>
<Text style={{fontSize: 14, marginTop: deviceHeight/80}}>Please sign in to continue</Text>
</View>
<View style={styles.formView}>
<TextInput ref={(c) => this._email = c} onSubmitEditing={() => this._password.focus()} value={email} onChangeText={(t) => this.setState({email: t})} style={styles.textInput} keyboardType='email-address' placeholder='Email' />
<TextInput ref={(c) => this._password = c} onSubmitEditing={() => this._confirmPassword.focus()} value={password} onChangeText={(t) => this.setState({password: t})} style={styles.textInput} secureTextEntry placeholder='Password' />
<Text style={{fontSize: 14, alignSelf: 'flex-end', marginTop: 15}}>Forgot Password?</Text>
<View style={styles.buttonView}>
<LoadingButton onPress={this.handleLogin} style={{width: '60%', alignSelf: 'flex-end', marginTop: deviceHeight/28}} title='Sign In' />
</View>
<View style={styles.biometricLoginView}>
<Image source={faceId} style={styles.faceIdImg} />
<Text style={{marginTop: 12, fontSize: 14}}>Sign in with Face ID</Text>
</View>
</View>
</KeyboardAvoidingView>
</SafeAreaView>
<MessageAlert ref={(c) => this._dropdown = c} />
</ScrollView>
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment