-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in extending PaperRenderer #25
Comments
MyCustomStencilComponent is just alias for a constant string variable that you define in your renderer. For example, in the reference above I could use TYPE_NAME in the App component. import MyCustomStencil from './MyCustomStencil';
const TYPE_NAME = 'myStencil';
class MyPaperRenderer extends PaperRenderer {
getInstanceFactory() {
return {
...this.defaultTypes, /*
refer to default types
see https://github.com/psychobolt/react-paperjs/blob/master/src/Paper.types.js#L42
*/
[TYPE_NAME]: (props, paper) => new MyCustomStencil(props),
};
}
}
const App = (props) => (
<PaperContainer renderer={MyPaperRenderer}>
<TYPE_NAME />
</PaperContainer>
); You can look at the reference, and see there is a link to default types. Below is additional info, not pertaining to your original question but helpful to the docs. There is no specific structure for the class |
Oh, Thanks a lot @psychobolt , I was close and now issue resolved |
@im-hamza-dev No problem, I just merged a related PR. There is a new version (1.0.3) out now with these changes. |
I am working to add raster feature in app, so looking for the extend feature but documentation is quite limited for me
Any idea what would be the structure of MyCustomStencilComponent here
My code:
Reference:
The text was updated successfully, but these errors were encountered: