Last active
June 12, 2017 09:11
-
-
Save FreddyPoly/4384ca36d5a2dbf7a4769feba3494d68 to your computer and use it in GitHub Desktop.
[REACT NATIVE] Activity Indicator Overlay
This file contains 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
this.state = { | |
animating: false, | |
}; | |
_startLoading = (bool) => new Promise((resolve) => { | |
this.setState({animating: bool}); | |
resolve(bool); | |
}) | |
<View | |
style = {styles.loadingContainer} > | |
<ActivityIndicator | |
animating = {true} | |
style = {{ padding: 20, | |
backgroundColor: 'rgba(0, 0, 0, 0.8)', | |
borderRadius: 10, | |
opacity: this.state.animating ? 1.0 : 0.0, }} | |
color = 'yellow' | |
size = { 70 } /> | |
</View> | |
const styles = StyleSheet.create({ | |
loadingContainer: { | |
position: 'absolute', | |
top: 0, | |
bottom: 0, | |
left: 0, | |
right: 0, | |
justifyContent: 'center', | |
alignItems: 'center', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment