From 8600a05567232ee1e51c1fc1d8e44eaade4d1787 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Fri, 13 Oct 2023 19:08:38 +0200 Subject: [PATCH 1/6] ref: moved LinearGradient component to TS --- src/components/LinearGradient/index.js | 3 --- src/components/LinearGradient/index.native.js | 3 --- src/components/LinearGradient/index.native.ts | 6 ++++++ src/components/LinearGradient/index.ts | 6 ++++++ src/components/LinearGradient/types.ts | 6 ++++++ .../react-native-web-linear-gradient.d.ts | 18 ++++++++++++++++++ 6 files changed, 36 insertions(+), 6 deletions(-) delete mode 100644 src/components/LinearGradient/index.js delete mode 100644 src/components/LinearGradient/index.native.js create mode 100644 src/components/LinearGradient/index.native.ts create mode 100644 src/components/LinearGradient/index.ts create mode 100644 src/components/LinearGradient/types.ts create mode 100644 src/types/modules/react-native-web-linear-gradient.d.ts diff --git a/src/components/LinearGradient/index.js b/src/components/LinearGradient/index.js deleted file mode 100644 index 8270681641d0..000000000000 --- a/src/components/LinearGradient/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import LinearGradient from 'react-native-web-linear-gradient'; - -export default LinearGradient; diff --git a/src/components/LinearGradient/index.native.js b/src/components/LinearGradient/index.native.js deleted file mode 100644 index c8d5af2646b2..000000000000 --- a/src/components/LinearGradient/index.native.js +++ /dev/null @@ -1,3 +0,0 @@ -import LinearGradient from 'react-native-linear-gradient'; - -export default LinearGradient; diff --git a/src/components/LinearGradient/index.native.ts b/src/components/LinearGradient/index.native.ts new file mode 100644 index 000000000000..46bed24ebc10 --- /dev/null +++ b/src/components/LinearGradient/index.native.ts @@ -0,0 +1,6 @@ +import LinearGradientNative from 'react-native-linear-gradient'; +import LinearGradient from './types'; + +const LinearGradientImplementation: LinearGradient = LinearGradientNative; + +export default LinearGradientImplementation; diff --git a/src/components/LinearGradient/index.ts b/src/components/LinearGradient/index.ts new file mode 100644 index 000000000000..7246ccf2fb69 --- /dev/null +++ b/src/components/LinearGradient/index.ts @@ -0,0 +1,6 @@ +import LinearGradientWeb from 'react-native-web-linear-gradient'; +import LinearGradient from './types'; + +const LinearGradientImplementation: LinearGradient = LinearGradientWeb; + +export default LinearGradientImplementation; diff --git a/src/components/LinearGradient/types.ts b/src/components/LinearGradient/types.ts new file mode 100644 index 000000000000..555a12f1657c --- /dev/null +++ b/src/components/LinearGradient/types.ts @@ -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; diff --git a/src/types/modules/react-native-web-linear-gradient.d.ts b/src/types/modules/react-native-web-linear-gradient.d.ts new file mode 100644 index 000000000000..a7c43d401670 --- /dev/null +++ b/src/types/modules/react-native-web-linear-gradient.d.ts @@ -0,0 +1,18 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +/* eslint-disable @typescript-eslint/consistent-type-definitions */ +declare module 'react-native-web-linear-gradient' { + 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 {} + + export default LinearGradient; +} From f3182a20c6a84d968a46c7a9ed4551a953ae6d0f Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Tue, 17 Oct 2023 16:46:40 +0200 Subject: [PATCH 2/6] fix: removed uncessary eslint disable --- src/types/modules/react-native-web-linear-gradient.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types/modules/react-native-web-linear-gradient.d.ts b/src/types/modules/react-native-web-linear-gradient.d.ts index a7c43d401670..f41ef6de3a13 100644 --- a/src/types/modules/react-native-web-linear-gradient.d.ts +++ b/src/types/modules/react-native-web-linear-gradient.d.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-empty-interface */ /* eslint-disable @typescript-eslint/consistent-type-definitions */ declare module 'react-native-web-linear-gradient' { import type {ViewProps} from 'react-native'; From fb274a90b68fb5a4f1cfb9ce345b25c2e9fcbce6 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 30 Oct 2023 09:47:42 +0100 Subject: [PATCH 3/6] fix: resolved review comment --- .../modules/react-native-web-linear-gradient.d.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/types/modules/react-native-web-linear-gradient.d.ts b/src/types/modules/react-native-web-linear-gradient.d.ts index f41ef6de3a13..6909ce3dbde2 100644 --- a/src/types/modules/react-native-web-linear-gradient.d.ts +++ b/src/types/modules/react-native-web-linear-gradient.d.ts @@ -1,17 +1,6 @@ /* eslint-disable @typescript-eslint/consistent-type-definitions */ declare module 'react-native-web-linear-gradient' { - 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 {} + import LinearGradient from 'react-native-linear-gradient'; export default LinearGradient; } From 96438d695fae25beadb2f38d9a40e8340497c1d4 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Fri, 3 Nov 2023 14:34:10 +0100 Subject: [PATCH 4/6] fix: lint issue --- src/components/LinearGradient/types.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/LinearGradient/types.ts b/src/components/LinearGradient/types.ts index 555a12f1657c..cf6661eaecaa 100644 --- a/src/components/LinearGradient/types.ts +++ b/src/components/LinearGradient/types.ts @@ -1,6 +1,5 @@ -import LinearGradientWeb from 'react-native-web-linear-gradient'; import LinearGradientNative from 'react-native-linear-gradient'; -type LinearGradient = typeof LinearGradientWeb | typeof LinearGradientNative; +type LinearGradient = typeof LinearGradientNative; export default LinearGradient; From 932267f3bfc699f68c18a7541a81d2908841ef47 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Fri, 3 Nov 2023 18:12:20 +0100 Subject: [PATCH 5/6] fix: rerun jobs --- src/components/LinearGradient/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/LinearGradient/types.ts b/src/components/LinearGradient/types.ts index cf6661eaecaa..cb89599dcd6c 100644 --- a/src/components/LinearGradient/types.ts +++ b/src/components/LinearGradient/types.ts @@ -1,5 +1,5 @@ import LinearGradientNative from 'react-native-linear-gradient'; type LinearGradient = typeof LinearGradientNative; - +console.log(LinearGradientNative); export default LinearGradient; From 4429722cc8f50057e07c0c0307459647b721a088 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Fri, 3 Nov 2023 18:14:08 +0100 Subject: [PATCH 6/6] fix: remove log --- src/components/LinearGradient/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/LinearGradient/types.ts b/src/components/LinearGradient/types.ts index cb89599dcd6c..cf6661eaecaa 100644 --- a/src/components/LinearGradient/types.ts +++ b/src/components/LinearGradient/types.ts @@ -1,5 +1,5 @@ import LinearGradientNative from 'react-native-linear-gradient'; type LinearGradient = typeof LinearGradientNative; -console.log(LinearGradientNative); + export default LinearGradient;