Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/476.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 你能帮我在react本机应用程序上进行布局吗?_Javascript_Reactjs_Flexbox_React Native - Fatal编程技术网

Javascript 你能帮我在react本机应用程序上进行布局吗?

Javascript 你能帮我在react本机应用程序上进行布局吗?,javascript,reactjs,flexbox,react-native,Javascript,Reactjs,Flexbox,React Native,如何在react native上创建布局?你能给我举个例子吗?我不知道如何创建它,因为这里的css很差。你去吧。这将使您了解如何在React Native中使用样式。示例代码也如下所示: 其中一个主要的概念是布局,所以我会看一看。是样式的总体概述 var SampleApp = React.createClass({ render: function() { return ( <View style={styles.container}> &

如何在react native上创建布局?你能给我举个例子吗?我不知道如何创建它,因为这里的css很差。

你去吧。这将使您了解如何在React Native中使用样式。示例代码也如下所示:

其中一个主要的概念是布局,所以我会看一看。是样式的总体概述

var SampleApp = React.createClass({
  render: function() {
    return (
      <View style={styles.container}>
        <View style={styles.one}><Text style={styles.logo}>Text Logo</Text></View>
        <View style={styles.two}></View>
        <View style={styles.three}>
            <Text>Some Texxt</Text>
          </View>
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,    
  },
  logo: {
    color: 'white'
  },  
    one: {
        flex:2,
    backgroundColor: 'black'
    },
 two: {
        flex:7,
        backgroundColor: 'white'
  },
    three: {
    flex: 1,
    backgroundColor: 'white',
    borderTopWidth:4,

    }
});
var SampleApp=React.createClass({
render:function(){
返回(
文字标识
一些Texxt
);
}
});
var styles=StyleSheet.create({
容器:{
弹性:1,
},
标志:{
颜色:“白色”
},  
一:{
弹性:2,
背景颜色:“黑色”
},
二:{
弹性:7,
背景颜色:“白色”
},
三:{
弹性:1,
背景颜色:“白色”,
边框宽度:4,
}
});
你去吧。这将使您了解如何在React Native中使用样式。示例代码也如下所示:

其中一个主要的概念是布局,所以我会看一看。是样式的总体概述

var SampleApp = React.createClass({
  render: function() {
    return (
      <View style={styles.container}>
        <View style={styles.one}><Text style={styles.logo}>Text Logo</Text></View>
        <View style={styles.two}></View>
        <View style={styles.three}>
            <Text>Some Texxt</Text>
          </View>
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,    
  },
  logo: {
    color: 'white'
  },  
    one: {
        flex:2,
    backgroundColor: 'black'
    },
 two: {
        flex:7,
        backgroundColor: 'white'
  },
    three: {
    flex: 1,
    backgroundColor: 'white',
    borderTopWidth:4,

    }
});
var SampleApp=React.createClass({
render:function(){
返回(
文字标识
一些Texxt
);
}
});
var styles=StyleSheet.create({
容器:{
弹性:1,
},
标志:{
颜色:“白色”
},  
一:{
弹性:2,
背景颜色:“黑色”
},
二:{
弹性:7,
背景颜色:“白色”
},
三:{
弹性:1,
背景颜色:“白色”,
边框宽度:4,
}
});

非常感谢!还有一个问题:如何创建100%宽度的按钮?有很多不同的方法,其中许多方法取决于它们所在容器的状态。无论如何,我已经编辑了上面的示例,并添加了一个全宽按钮,该按钮与上面的设置方式一致。非常感谢!还有一个问题:如何创建100%宽度的按钮?有很多不同的方法,其中许多方法取决于它们所在容器的状态。无论如何,我已经编辑了上面的示例,并添加了一个全宽按钮,该按钮与上面的设置方式一致。