2017-01-15 24 views
1

テキストコンポーネントの周りに境界線を追加したいとします。私は次のことをしてきましたが、私は、テキストの周りに境界が必要で、ビューの全幅ではありません。React Nativeテキストに境界線を追加する

<View style={{borderWidth: 1}}/> 
    <Text>A DIFFERENT EXPERIENCE</Text> 
</View> 

enter image description here

これは可能ですか?

答えて

2

はい、それはあなたがこのような別のビューでそれをラップする必要があり、そのために可能である:

<View style={styles.container}> 
     <View style={styles.inner}> 
    <Text>A DIFFERENT EXPERIENCE</Text> 
     </View> 
     </View> 

const styles = StyleSheet.create({ 
    container: { 
    flex: 1, 
    justifyContent: 'center', 
    alignItems: 'center', 
    backgroundColor: '#fff', 
    borderWidth:4 
    }, 
    inner:{ 
    borderWidth:4 

    } 

乾杯:)

+0

素晴らしい、ありがとう! –

+0

ようこそ、友人:) – Codesingh

関連する問題