• 主页
  • React Native:使用固定宽度按钮在视图容器内换行文本

React Native:使用固定宽度按钮在视图容器内换行文本

我有一个View容器,它显示一条简单的警告消息。消息文本应启用换行,但按钮不应启用。

它们不能很好地配合,而且我不能让文本在每一行的末尾换行。

?

?

?

?

RNPlay (Link)

<View style={{backgroundColor: 'red',flexDirection:'row',justifyContent:'space-between',alignItems:'center',flexWrap:'nowrap'}}>
  <View style={{justifyContent: 'flex-start', alignItems:'center', marginLeft:15, flexWrap: 'wrap'}}>
    <Text style={{color:'white', fontSize: 18, fontWeight:'normal', flexWrap: 'wrap'}}>You have deleted the item.</Text>
  </View>
  <TouchableHighlight style={{width:100,flexDirection:'column',marginVertical:15,flexWrap:'nowrap'}} >
    <View style={{right:0,width:100, flexDirection:'row', marginRight:15, paddingVertical:15, backgroundColor:'white',flexWrap:'nowrap'}}>
      <Text style={{fontSize: 18, fontWeight:'bold', color:'red',flexWrap:'nowrap'}}>BACK</Text>
    </View>
  </TouchableHighlight>
</View>

转载请注明出处:http://www.jubohx.com/article/20230511/2008212.html