@blb-ventures/react-flat-list
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -6,3 +6,4 @@ /// <reference types="react" /> | ||
label: string; | ||
formatter?: (value: unknown) => string; | ||
formatter?: (value: unknown) => string | null; | ||
flatListItemProps?: Partial<FlatListItemProps>; | ||
} | ||
@@ -9,0 +10,0 @@ export interface KeyBasedObjectFlatListItemData<DataType extends Record<string, unknown>> extends BaseObjectFlatListItemData { |
@@ -11,8 +11,5 @@ "use strict"; | ||
const value = 'key' in data ? extra.obj[data.key] : data.getValue(extra.obj); | ||
if (value != null && typeof value !== 'string' && data.formatter == null) { | ||
throw new Error(`Missing formatter for item labeled: ${data.label}`); | ||
} | ||
const formattedValue = data.formatter != null ? data.formatter(value) : value; | ||
return ((0, jsx_runtime_1.jsx)(flat_list_item_1.FlatListItem, Object.assign({ subtitleLeft: data.label, title: (_a = formattedValue !== null && formattedValue !== void 0 ? formattedValue : extra.fallbackValue) !== null && _a !== void 0 ? _a : '-' }, extra.flatListItemProps))); | ||
const formattedValue = data.formatter != null ? data.formatter(value) : value != null ? String(value) : undefined; | ||
return ((0, jsx_runtime_1.jsx)(flat_list_item_1.FlatListItem, Object.assign({ subtitleLeft: data.label, title: (_a = formattedValue !== null && formattedValue !== void 0 ? formattedValue : extra.fallbackValue) !== null && _a !== void 0 ? _a : '-' }, extra.flatListItemProps, data.flatListItemProps))); | ||
}; | ||
exports.ObjectFlatListItem = ObjectFlatListItem; |
{ | ||
"name": "@blb-ventures/react-flat-list", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
27608
458