如何在View上制作装载机中心
在一个显示该页面页面的视图中,我需要显示加载程序,但加载程序需要在中心显示它。
var LoaderPositionCenter = React.createClass({ render:function(){ return( one one one one one one one one textsds dsdsdsd ) } })
在First View内容中,我需要将加载器作为中心显示如何使用flexbox
//新的一个
var Example = React.createClass({ getInitialState:function(){ return {status:"button"} }, click:function(){ this.setState({status:"buttonText"}); }, render() { return ( { {this.state.status} } one one one one one one one one one one one one one one one one one one one one one one one one one one ); } });
如何禁用内容视图,这意味着使用flexbox或其他位置:’绝对’视图
您可以将外部容器设置为具有以下样式属性:
flex: 1, alignItems: 'center', justifyContent: 'center'
我在这里设置了一个完整的项目,并粘贴了以下整个代码:
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 ( ); } }); var styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: '#ddd' }, }); AppRegistry.registerComponent('SampleApp', () => SampleApp);