I created a class inheriting from the External Panel and tried to insert it into VLayout. At the same time, the following error appears
class App.js
class MyPane.js
Code:
Error: Base class provided for custom class MyPane doesn't appear to be valid. Have you imported or defined it? at SC.defineClass (SC.js:44:1) at ./src/MyPane.js (MyPane.js:3:1) at options.factory (react refresh:6:1) at __webpack_require__ (bootstrap:22:1) at fn (hot module replacement:61:1) at ./src/App.js (index.js:599:1) at options.factory (react refresh:6:1) at __webpack_require__ (bootstrap:22:1) at fn (hot module replacement:61:1) at ./src/index.js (SaveButton.js:26:1) at options.factory (react refresh:6:1) at __webpack_require__ (bootstrap:22:1) at startup:7:1 at startup:7:1
Code:
import React, { Component } from 'react'; import MyPane from './MyPane.js'; import { VLayout } from 'smartclient-pro/react'; class App extends Component { constructor(param) { super(param); }; render() { return ( <VLayout width="600%" height="400%"> <members> <MyPane width="500" height="300" title="aaaaaa"/> </members> </VLayout> ); } } export default App;
Code:
import { SC, ReactComponent, ExternalPane } from 'smartclient-pro/react'; SC.defineClass('MyPane', ExternalPane ); class MyPane extends ExternalPane { static ISC_CLASS_NAME = "MyPane"; static IS_CLASS = true; static NUMERIC_PROPERTIES = {}; static COMPOUND_PROPERTIES = {}; constructor(props) { super(props); this.props = props; } buildPane() { return window.isc.Button.create(this.props); } } Object.defineProperty (MyPane, 'name', {value: 'MyPane'}); ReactComponent.registerClass('MyPane', MyPane); SC.customClasses["MyPane"] = MyPane; export default MyPane;
Comment