Skip to content

Commit e87fefc

Browse files
authored
fix: data table text should allow growth (#180)
1 parent ec28138 commit e87fefc

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

example/src/Views/DataTable.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { StyleSheet, ScrollView, Alert } from 'react-native';
3-
import { DataTableCell, DataTableRow, DataTableHeader, DataTableHeaderProps, DataTable, Checkbox, DataTableHeaderSelected } from '@carbon/react-native';
3+
import { DataTableCell, DataTableRow, DataTableHeader, DataTableHeaderProps, DataTable, Checkbox, DataTableHeaderSelected, Text } from '@carbon/react-native';
44
import AddIcon from '@carbon/icons/es/add/20';
55
import SearchIcon from '@carbon/icons/es/search/20';
66
import SettingsIcon from '@carbon/icons/es/settings/20';
@@ -94,7 +94,7 @@ export default class TestDataTable extends React.Component {
9494
</DataTableRow>
9595
<DataTableRow>
9696
<DataTableCell noPadding={true} width={48} content={<Checkbox style={styles.checkbox} hideLabel={true} label="Checkbox row 2" id="checkbox-2" onPress={(value) => this.setState({ checked2: value })} checked={checked2} />} />
97-
<DataTableCell onPress={() => this.alert('Pressed long name cell')} content="Jack Long name that is going to be too big for screen" />
97+
<DataTableCell onPress={() => this.alert('Pressed long name cell')} content={<Text text="Testing larger text" type="heading-03" />} />
9898
<DataTableCell content="3/4/1985" width={100} />
9999
</DataTableRow>
100100
<DataTableRow onPress={() => this.alert('Pressed row 3')}>

src/components/DataTable/DataTableCell.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ export class DataTableCell extends React.Component<DataTableCellProps> {
4040

4141
return StyleSheet.create({
4242
wrapper: {
43-
height: 48,
4443
padding: noPadding ? 0 : 16,
4544
paddingBottom: noPadding ? 0 : 15,
4645
paddingTop: noPadding ? 0 : 15,
4746
flex: 1,
47+
justifyContent: 'center',
4848
},
4949
});
5050
}

src/components/DataTable/DataTableRow.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ export class DataTableRow extends React.Component<DataTableRowProps> {
3030
return StyleSheet.create({
3131
wrapper: {
3232
backgroundColor: getColor('layer01'),
33-
maxHeight: 48,
34-
height: 48,
33+
minHeight: 48,
3534
flexDirection: 'row',
3635
width: '100%',
3736
borderTopColor: getColor('borderSubtle00'),

0 commit comments

Comments
 (0)