react-native-tableview icon indicating copy to clipboard operation
react-native-tableview copied to clipboard

Resize cell height

Open AdamMoffitt opened this issue 5 years ago • 2 comments

Hello, I'm trying to implement custom cells and am unable to change the cell heights. In the documentation you mention being able to manipulate cell heights, but I am not seeing a way to do that. The cells are always the same narrow height of the basic table cell. Help would be much appreciated

AdamMoffitt avatar Jan 07 '20 05:01 AdamMoffitt

@AdamMoffitt I was struggling with this too, but just found you can put a "height" prop on item: <Item height="70" />

dylancom avatar Apr 09 '20 08:04 dylancom

i meet same problem too.Finally, i use Cell instand of Item to render.you can link to here get more detail. simple code

import TableView from 'react-native-tableview';

const { Section, Item, Cell } = TableView;

...

render() {
    <TableView
        style={{ flex: 1}}
        allowsToggle
        allowsMultipleSelection
        tableViewStyle={TableView.Consts.Style.Grouped}
        tableViewCellStyle={TableView.Consts.CellStyle.Subtitle}
        onPress={(event: any) => console.log(event)}
        reactModuleForCell='TableViewExampleCell'
    >
        <Section label="Section 3" arrow={false}>
            <Cell componentHeight={80}>
                <View>
                    <Text>Cell 11</Text>
                    <Text>Cell 12</Text>
                    <Text>Cell 13</Text>
                    <Text>Cell 14</Text>
                    <Text>Cell 15</Text>
                    <Text>Cell 16</Text>
                    <Text>Cell 17</Text>
                </View>
            </Cell>
            <Cell componentHeight={80}><Text>Cell 2</Text></Cell>
            <Cell componentHeight={80}><Text>Cell 3</Text></Cell>
        </Section>
    </TableView>
}

RexYao97 avatar Sep 13 '22 10:09 RexYao97