Created
June 11, 2017 10:45
-
-
Save patcito/c82249e8c81fb6fb31834e36513160db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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