wix-incubator/react-native-zss-rich-text-editor

onChange

bamaarintoko opened this issue · 3 comments

how to detect onValueChanged?

Check this link #1

@jimreynolds67 that not work bro, i have tried

Here's what worked for me... if I understands what your looking for
Im using it to listen for a character '@' in order to trigger a mentions function.

onEditorInitialized = () => {
this.setFocusHandlers();
this.getHTML();
};

async getHTML() {
this.richtext.registerContentChangeListener(str => {
this.setState({ commentText: str })
this.onChangeText(str);
});
}

render() {
...
<RichTextEditor
ref={r => (this.richtext = r)}
style={{
alignItems: "center",
justifyContent: "center",
backgroundColor: "transparent",
width: (width / 100) * 80,
height: (height / 100) * 24,
}}
contentPlaceholder="+ Add a Comment"
hiddenTitle={true}
enableOnChange={true}
initialContentHTML=""
editorInitializedCallback={() => this.onEditorInitialized()}
/>
...
}