2016-01-27 26 views
36

प्रतिक्रिया मूल के साथ प्रतिक्रियात्मक सीमा त्रिज्या प्रतिक्रिया, borderRadius काम कर रहा है लेकिन बटन पर दिया गया पृष्ठभूमि रंग एक वर्ग रहता है। यहाँ क्या हो रहा है?पृष्ठभूमि रंग

जे एस

<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' 
}, 
... 

enter image description here

+0

सिर्फ एक अनुमान, 'BorderStyle देने की कोशिश: '' submitText' – Cherniv

+0

नहीं, यह फ्लॉप काम दुर्भाग्य – Chipe

+0

जो पर्यावरण पर आप परीक्षण कर रहे हैं करने के लिए solid''? आईओएस या एंड्रॉइड? – Cherniv

उत्तर

57

TouchableHighlight खुद के लिए बटन स्टाइल चलती का प्रयास करें:

शैलियाँ:

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> 

enter image description here

+1

धन्यवाद! 'पैडिंग' भी एक और महत्वपूर्ण कुंजी है। – DazChong

27

यदि आप react-native-button का उपयोग आप अपनी शैली को overflow: hidden जोड़ना चाहिए:

जे एस:

import Button from 'react-native-button'; 

<Button style={styles.submit}>Submit</Button> 

शैलियाँ:

submit { 
    backgroundColor: '#68a0cf'; 
    overflow: 'hidden'; 
} 
+3

'ओवरफ्लो: 'छुपा' ने प्रतिक्रिया के बिना भी मेरे लिए काम किया- देशी-बटन –

+1

धन्यवाद। हां, कंटेनर पर 'पृष्ठभूमि रंग' और 'सीमा त्रिज्या' डालना, फिर कंटेनर में 'ओवरफ्लो:' छुपा 'जोड़ना मेरे लिए काम करता है। ('प्रतिक्रिया-मूल-बटन' का भी उपयोग नहीं करते हैं।) – David

+0

यह वही है जो मैं चाहता था! (चेक किए गए नहीं) –

संबंधित मुद्दे