Add @types to support the project with typescript
ssthil opened this issue · comments
Senthil Sivaramakrishnan commented
ayusch-apps-curefit commented
Any updates on this ? I'm still getting : could not find a declaration file for module react-native-radial-gradient.
Even though there's index.d.ts present.
Rizky Bayu Oktavian commented
Any updates on this ? I'm still getting : could not find a declaration file for module react-native-radial-gradient.
Even though there's index.d.ts present.
hi, you can use mine :
create 1 file in your typings folder called react-native-radial-gradient.d.ts
declare module 'react-native-radial-gradient' {
import {Component} from 'react';
import {StyleProp, ViewStyle} from 'react-native';
interface RadialGradientProps {
center?: [number, number];
colors?: [string, string];
radius?: number;
style?: StyleProp<ViewStyle>;
stops?: number[];
}
export default class RadialGradient extends Component<RadialGradientProps> {}
}
alemarra89 commented
@surajitsarkar19 I think this problem is still there.
@rbayuokt 's code is a good tip, but we shouldn't have to type it manually.
Sohan Dutta commented
For using with Functional Components, changed the typing too:
declare module 'react-native-radial-gradient' {
import type { ReactElement } from 'react';
import type { StyleProp, ViewStyle } from 'react-native';
interface RadialGradientProps {
center?: [number, number];
colors?: [string, string];
radius?: number;
style?: StyleProp<ViewStyle>;
stops?: number[];
children?: ReactElement;
}
export default function RadialGradient(props: RadialGradientProps): JSX.Element {}
}