在 React Native 中, borderRadius
可以正常工作,但按钮的背景颜色仍然是正方形。这里发生了什么?
JS
<TouchableHighlight
style={styles.submit}
onPress={() => this.submitSuggestion(this.props)}
underlayColor='#fff'>
<Text style={[this.getFontSize(),styles.submitText]}>Submit</Text>
</TouchableHighlight>
风格
...
submit:{
marginRight:40,
marginLeft:40,
marginTop:10,
},
submitText:{
paddingTop:20,
paddingBottom:20,
color:'#fff',
textAlign:'center',
backgroundColor:'#68a0cf',
borderRadius: 10,
borderWidth: 1,
borderColor: '#fff'
},
...
原文由 Chipe 发布,翻译遵循 CC BY-SA 4.0 许可协议
尝试将按钮样式移动到
TouchableHighlight
本身:款式:
按钮(相同):