TextInput 在右侧添加文本 react native
TextInput add text on the right side react native
大家好,这是我的代码
<View style={{flex:1,flexDirection:'row',paddingBottom:5, borderColor:'#ccc',borderBottomWidth:1}}>
<TextInput
placeholder = "Wallet"
placeholderTextColor="#000"
/>
<Text style={{alignSelf:'center'}}>
{userData.wallet}
</Text>
</View>
输出:
预期输出:
当我尝试 alignSelf:flex-end
时,它会因为 flex:'row'
而下降
求助。
只需将 justify-content: space-between
添加到 View
:
<View style={{flex:1,flexDirection:'row',paddingBottom:5, borderColor:'#ccc',borderBottomWidth:1,justifyContent:'space-between'}}>
<TextInput
placeholder = "Wallet"
placeholderTextColor="#000"
/>
<Text style={{alignSelf:'center'}}>
{userData.wallet}
</Text>
</View>
大家好,这是我的代码
<View style={{flex:1,flexDirection:'row',paddingBottom:5, borderColor:'#ccc',borderBottomWidth:1}}>
<TextInput
placeholder = "Wallet"
placeholderTextColor="#000"
/>
<Text style={{alignSelf:'center'}}>
{userData.wallet}
</Text>
</View>
输出:
预期输出:
当我尝试 alignSelf:flex-end
时,它会因为 flex:'row'
求助。
只需将 justify-content: space-between
添加到 View
:
<View style={{flex:1,flexDirection:'row',paddingBottom:5, borderColor:'#ccc',borderBottomWidth:1,justifyContent:'space-between'}}>
<TextInput
placeholder = "Wallet"
placeholderTextColor="#000"
/>
<Text style={{alignSelf:'center'}}>
{userData.wallet}
</Text>
</View>