Hi I am still having issues with props coming back undefined in custom renderers.
For example this is a custom renderer I am working on and I have imported the custom renderer appropriately, but options is coming back undefined.
import React, { useMemo } from ‘react’;
import PropTypes from ‘prop-types’;
import { MenuItem, Select } from ‘@mui/material’;
import merge from ‘lodash/merge’;
export const i18nDefaults = {
‘enum.none’: ‘None’
};
export const MuiSelect = ({ data, className, id, enabled, schema, uischema, path, handleChange, options, config, t }) => {
const appliedUiSchemaOptions = merge({}, config, uischema.options);
const noneOptionLabel = useMemo(
() => t(‘enum.none’, i18nDefaults[‘enum.none’], { schema, uischema, path }),
[t, schema, uischema, path]
);
{
console.log(options);
}
return (
<Select
className={className}
id={id}
disabled={!enabled}
autoFocus={appliedUiSchemaOptions.focus}
value={data !== undefined ? data : ‘’}
onChange={ev => handleChange(path, ev.target.value || undefined)}
fullWidth={true}
variant={‘standard’}>
{[
<MenuItem value={‘’} key=“jsonforms.enum.none”>
{noneOptionLabel}
].concat(
options.map(optionValue => (
{optionValue.label}
))
)}
);
};
MuiSelect.propTypes = {
options: PropTypes.arrayOf(PropTypes.any),
className: PropTypes.any,
id: PropTypes.any,
enabled: PropTypes.any,
schema: PropTypes.any,
uischema: PropTypes.any,
path: PropTypes.any,
handleChange: PropTypes.any,
config: PropTypes.any,
t: PropTypes.any,
data: PropTypes.any
};