Skip to content

Commit

Permalink
Make grow configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek committed Dec 9, 2024
1 parent 31f3e35 commit bef3eef
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/lake/src/components/VirtualizedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export type ColumnCellConfig<T, ExtraInfo> = {

export type ColumnConfig<T, ExtraInfo> = {
id: string;
grow?: boolean;
width: number;
title: string;
renderTitle: (props: ColumnTitleConfig<ExtraInfo>) => ReactNode;
Expand Down Expand Up @@ -473,17 +474,16 @@ export const VirtualizedList = <T, ExtraInfo>({
{ width: centerColumnsWidth, backgroundColor, height: headerHeight },
]}
>
{columns.map(({ id, width, title, renderTitle }, index) => {
{columns.map(({ id, grow = false, width, title, renderTitle }, index) => {
const columnId = `${viewId}_${id}`;
const paddingLeft = index === 0 ? centerFirstCellLeftPadding : 0;
const last = index === columns.length - 1;
const paddingRight = last ? centerLastCellLeftPadding : 0;
const paddingRight = index === columns.length - 1 ? centerLastCellLeftPadding : 0;

return (
<View
style={[
styles.headerCell,
last && styles.grow,
grow && styles.grow,
{ width: width + paddingLeft + paddingRight, paddingLeft, paddingRight },
]}
id={columnId}
Expand Down Expand Up @@ -812,17 +812,16 @@ const RawVirtualizedRow = <T, ExtraInfo>({
},
]}
>
{columns.map(({ id, width, renderCell }, index) => {
{columns.map(({ id, grow = false, width, renderCell }, index) => {
const columnId = `${viewId}_${id}`;
const paddingLeft = index === 0 ? centerFirstCellLeftPadding : 0;
const last = index === columns.length - 1;
const paddingRight = last ? centerLastCellLeftPadding : 0;
const paddingRight = index === columns.length - 1 ? centerLastCellLeftPadding : 0;

return (
<View
style={[
styles.cell,
last && styles.grow,
grow && styles.grow,
{ width: width + paddingLeft + paddingRight, paddingLeft, paddingRight },
]}
key={columnId}
Expand Down

0 comments on commit bef3eef

Please sign in to comment.