我正在渲染视图数组,然后在按钮组中渲染。 如何更改单个按钮元素的宽度? 在这里,我只是改变视图的宽度。
playerNumBtn = () => {
return (
<View style={{ backgroundColor: 'lightGreen', flex: 1, borderWidth: '50%', width: '50%', height: '100%', borderWidth: 1, }}>
<Text># {this.state.players[i].number}</Text>
</View>
);
}
rowofbuttons = [{ element: playerNumBtn },
{ element: playerNameBtn }, { element: onePointBtn },
{ element: twoPointBtn }, { element: threePointBtn },
{ element: assistBtn }, { element: reboundBtn },
{ element: stealBtn }, { element: blockBtn }, { element: foulBtn }]
<ButtonGroup style = {styles.buttonGroupStyle}
buttons={rowofbuttons}
underlayColor={'rgba(127, 220, 103, 1)'}
selectMultiple
selectedIndexes={this.state.selectedIndexes}
onPress={selectedIndexes => {
this.setState({ selectedIndexes });
}}
containerStyle={{ marginBottom: 0, marginTop:0 }}
/>
buttonGroupStyle: {
marginTop: 0,
marginBottom: 0,
},