私はreact-native-hrパッケージを試しました。私にとってもAndroidではなく、iOSでも動作しません。それはあなたが単に下の境界と、空のビューを使用することができ、エンドリアクトネイティブの水平ルールを描く
<Text numberOfLines={1}}>
______________________________________________________________
</Text>
私はreact-native-hrパッケージを試しました。私にとってもAndroidではなく、iOSでも動作しません。それはあなたが単に下の境界と、空のビューを使用することができ、エンドリアクトネイティブの水平ルールを描く
<Text numberOfLines={1}}>
______________________________________________________________
</Text>
にある3個のドットをレンダリングするため
次のコードも適していません。
<View
style={{
borderBottomColor: 'black',
borderBottomWidth: 1,
}}
/>
なぜこのようなことをしないのですか?
<View
style={{
borderBottomWidth: 1,
borderBottomColor: 'black',
width: 400,
}}
/>
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>
たぶん、あなたが反応するネイティブ-時間をこのような何か使用して試してみてください:ドキュメント
<Hr lineColor='#b3b3b3'/>
一つはAの幅を変更するためにマージンを使用することができますそれを中央に置きます。
<View style = {styles.lineStyle} />
lineStyle:{
borderWidth: 0.5,
borderColor:'black',
margin:10,
}
余裕を動的に与えたい場合は、寸法幅を使用できます。
ありがとうございます。 ''の間に何もないので、 '
あなたの歓迎です。編集されました! – Smit
私はこのようにそれをやりました。これは、スタイルに
<View style={styles.hairline} />
<Text style={styles.loginButtonBelowText1}>OR</Text>
<View style={styles.hairline} />
を役に立てば幸い:
hairline: {
backgroundColor: '#A2A2A2',
height: 2,
width: 165
},
loginButtonBelowText1: {
fontFamily: 'AvenirNext-Bold',
fontSize: 14,
paddingHorizontal: 5,
alignSelf: 'center',
color: '#A2A2A2'
},
あなたはまた、react-native-hr-component
npm i react-native-hr-component --save
あなたのコードを試すことができます。
import Hr from 'react-native-hr-component'
//..
<Hr text="Some Text" fontSize={5} lineColor="#eee" textPadding={5} textStyles={yourCustomStyles} hrStyles={yourCustomHRStyles} />
を、私はこの方法を考える必要があります。ありがとうございました! – gumkins
'borderBottomWidth:StyleSheet.hairlineWidth': –
が動作しない場合は、alignSelf: 'stretch'を追加することをお勧めします。 – Scientist1642