How To Make Loader Center On The View
On one View displaying the page in that page I need to display the loader but the loader need to display it on center. var LoaderPositionCenter = React.createClass({ render:fu
Solution 1:
You can set the outer container to have a style property of:
flex: 1,
alignItems: 'center',
justifyContent: 'center'
I've set up a full project here, and pasted the entire code below:
https://rnplay.org/apps/Lq4G9w
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
ActivityIndicatorIOS
} = React;
var SampleApp = React.createClass({
getInitialState: function(){
return {
animating: true
}
},
render: function() {
return (
<View style={styles.container}>
<ActivityIndicatorIOS animating={this.state.animating} style={[{height: 80}]} size="large" />
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#ddd'
},
});
AppRegistry.registerComponent('SampleApp', () => SampleApp);
Post a Comment for "How To Make Loader Center On The View"