RichtoolBar causing warning: To fix, cancel all subscriptions and asynchronous task in the componentWillUnmount method
See original GitHub issueWhen I use the toolbar and then go back to the previous screen the warning comes out, but if i dont, this warning doesnt come out, i dont know why its causing this, this is my toolbar:
<RichToolbar editor = {this.richText} onPressAddImage = {this.insertImage} actions = {[ actions.insertBulletsList, actions.insertOrderedList, actions.insertImage, "change_text_color", ]} iconMap ={{ [actions.insertBulletsList]: () => <Text style = {this.styles.icon}><MaterialIcons name = "format-list-bulleted" size = {this.option_icon.size} color = {this.option_icon.color}/></Text>, [actions.insertOrderedList]: () => <Text style = {this.styles.icon}><MaterialIcons name = "format-list-numbered" size = {this.option_icon.size} color = {this.option_icon.color}/></Text>, [actions.insertImage]: () => <Text style = {this.styles.icon}><MaterialIcons name = "image" size = {this.option_icon.size} color = {this.option_icon.color}/></Text>, change_text_color: () => <Text style = {this.styles.icon}><MaterialIcons name = "format-color-text" size = {this.option_icon.size} color = {this.option_icon.color}/></Text>, }} change_text_color = {this.change_color} style = {{backgroundColor: backgroundColor, borderTopWidth: 1}}> </RichToolbar>
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (1 by maintainers)
Top GitHub Comments
This is how I did it – the text doesn’t get highlighted when I scroll.
<ScrollView style={{ height: 300 }} keyboardDismissMode={“none”}> <InsertLinkModal onCancel={() => onCancel()} onDone={(title, url) => onLinkDone(title, url)} isVisible={modalVisible} /> <RichEditor ref={richText} useContainer={false} containerStyle={{ minHeight: height, height: height, width: “100%”, borderWidth: 1, borderColor: CONSTANTS.LIGHT_BG_COLOR, }} editorStyle={{ backgroundColor: “white”, borderColor: CONSTANTS.PRIMARY_COLOR, }} placeholder=“Type your action here.” editorInitializedCallback={editorInitializedCallback} onHeightChange={(e) => { if (e > 300) { setHeight(e); } }} /> </ScrollView>
no, mine doesn’t highlight. I think I found a way not to crash the app. What causes it is the toolbar so I waited for the RichEditor to be loaded before I load the toolbar.
{mounted == true ? ( <RichToolbar editor={richText} … /> ) : null}