useKivaFieldComponent
Resolve the native form field, value renderer or inline editor for a Kiva field type — plus the shared FORM_FIELD_MAP / VALUE_RENDERER_MAP registries and IField helpers.
Installation
pnpm dlx @kivacore/ui-cli add @kivacore/rn-hooks-use-kiva-field-componentDepends on @kivacore/rn-form-fields, @kivacore/rn-value-renderers and @kivacore/rn-editable-value (installed with it).
Overview
Native port of the web useKivaFieldComponent. The registries map every IFieldType to native components:
form-field— the IField adapterKivaFieldDynamic, typed asComponentType<KivaFormFieldProps>(field,value,onChange,record,onCompanionChange, …).nullfor types without a native editor mapping (computed / system types).value-renderer— theKivaValue*renderer; unknown types fall back toKivaValueText.editable-value— alwaysEditableValue, which dispatches by field type.
The web-only kinds data-grid-cell-variant and tanstack-column-def live with the native data-grid package.
Usage
import { useKivaFieldComponent } from '@/hooks/kiva-native/use-kiva-field-component';
function FieldRow({ field, record, onChange }) {
const Form = useKivaFieldComponent(field.type, 'form-field');
const Value = useKivaFieldComponent(field.type, 'value-renderer');
if (!Form) return <Value field={field} value={record[field.slug]} record={record} />;
return (
<Form
field={field}
value={record[field.slug]}
record={record}
onChange={value => onChange(field.slug, value)}
onCompanionChange={onChange} />
);
}import { extractEnumOptions, toIField } from '@/hooks/kiva-native/use-kiva-field-component';
// DataSourceField (app-utils) → IField + inline options
const field = toIField(dataSourceField);
const options = extractEnumOptions(dataSourceField);API Reference
useKivaFieldComponent(fieldType, kind)
| Param | Type | Description |
|---|---|---|
fieldType | IFieldType | Field type |
kind | 'form-field' | 'value-renderer' | 'editable-value' | Render context |
Returns KivaFieldComponentResult<K> — ComponentType<KivaFormFieldProps> \| null, ComponentType<KivaValueProps> or typeof EditableValue.
Exports
| Export | Description |
|---|---|
FORM_FIELD_MAP | IFieldType → controlled KivaField* component |
VALUE_RENDERER_MAP | IFieldType → KivaValue* renderer |
GROUPABLE_FIELD_TYPES | Field types usable for row grouping |
extractEnumOptions(field) | Inline options from field.enums / options.options (camel + snake case metadata, user names from firstname lastname) |
toIField(field) | Loose KivaFieldLike → IField |
getFieldValue(row, slug) | Safe value read |
readFieldFormat(field) | KivaFieldFormat from field.format with flat fallbacks |
KivaValueDynamic | Dynamic value renderer (re-export) |
Types
| Type | Description |
|---|---|
KivaFieldComponentKind | 'form-field' | 'value-renderer' | 'editable-value' |
KivaFieldComponentResult<K> | Resolved component type |
KivaFieldLike | Loose field shape (IField or DataSourceField) |
KivaFieldFormat | { currency?, decimalPrecision?, thousandSeparator?, symbolPosition?, ratingMax?, ratingIcon? } |
useKivaEmailComposer
Wires the native EmailComposer to the Kiva messaging API — sender accounts, @ mention users and the send mutation, with composer state managed for you.
useKivaFormView
Create, edit and view forms bound to a Kiva data source on React Native. Loads the schema, record and options, uploads files to Kiva storage and creates or updates the record through the shared form-view engine.