Skip to content

Can not use style property to custom the toast style in typescript #127

@chengwb53

Description

@chengwb53

hello ,im use react-native-easy-toast 2.3.0 in my project, and use the style property get some error:

TS2769: No overload matches this call.   Overload 1 of 2, '(props: ToastComponentProps | Readonly<ToastComponentProps>): Toast', gave the following error.     Type '{ ref: (toastRef: Toast) => void; style: { backgroundColor: string; }; textStyle: TextStyle; position: ToastPositionType; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Toast> & Readonly<ToastComponentProps>'.       Property 'style' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Toast> & Readonly<ToastComponentProps>'.   Overload 2 of 2, '(props: ToastComponentProps, context: any): Toast', gave the following error.     Type '{ ref: (toastRef: Toast) => void; style: { backgroundColor: string; }; textStyle: TextStyle; position: ToastPositionType; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Toast> & Readonly<ToastComponentProps>'.       Property 'style' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Toast> & Readonly<ToastComponentProps>'.

i find the ToastComponentProps interface:

interface ToastComponentProps {
  position?: "bottom" | "center" | "top";
  textStyle?: {};
  positionValue?: number;
  fadeInDuration?: number;
  fadeOutDuration?: number;
  opacity?: number;
}

no style property

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions