【问题标题】:Text behave like an span React Native文本的行为类似于跨度 React Native
【发布时间】:2018-07-15 23:59:04
【问题描述】:

我的标签“Encontrados”如何表现得像一个 span ,我不能让它工作。这是我的代码:

<View><Text style={styles.tag}>{tagType}</Text></View>

tag: {
        borderRadius: 6,
        borderColor: "#999",
        borderWidth: 2,
        padding: 5,
        marginBottom: 10,
        fontWeight: "600",
        color: "#999"
    }

这看起来像一个简单的问题,但我是新手,我无法在网络上找到解决方案,感谢阅读。

【问题讨论】:

  • 您是否尝试过嵌套Text 组件,就像解释here 一样?
  • @Tholle 我遵循了答案,它对我有帮助,谢谢。

标签: reactjs react-native


【解决方案1】:

我用这段代码解决了这个问题:

<View style={styles.contentView}>
    <Text style={{ borderColor: "#999", borderWidth: 2, borderRadius: 6, padding: 9}}>
        <Text style={styles.tagName}>
             {tagType}
        </Text>
    </Text>
 </View>

tagName: {
  color: "#999"
},
contentView: {
   paddingLeft: 10,
   flex: 1,
   flexDirection:'row',
   flexWrap:'wrap',
   marginBottom: 15
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-02
    • 2018-10-01
    • 1970-01-01
    • 2017-01-14
    • 1970-01-01
    • 2018-02-17
    • 2016-11-29
    相关资源
    最近更新 更多