Pra*_*jna 5 react-native react-native-paper
默认情况下,列是排列的,如果我尝试为单元格和标题提供宽度,结果没有变化。那么如何明确地安排列宽呢?
<DataTable style={{ height: height }}>
<DataTable.Header>
<DataTable.Title>Name</DataTable.Title>
<DataTable.Title numeric>QTY</DataTable.Title>
<DataTable.Title numeric>AMT</DataTable.Title>
<DataTable.Title numeric>TAX</DataTable.Title>
<DataTable.Title numeric>GROSS</DataTable.Title>
</DataTable.Header>
<ScrollView>
{
data && data.length > 0 ?
data.map((item, index) => {
return (
<DataTable.Row key={index}>
<DataTable.Cell>{item.NAME}</DataTable.Cell>
<DataTable.Cell numeric>{item.QTY}</DataTable.Cell>
<DataTable.Cell numeric>{item.AMT}</DataTable.Cell>
<DataTable.Cell numeric>{item.TAX}</DataTable.Cell>
<DataTable.Cell numeric>{item.GROSS}</DataTable.Cell>
</DataTable.Row>
);
})
:
false
}
</ScrollView>
</DataTable>
Run Code Online (Sandbox Code Playgroud)
Woj*_*iec 11
您可以通过flex
为其设置值来设置特定单元格的宽度。
例如:
<DataTable.Cell style={{flex: 3}}>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3452 次 |
最近记录: |