2017-04-12 9 views
11

私はreact-native-hrパッケージを試しました。私にとってもAndroidではなく、iOSでも動作しません。それはあなたが単に下の境界と、空のビューを使用することができ、エンドリアクトネイティブの水平ルールを描く

<Text numberOfLines={1}}>    
    ______________________________________________________________ 
</Text> 

答えて

46

にある3個のドットをレンダリングするため

次のコードも適していません。

<View 
    style={{ 
    borderBottomColor: 'black', 
    borderBottomWidth: 1, 
    }} 
/> 
+0

を、私はこの方法を考える必要があります。ありがとうございました! – gumkins

+2

'borderBottomWidth:StyleSheet.hairlineWidth': –

+0

が動作しない場合は、alignSelf: 'stretch'を追加することをお勧めします。 – Scientist1642

0

なぜこのようなことをしないのですか?

<View 
    style={{ 
    borderBottomWidth: 1, 
    borderBottomColor: 'black', 
    width: 400, 
    }} 
/> 
2
import { View, Dimensions } from 'react-native' 

var { width, height } = Dimensions.get('window') 

// Create Component 

<View style={{ 
    borderBottomColor: 'black', 
    borderBottomWidth: 0.5, 
    width: width - 20,}}> 
</View> 
5

一つはAの幅を変更するためにマージンを使用することができますそれを中央に置きます。

<View style = {styles.lineStyle} /> 

lineStyle:{ 
     borderWidth: 0.5, 
     borderColor:'black', 
     margin:10, 
    } 

余裕を動的に与えたい場合は、寸法幅を使用できます。

+0

ありがとうございます。 '