Hey SurveyJS community,
I'm having trouble using survey-react-ui
components, particularly the <SurveyQuestionText />
component, within a custom widget that extends SurveyQuestionBase
. I've followed the documentation and examples, but unfortunately, it's not working as expected.
TypeScriptimport React from 'react';
import { QuestionTextModel } from 'survey-core';
import { SurveyQuestionElementBase, SurveyQuestionText } from 'survey-react-ui';
class CustomWidget extends SurveyQuestionElementBase {
constructor(props) {
super(props);
}
render() {
return (
<div>
<div>Hello world</div> {/* This line is show on the screen */}
{/* This is where I'm trying to use <SurveyQuestionText /> */}
<SurveyQuestionText question={new QuestionTextModel('abc')} /> {/* Now this line should display correctly. But it didn't display */}
</div>
);
}
}
export default CustomWidget;
I've ensured that survey-core
and survey-react-ui
are properly installed. I would appreciate any guidance or examples on how to correctly use survey-react-ui
components within my custom widget.
Thanks in advance for your help!