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

[No QA] [TS migration] Migrate 'LinearGradient' component to TypeScript #29580

3 changes: 0 additions & 3 deletions src/components/LinearGradient/index.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/LinearGradient/index.native.js

This file was deleted.

6 changes: 6 additions & 0 deletions src/components/LinearGradient/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import LinearGradientNative from 'react-native-linear-gradient';
import LinearGradient from './types';

const LinearGradientImplementation: LinearGradient = LinearGradientNative;

export default LinearGradientImplementation;
6 changes: 6 additions & 0 deletions src/components/LinearGradient/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import LinearGradientWeb from 'react-native-web-linear-gradient';
import LinearGradient from './types';

const LinearGradientImplementation: LinearGradient = LinearGradientWeb;

export default LinearGradientImplementation;
6 changes: 6 additions & 0 deletions src/components/LinearGradient/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import LinearGradientWeb from 'react-native-web-linear-gradient';
import LinearGradientNative from 'react-native-linear-gradient';

type LinearGradient = typeof LinearGradientWeb | typeof LinearGradientNative;

export default LinearGradient;
17 changes: 17 additions & 0 deletions src/types/modules/react-native-web-linear-gradient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable @typescript-eslint/consistent-type-definitions */
declare module 'react-native-web-linear-gradient' {
kubabutkiewicz marked this conversation as resolved.
Show resolved Hide resolved
import type {ViewProps} from 'react-native';

interface LinearGradientProps extends ViewProps {
colors: string[];
start?: {x: number; y: number};
end?: {x: number; y: number};
locations?: number[];
useAngle?: boolean;
angle?: number;
}

class LinearGradient extends React.PureComponent<LinearGradientProps> {}

export default LinearGradient;
}
Loading