10play / 10tap-editor

React Native Rich Text Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type error when using basic example and adding any bridgeExtension

kimproductions opened this issue · comments

Versions:
"@10play/tentap-editor": "^0.4.55",
"expo": "~50.0.14",
I'm using the iOS simulator with expo go, but I also tried eas build and running it on the dev client and I got the same error.

I just have just made a simple expo project and used nothing but the example code for 10tap in the docs. It works fine but when I add the bridgeExtensions field, I get this error:

ERROR  TypeError: editor.updateScrollThresholdAndMargin is not a function (it is undefined)

This error is located at:
    in RichText (at App.js:24)
    in RCTSafeAreaView (at App.js:23)
    in Basic (at withDevTools.ios.js:25)
    in withDevTools(Basic) (at renderApplication.js:57)
    in RCTView (at View.js:116)
    in View (at AppContainer.js:127)
    in RCTView (at View.js:116)
    in View (at AppContainer.js:155)
    in AppContainer (at renderApplication.js:50)
    in main(RootComponent) (at renderApplication.js:67), js engine: hermes

Interestingly when I make it "avoidIosKeyboard: false" then the error disappears but the editor doesn't work.

Here's my code:

import React, { useEffect } from "react";
import {
    SafeAreaView,
    View,
    KeyboardAvoidingView,
    Platform,
    StyleSheet,
} from "react-native";
import {
    LinkBridge,
    RichText,
    Toolbar,
    useEditorBridge,
} from "@10play/tentap-editor";

export const Basic = () => {
    const editor = useEditorBridge({
        autofocus: true,
        avoidIosKeyboard: true,
        bridgeExtensions: [LinkBridge.configureExtension({ openOnClick: false })],
        initialContent: initialContent,
    });
    return (
        <SafeAreaView style={exampleStyles.fullScreen}>
            <RichText editor={editor} />
            <KeyboardAvoidingView
                behavior={Platform.OS === "ios" ? "padding" : "height"}
                style={exampleStyles.keyboardAvoidingView}
            >
                <Toolbar editor={editor} />
            </KeyboardAvoidingView>
        </SafeAreaView>
    );
};

Also seeing this.

Fixed by spreading the tentap skarting kit. bridgeExtensions: [...TenTapStartKit, LinkBridge]

Yes, you'd need to have the CoreBridge add at-least, but then you need to keep in mind that other extensions won't be used