简体   繁体   English

视图未显示

[英]View is not Displaying

i wanted to create a colored divider under the text but it does not show up on the screen and i don't know why我想在文本下创建一个彩色分隔线,但它没有显示在屏幕上,我不知道为什么

I'm using expo with react native我正在使用 expo 和本机反应

image图片

the divider should appear under text分隔符应出现在文本下方

return (
    <View style={styles.container}>
<Image style={styles.img} source={logo}/>
<Text style={styles.txt}>Vos informations</Text>
<View style={styles.divider} />

    </View>





and this is the Stylesheet i used:这是我使用的样式表:


const styles = StyleSheet.create({
    container :{
         flex:1,
         flexDirection:'column',
         alignItems:'center',
         justifyContent:'center'
    },



    img: {
        width: 300, 
        height:100, 
        resizeMode : 'contain',

    }, 
    txt : {
        fontFamily: 'Cairo', 
        fontSize:24, 
    
    },
    divider :{
        backgroundColor : '#FB8703',
        width:'80%',
        height:29,
     
    }


})

the desired outcome is having a wide divider under text期望的结果是在文本下方有一个宽的分隔线

You can add a colored underline to a React Native component by adding a borderBottom style property.您可以通过添加 borderBottom 样式属性为 React Native 组件添加彩色下划线。 For example:例如:

const styles = {
  underline: {
    borderBottomColor: '#00FF00',
    borderBottomWidth: 1,
  },
};

<Text style={styles.underline}>This text has an underline</Text>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM