adminjs icon indicating copy to clipboard operation
adminjs copied to clipboard

Unable to add custom components

Open AKNiazi opened this issue 6 years ago • 1 comments

I am using admin-bro with express js and everything seemed to me be working fine until I tried to add custom component to change an input field of a resource. Following is the code I am using.

EditLogoField.jsx

const React = require('react');

class EditLogoField extends React.PureComponent {
   render() {
     return (
       <input type='file'/>
     );
   }
}
 module.exports = EditLogoField;

I am trying to use it like this

const AdminBro = require('admin-bro');

module.exports = {
  properties: {
    logo: {
      type: 'string',
      isVisible: {
        list: false,
        edit: true,
        filter: false,
        show: true,
      },
      components: {
        edit: AdminBro.bundle('../components/serviceProviderCompany/EditLogoField')
      }
    },
  },
};

All I get is this

admin-bro-error

AKNiazi avatar May 12 '20 06:05 AKNiazi

I removed .adminbro folder and changed by EditLogoField.jsx to

import React from 'react';

class EditLogoField extends React.PureComponent {
   render() {
     return (
       <input type='file'/>
     );
   }
}
export default EditLogoField;

and it works fine now.

AKNiazi avatar May 16 '20 10:05 AKNiazi