Set the value displayed on Richtext Editor from database on React Native

Viewed 15

Im using the npm i react-native-pell-rich-editor

I can send the value from richtext to my database without a problem. But I cant display the value stored from my database back to richtext.

The editor have initialContentHTML options. It only displays when I set the state directly with plain text. I want to update the content from my database using richtext but it returns blank on editor.

                 <RichEditor
                  ref={this.state.richText}
                  onChange={this.richTextHandle}
                  initialContentHTML={this.state.description}
                  placeholder="Write your cool content here :)"
                  androidHardwareAccelerationDisabled={true}
                  initialHeight={250}
                />
                <RichToolbar
                  editor={this.state.richText}
                  selectedIconTint="#873c1e"
                  iconTint="#312921"
                  actions={[
                    actions.insertImage,
                    actions.setBold,
                    actions.setItalic,
                    actions.insertBulletsList,
                    actions.insertOrderedList,
                    actions.insertLink,
                    actions.setStrikethrough,
                    actions.setUnderline,
                  ]}
                />

I put a log before the return in render and the log returns blank a few times before returning the state.

console.log('here', this.state.description);

LOG here LOG here LOG here LOG here LOG here LOG here LOG here hello

0 Answers
Related