Skip to content

Instantly share code, notes, and snippets.

@patcito
Created June 11, 2017 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save patcito/c82249e8c81fb6fb31834e36513160db to your computer and use it in GitHub Desktop.
Save patcito/c82249e8c81fb6fb31834e36513160db to your computer and use it in GitHub Desktop.
import React from 'react';
import { Image, View, Text, TextInput, LayoutAnimation } from 'react-native';
import KeyboardEventListener from '../util/KeyboardEventListener';
export default class AuthenticationScreen extends React.Component {
state = {
keyboardHeight: 0,
}
componentDidMount() {
KeyboardEventListener.subscribe(({keyboardHeight, layoutAnimationConfig}) => {
LayoutAnimation.configureNext(layoutAnimationConfig);
this.setState({keyboardHeight})
})
}
render() {
return (
<View
style={{
flex: 1,
backgroundColor: '#eee',
alignItems: 'center',
justifyContent: 'center',
marginTop: -this.state.keyboardHeight,
}}>
<Image
source={{ uri: 'https://www.react-europe.org/images/reacteurope.png' }}
style={{ width: 300, height: 300, resizeMode: 'contain' }}
/>
<Text>Please sign in</Text>
<TextInput
style={{
height: 50,
backgroundColor: '#fff',
borderWidth: 1,
borderColor: '#888',
}}
placeholder="Email"
/>
<TextInput
style={{
height: 50,
backgroundColor: '#fff',
borderWidth: 1,
borderColor: '#888',
}}
secureTextEntry
placeholder="Password"
/>
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment