呈现 Utility & Sequences 按钮的代码如下:
<Fragment>
<Text style={styles.sectionTitle}>Utility</Text>
<View style={styles.buttonContainer}>
<Button onPress={this.readErrorObject} style={styles.button} title='Get Error' />
<Button onPress={this.readDump} style={styles.button} title='Read Dump' />
<Button onPress={this.readLog} style={styles.button} title='Read Log' />
<Button onPress={this.clearError} style={styles.button} title='Clear Error' />
</View>
<Text style={styles.sectionTitle}>Sequences</Text>
<View style={styles.buttonContainer}>
<Button onPress={this.firstRun} style={styles.button} title='First Run' />
<Button onPress={this.resetDevice} style={styles.button} title='Reset Device' />
</View>
</Fragment>
风格
const styles = StyleSheet.create({
sectionTitle: {
fontSize: 16,
fontWeight: '600',
color: '#000000'
},
buttonContainer: {
flex: 1,
flexWrap: 'wrap',
flexDirection: 'row',
justifyContent: 'space-between',
alignContent: 'space-between'
},
button: {
marginVertical: 8 // DOESN'T WORK
}
})
当第四个按钮下降到下一行时,我希望新行和上一行之间有一个间距。我尝试为每个有边距的按钮添加样式,但这没有区别。我在这里遗漏了什么?提前致谢。