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

React Native rich text editor based on ZSSRichTextEditor
Other
841 stars 311 forks source link

onChange #170

Open bamaarintoko opened 5 years ago

bamaarintoko commented 5 years ago

how to detect onValueChanged?

JMackR commented 5 years ago

Check this link https://github.com/wix/react-native-zss-rich-text-editor/issues/1

bamaarintoko commented 5 years ago

@jimreynolds67 that not work bro, i have tried

JMackR commented 5 years ago

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()} /> ... }