custom-widget.tsx create a wrapper
See original GitHub issueAre you requesting a feature, reporting a bug or asking a question?
Requesting a feature/asking a question
What is the current behavior?
What i need is a custom widget that enable itself when some props are selected and renders a wrapper (collapsible) on some questions when checked.
What is the expected behavior?
inside the render function, to have a second parameter : creator, to pass it down to my custom wrapper that basically do
const comp = ReactQuestionFactory.Instance.createQuestion(element.getTemplate(), {
question: element,
isDisplayMode: element.isReadOnly,
creator:????
});
return <div ref={elRef} className={"blu-question"}>
{!element.preCheckHideCheckbox && elRef.current && ReactDOM.createPortal(<CheckBox value={open}
className={className}/>, $(elRef.current).parents(".question").find(".sv_q_title .num")[0])}
<Collapse in={!!collapseOpen}>
<div className={className}>{comp}</div>
</Collapse>
</div>
How would you reproduce the current behavior (if this is a bug)?
Provide the test code and the tested page URL (if applicable)
Tested page URL:
Test code
export const SurveyCheckboxWidget = {
name: "confirmWidget",
render: function (element) {
return <SurveyCheckboxQuestion element={element}></SurveyCheckboxQuestion>
},
isFit: function (question) {
return question.preCheckDisable ||
question.preCheckHideCheckbox ||
question.preCheckCollapse;
},
widgetIsLoaded: function () {
return true; //we do not require anything so we just return true.
},
};
Thanks in advance
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Build a Pluggable Web Widget: Part 1 | Mendix Documentation
Using a terminal or command line, navigate to your new Mendix app's folder, create a new folder named CustomWidgets, and start the generator ......
Read more >How to Use Wrappers in Typescript React - Twilio
The wrapper is an object that is used to maximize code reuse and consistency. They are used to create and support basic UI...
Read more >The One Widget (Part 2) - Esri Community
Wrapper.js - The equivalent to our custom Experience Builder widget, in that it "wraps" our custom component. index.tsx passes a reference ...
Read more >Implementing a custom Netlify CMS widget - Softwire
Writing a custom widget in Typescript ... Great, so we created our widget file in src/cms/boundedList.tsx and immediately encountered a problem.
Read more >ArcGIS API for JavaScript: Customizing Widgets - YouTube
You'll learn about widget view-models and how they make it easy to rewrite a widget's UI. We'll also cover using out-of-the-box themes, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://codepen.io/marcone/pen/JVXqYb
Maybe to do this, instead of using a widget, I need to override reactquestion.tsx:renderQuestionBody and wrap inside my component.
a working solution is:
Do I need to close the bug?
@marc0n3
Not sure why but sometimes your solution gives me a Maximum call stack size exceeded error