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

ModalProps issue in TypeScript #696

Open
davidarny opened this issue Aug 29, 2022 · 4 comments · May be fixed by #715
Open

ModalProps issue in TypeScript #696

davidarny opened this issue Aug 29, 2022 · 4 comments · May be fixed by #715

Comments

@davidarny
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-modal@13.0.1 for the project I'm working on.

I'm having trouble when using ModalProps in a custom component like this

function Modal(props: ModalProps) {
  return (
    <RNModal
      {...props}
      backdropOpacity={0.2}
      backdropTransitionOutTiming={0}
    />
  )
}

I'm getting this error then

Type '{ children: Element; isVisible: boolean; onBackdropPress: () => void; }' is missing the following properties from type '{ animationIn: "bounce" | "flash" | "jello" | "pulse" | "rotate" | "rubberBand" | "shake" | "swing" | "tada" | "wobble" | "bounceIn" | "bounceInDown" | "bounceInUp" | "bounceInLeft" | ... 48 more ... | CustomAnimation<...>; ... 30 more ...; supportedOrientations: ("landscape" | ... 3 more ... | "landscape-right")[]; }': animationIn, animationInTiming, animationOut, animationOutTiming, and 26 more.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-modal/dist/modal.d.ts b/node_modules/react-native-modal/dist/modal.d.ts
index b63bcfc..1234392 100644
--- a/node_modules/react-native-modal/dist/modal.d.ts
+++ b/node_modules/react-native-modal/dist/modal.d.ts
@@ -62,7 +62,7 @@ export declare type ModalProps = ViewProps & {
     onOrientationChange?: OnOrientationChange;
     presentationStyle?: PresentationStyle;
     useNativeDriverForBackdrop?: boolean;
-} & typeof defaultProps;
+} & Partial<typeof defaultProps>;
 export declare class ReactNativeModal extends React.Component<ModalProps, State> {
     static propTypes: {
         animationIn: PropTypes.Requireable<string | object>;

This issue body was partially generated by patch-package.

@robrechtme robrechtme linked a pull request Dec 9, 2022 that will close this issue
@leonamjlpaula
Copy link

Any change to have this merged soon pls?

@arunbluez
Copy link

Yes can we have this merged, thanks. I am faced with the same issue

@Aryk
Copy link
Contributor

Aryk commented Sep 6, 2023

Hey guys, just bumping this...seems like a pretty easy low risk fix. Can we get this one-line changed added to the next minor update?

@RongDuJiKsp
Copy link

It is hoped that this request can be merged as soon as possible, which will have a great impact on ts users :)

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

Successfully merging a pull request may close this issue.

5 participants