Skip to content

Commit

Permalink
Merge branch 'main' of github.com:blb-ventures/react-flat-list
Browse files Browse the repository at this point in the history
  • Loading branch information
edusig committed Apr 28, 2023
2 parents 95e7f4b + ed0ef68 commit 201a515
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@blb-ventures/react-flat-list",
"version": "0.6.3",
"version": "0.6.4",
"description": "",
"main": "./lib/index.js",
"module": "./lib/index.mjs",
Expand Down
4 changes: 2 additions & 2 deletions src/flat-list-empty-message.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, ReactNode } from 'react';

export const FlatListEmptyMessage: FC<{ children: ReactNode; className: string }> = ({
export const FlatListEmptyMessage: FC<{ children: ReactNode; className?: string }> = ({
children,
className,
}) => <div className={`flat-list-empty-message ${className}`}>{children}</div>;
}) => <div className={`flat-list-empty-message ${className ?? ''}`}>{children}</div>;
6 changes: 4 additions & 2 deletions src/flat-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface FlatListItemProps {
className?: string;
contentClassName?: string;
actionIcon?: ReactNode;
subtitleRight?: string;
subtitleRight?: string | ReactNode;
subtitleRightClassName?: string;
subtitleLeft?: string | ReactNode;
subtitleCenterClassName?: string;
Expand Down Expand Up @@ -101,8 +101,10 @@ export const FlatListItem: FC<FlatListItemProps> = ({
) : (
imageRight
)}
{subtitleRight != null && (
{typeof subtitleRight === 'string' ? (
<div className="flat-list-item-content-right-subtitle">{subtitleRight}</div>
) : (
subtitleRight
)}
{right}
{hasActionIcon && (
Expand Down
2 changes: 1 addition & 1 deletion src/object-flat-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const ObjectFlatListItem = <DataType extends Record<string, any>>({
const value = isKeyData(data) ? extra.obj[data.key] : data.getValue(extra.obj);
if (data.formatter) return data.formatter(value);
return value != null ? String(value) : null;
}, [data, extra]);
}, [data, extra.obj]);
const Component = extra.FlatListComponent ?? FlatListItem;
return extra.obj == null ? null : (
<Component
Expand Down
7 changes: 4 additions & 3 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

.flat-list-item-content-left-title {
word-break: break-all;
font-weight: medium;
font-weight: 500;
}

.flat-list-item-content-left-subtitle {
Expand Down Expand Up @@ -81,8 +81,9 @@
}

.flat-list-error-message {
list-style: none;
background-color: rgb(243, 244, 246);
font-weight: medium;
font-weight: 500;
color: rgb(220, 38, 38);
}

Expand All @@ -107,5 +108,5 @@
.flat-list-subheader-title {
font-size: 1.25rem/* 20px */;
line-height: 1.75rem/* 28px */;
font-weight: medium;
font-weight: 500;
}

0 comments on commit 201a515

Please sign in to comment.