Реагируйте на собственный радиус границы с цветом фона
В 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'
},
...
4 ответа:
попробуйте переместить стиль кнопки в :
стили:
submit:{ marginRight:40, marginLeft:40, marginTop:10, paddingTop:20, paddingBottom:20, backgroundColor:'#68a0cf', borderRadius:10, borderWidth: 1, borderColor: '#fff' }, submitText:{ color:'#fff', textAlign:'center', }кнопка (та же):
<TouchableHighlight style={styles.submit} onPress={() => this.submitSuggestion(this.props)} underlayColor='#fff'> <Text style={[this.getFontSize(),styles.submitText]}>Submit</Text> </TouchableHighlight>
вы должны добавить
overflow: hiddenстилей:Js:
<Button style={styles.submit}>Submit</Button>стили:
submit { backgroundColor: '#68a0cf'; overflow: 'hidden'; }
примените нижеприведенную строку кода:
<TextInput style={{ height: 40, width: "95%", borderColor: 'gray', borderWidth: 2, borderRadius: 20, marginBottom: 20, fontSize: 18, backgroundColor: '#68a0cf' }} // Adding hint in TextInput using Placeholder option. placeholder=" Enter Your First Name" // Making the Under line Transparent. underlineColorAndroid="transparent" />
примените нижеприведенную строку кода внутри макета представления блока рендеринга:
<TextInput style={{ height: 40, width: "95%", borderColor: 'gray', borderWidth: 2, borderRadius: 20, marginBottom: 20, fontSize: 18, backgroundColor: '#68a0cf' }} // Adding hint in TextInput using Placeholder option. placeholder=" Enter Your First Name" // Making the Under line Transparent. underlineColorAndroid="transparent" />
