react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

Had to modify types file for linting to pass...

Open NoodleOfDeath opened this issue 1 year ago β€’ 6 comments

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-calendars/src/calendar/index.d.ts b/node_modules/react-native-calendars/src/calendar/index.d.ts
index 56915b1..353509f 100644
--- a/node_modules/react-native-calendars/src/calendar/index.d.ts
+++ b/node_modules/react-native-calendars/src/calendar/index.d.ts
@@ -54,9 +54,5 @@ export interface CalendarProps extends CalendarHeaderProps, DayProps {
  * @example: https://github.com/wix/react-native-calendars/blob/master/example/src/screens/calendars.js
  * @gif: https://github.com/wix/react-native-calendars/blob/master/demo/assets/calendar.gif
  */
-declare const Calendar: {
-    (props: CalendarProps & ContextProp): React.JSX.Element;
-    displayName: string;
-    propTypes: any;
-};
+declare const Calendar: (props: CalendarProps & ContextProp) => React.JSX.Element;
 export default Calendar;

This issue body was partially generated by patch-package.

NoodleOfDeath avatar Dec 18 '24 18:12 NoodleOfDeath

A workaround here:

import { Calendar as BaseCalendar, CalendarProps } from 'react-native-calendars';
import { ContextProp } from 'react-native-calendars/src/types';

export const Calendar = (props: CalendarProps & ContextProp) => {
  return <BaseCalendar {...props} />;
};

Kurogoma4D avatar Feb 03 '25 06:02 Kurogoma4D

If a workaround is required, they need to make a patch... Wix hopefully has lots of devs to make the PR

NoodleOfDeath avatar Feb 03 '25 12:02 NoodleOfDeath

An workaround here:

import { Calendar as BaseCalendar, CalendarProps } from 'react-native-calendars'; import { ContextProp } from 'react-native-calendars/src/types';

export const Calendar = (props: CalendarProps & ContextProp) => { return <BaseCalendar {...props} />; };

@Kurogoma4D this is inside of a custom component file or index.d.ts?

NoodleOfDeath avatar Feb 03 '25 12:02 NoodleOfDeath

@NoodleOfDeath It's a custom component. I agree to need some patch, but this workaround is required for me.

Kurogoma4D avatar Feb 05 '25 01:02 Kurogoma4D

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 06 '25 01:05 stale[bot]

@NoodleOfDeath It's a custom component. I agree to need some patch, but this workaround is required for me.

This patch is just to make TypeScript linting happy, which means vscode will throw a lot of errors without the patch/workaround

NoodleOfDeath avatar May 06 '25 10:05 NoodleOfDeath

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 21 '25 23:08 stale[bot]