Open Prerna11082 opened 6 years ago
I am trying to use Rich text Editor methods like setBold(), setUnderline(), insertOrderedList() using editor ref. But it is throwing undefined error.
<RichTextEditor style={{flex:1, height:200}} ref={(r)=>this.richtext = r} hiddenTitle={true} contentPlaceholder="New Note" initialContentHTML={this.state.noteBody} editorInitializedCallback={() => this.onEditorInitialized()} /> <RichTextToolbar getEditor={() => this.richtext} renderAction={this._renderToolbarItem} actions={[ actions.setBold, actions.setItalic, actions.setUnderline, actions.insertBulletsList, actions.insertOrderedList ]} />
And in _renderToolbarItem(), I have rendered custom icons for each action. But in onPress of these icons, when I try to access this.richText.setBold(), it throws error undefined is not an object (evaluating 'this.richText.setBold')
You Have to import actions
I have already imported actions
I am trying to use Rich text Editor methods like setBold(), setUnderline(), insertOrderedList() using editor ref. But it is throwing undefined error.
<RichTextEditor style={{flex:1, height:200}} ref={(r)=>this.richtext = r} hiddenTitle={true} contentPlaceholder="New Note" initialContentHTML={this.state.noteBody} editorInitializedCallback={() => this.onEditorInitialized()} /> <RichTextToolbar getEditor={() => this.richtext} renderAction={this._renderToolbarItem} actions={[ actions.setBold, actions.setItalic, actions.setUnderline, actions.insertBulletsList, actions.insertOrderedList ]} />
And in _renderToolbarItem(), I have rendered custom icons for each action. But in onPress of these icons, when I try to access this.richText.setBold(), it throws error undefined is not an object (evaluating 'this.richText.setBold')