我正在尝试使用弹性盒子布局来将我的图标对齐到按钮视图的左侧,而将文本居中。目前它们都居中对齐,但我不知道如何让我的图标在保持文本居中的同时在按钮的最左边缘。
现在我的按钮看起来像这样: 我正在使用 https://github.com/APSL/react-native-button 来创建按钮,以及https://github.com/oblador/react-native-vector-icons 来添加图标。
以下是我的一些代码:
现在我的按钮看起来像这样: 我正在使用 https://github.com/APSL/react-native-button 来创建按钮,以及https://github.com/oblador/react-native-vector-icons 来添加图标。
以下是我的一些代码:
<Button style={signupStyles.facebookButton}>
<View style={signupStyles.nestedButtonView}>
<Icon
name="facebook"
size={30}
color={'white'}
/>
<Text style={signupStyles.buttonText}>Continue with Facebook</Text>
</View>
</Button>
var signupStyles = StyleSheet.create({
buttonText: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
facebookButton: {
backgroundColor: styleConstants.facebookColor,
borderColor: styleConstants.facebookColor,
borderWidth: 2,
borderRadius: 22,
},
nestedButtonView: {
flexDirection: 'row',
alignItems: 'center',
},
});