Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No overload matches this call. [ RN 0.72.3 + EXPO 49 + TS ] #345

Open
mashwishi opened this issue Dec 18, 2023 · 0 comments
Open

Comments

@mashwishi
Copy link

Code:

import React, { useRef } from "react";
import { Text, Platform, KeyboardAvoidingView, SafeAreaView, ScrollView } from "react-native";
import { actions, RichEditor, RichToolbar } from "react-native-pell-rich-editor";


const handleHead = ({ tintColor }: { tintColor: string }) => <Text style={{ color: tintColor }}>H1</Text>
const TempScreen = () => {

    const richText = React.createRef() || useRef();

    return (
        <SafeAreaView>
            <ScrollView>
                <KeyboardAvoidingView behavior={Platform.OS === "ios" ? "padding" : "height"} style={{ flex: 1 }}>
                    <Text>Description:</Text>
                    <RichEditor
                        ref={richText}
                        onChange={descriptionText => {
                            console.log("descriptionText:", descriptionText);
                        }}
                    />
                </KeyboardAvoidingView>
            </ScrollView>

            <RichToolbar
                editor={richText}
                actions={[actions.setBold, actions.setItalic, actions.setUnderline, actions.heading1]}
                iconMap={{ [actions.heading1]: handleHead }}
            />
        </SafeAreaView>
    );
};

export default TempScreen;

Error:

No overload matches this call.
  Overload 1 of 2, '(props: RichEditorProps | Readonly<RichEditorProps>): RichEditor', gave the following error.
    Type 'RefObject<unknown>' is not assignable to type 'LegacyRef<RichEditor> | undefined'.
      Type 'RefObject<unknown>' is not assignable to type 'RefObject<RichEditor>'.
        Type 'unknown' is not assignable to type 'RichEditor'.
  Overload 2 of 2, '(props: RichEditorProps, context: any): RichEditor', gave the following error.
    Type 'RefObject<unknown>' is not assignable to type 'LegacyRef<RichEditor> | undefined'.ts(2769)
index.d.ts(125, 9): The expected type comes from property 'ref' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<RichEditor> & Readonly<RichEditorProps>'
index.d.ts(125, 9): The expected type comes from property 'ref' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<RichEditor> & Readonly<RichEditorProps>'

Versions:

{
  //other...
  "dependencies": {
     //other...
    "react-native-pell-rich-editor": "^1.9.0",
    "@types/react-dom": "^18.2.18",
    "expo": "49.0.3",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-native": "0.72.3",
    "react-native-webview": "^13.6.3",
  },
  "devDependencies": {
     //other...
    "@babel/core": "7.19.3",
    "@types/react": "^18.2.45",
    "@types/react-native": "0.72.2",
    "typescript": "5.0.2"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant