我有两个按钮排成一排,间隔为 20,它们占据了按钮标题所需的宽度。它们的宽度没有改变!
按钮代码
<View style={styles.buttonContainer}>
<View style={{ paddingLeft: 20 }}>
<Button title={tick} style={styles.button} onPress color="tomato" />
</View>
<View style={{ paddingLeft: 20 }}>
<Button title="X" style={styles.button} onPress color="tomato" />
</View>
</View>
Run Code Online (Sandbox Code Playgroud)
按钮的 CSS
buttonContainer: {
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end'
},
button: {
width: 50, // no matter what value I set here, their width doesn't changes
height: 20,
},
Run Code Online (Sandbox Code Playgroud)