Skip to content

Commit

Permalink
Fix AutocompleteArrayInput 'custom options' story
Browse files Browse the repository at this point in the history
  • Loading branch information
slax57 committed Jun 7, 2023
1 parent e09bca3 commit ddf6c40
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import * as React from 'react';
import { Admin } from 'react-admin';
import { RaRecord, Resource, required, useCreate } from 'ra-core';
import {
RaRecord,
Resource,
required,
useCreate,
useRecordContext,
} from 'ra-core';
import polyglotI18nProvider from 'ra-i18n-polyglot';
import englishMessages from 'ra-language-english';
import { createMemoryHistory } from 'history';
Expand Down Expand Up @@ -226,11 +232,14 @@ export const CustomTextFunction = () => (
</Admin>
);

const CustomOption = ({ record, ...rest }: { record?: RaRecord }) => (
<div {...rest}>
{record?.fullName}&nbsp;<i>({record?.language})</i>
</div>
);
const CustomOption = () => {
const record = useRecordContext();
return (
<div>
{record?.fullName}&nbsp;<i>({record?.language})</i>
</div>
);
};

const BookEditCustomOptions = () => {
const choices = [
Expand Down

0 comments on commit ddf6c40

Please sign in to comment.