Skip to content

Instantly share code, notes, and snippets.

@FreddyPoly
Last active June 12, 2017 09:11
Show Gist options
  • Save FreddyPoly/4384ca36d5a2dbf7a4769feba3494d68 to your computer and use it in GitHub Desktop.
Save FreddyPoly/4384ca36d5a2dbf7a4769feba3494d68 to your computer and use it in GitHub Desktop.
[REACT NATIVE] Activity Indicator Overlay
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