From 55b66073e64fb1f28c62020cf2521107700f4cbc Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Thu, 19 Oct 2023 12:29:20 +0200 Subject: [PATCH 1/4] migrate KeyboardAvoidingView to TypeScript --- .../KeyboardAvoidingView/{index.ios.js => index.ios.tsx} | 4 ++-- .../KeyboardAvoidingView/{index.js => index.tsx} | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) rename src/components/KeyboardAvoidingView/{index.ios.js => index.ios.tsx} (60%) rename src/components/KeyboardAvoidingView/{index.js => index.tsx} (50%) diff --git a/src/components/KeyboardAvoidingView/index.ios.js b/src/components/KeyboardAvoidingView/index.ios.tsx similarity index 60% rename from src/components/KeyboardAvoidingView/index.ios.js rename to src/components/KeyboardAvoidingView/index.ios.tsx index c1ea8687f793..4ab04a52a4cf 100644 --- a/src/components/KeyboardAvoidingView/index.ios.js +++ b/src/components/KeyboardAvoidingView/index.ios.tsx @@ -2,9 +2,9 @@ * The KeyboardAvoidingView is only used on ios */ import React from 'react'; -import {KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native'; +import {KeyboardAvoidingView as KeyboardAvoidingViewComponent, KeyboardAvoidingViewProps} from 'react-native'; -function KeyboardAvoidingView(props) { +function KeyboardAvoidingView(props: KeyboardAvoidingViewProps): React.ReactNode { // eslint-disable-next-line react/jsx-props-no-spreading return ; } diff --git a/src/components/KeyboardAvoidingView/index.js b/src/components/KeyboardAvoidingView/index.tsx similarity index 50% rename from src/components/KeyboardAvoidingView/index.js rename to src/components/KeyboardAvoidingView/index.tsx index 3483b2d007ac..f86f73622515 100644 --- a/src/components/KeyboardAvoidingView/index.js +++ b/src/components/KeyboardAvoidingView/index.tsx @@ -2,14 +2,13 @@ * The KeyboardAvoidingView is only used on ios */ import React from 'react'; -import {View} from 'react-native'; -import _ from 'underscore'; +import {KeyboardAvoidingViewProps, View} from 'react-native'; -function KeyboardAvoidingView(props) { - const viewProps = _.omit(props, ['behavior', 'contentContainerStyle', 'enabled', 'keyboardVerticalOffset']); +function KeyboardAvoidingView(props: KeyboardAvoidingViewProps): React.ReactNode { + const {behavior, contentContainerStyle, enabled, keyboardVerticalOffset, ...rest} = props; return ( // eslint-disable-next-line react/jsx-props-no-spreading - + ); } From 134318a8d22a0e1e7accb7e286b8728ad4e53b2e Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Thu, 19 Oct 2023 14:55:40 +0200 Subject: [PATCH 2/4] remove component return type --- src/components/KeyboardAvoidingView/index.ios.tsx | 2 +- src/components/KeyboardAvoidingView/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/KeyboardAvoidingView/index.ios.tsx b/src/components/KeyboardAvoidingView/index.ios.tsx index 4ab04a52a4cf..076dcef3e158 100644 --- a/src/components/KeyboardAvoidingView/index.ios.tsx +++ b/src/components/KeyboardAvoidingView/index.ios.tsx @@ -4,7 +4,7 @@ import React from 'react'; import {KeyboardAvoidingView as KeyboardAvoidingViewComponent, KeyboardAvoidingViewProps} from 'react-native'; -function KeyboardAvoidingView(props: KeyboardAvoidingViewProps): React.ReactNode { +function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { // eslint-disable-next-line react/jsx-props-no-spreading return ; } diff --git a/src/components/KeyboardAvoidingView/index.tsx b/src/components/KeyboardAvoidingView/index.tsx index f86f73622515..4cff2a2399af 100644 --- a/src/components/KeyboardAvoidingView/index.tsx +++ b/src/components/KeyboardAvoidingView/index.tsx @@ -4,7 +4,7 @@ import React from 'react'; import {KeyboardAvoidingViewProps, View} from 'react-native'; -function KeyboardAvoidingView(props: KeyboardAvoidingViewProps): React.ReactNode { +function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { const {behavior, contentContainerStyle, enabled, keyboardVerticalOffset, ...rest} = props; return ( // eslint-disable-next-line react/jsx-props-no-spreading From a727d547cf63d5c1b1d56477aa2a571ea726c329 Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Thu, 26 Oct 2023 09:32:23 +0200 Subject: [PATCH 3/4] create common types.ts type --- src/components/KeyboardAvoidingView/index.ios.tsx | 5 +++-- src/components/KeyboardAvoidingView/index.tsx | 5 +++-- src/components/KeyboardAvoidingView/types.ts | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 src/components/KeyboardAvoidingView/types.ts diff --git a/src/components/KeyboardAvoidingView/index.ios.tsx b/src/components/KeyboardAvoidingView/index.ios.tsx index 076dcef3e158..9bcc98f63655 100644 --- a/src/components/KeyboardAvoidingView/index.ios.tsx +++ b/src/components/KeyboardAvoidingView/index.ios.tsx @@ -2,9 +2,10 @@ * The KeyboardAvoidingView is only used on ios */ import React from 'react'; -import {KeyboardAvoidingView as KeyboardAvoidingViewComponent, KeyboardAvoidingViewProps} from 'react-native'; +import {KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native'; +import Props from './types'; -function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { +function KeyboardAvoidingView(props: Props) { // eslint-disable-next-line react/jsx-props-no-spreading return ; } diff --git a/src/components/KeyboardAvoidingView/index.tsx b/src/components/KeyboardAvoidingView/index.tsx index 4cff2a2399af..3ce9e69ea0a6 100644 --- a/src/components/KeyboardAvoidingView/index.tsx +++ b/src/components/KeyboardAvoidingView/index.tsx @@ -2,9 +2,10 @@ * The KeyboardAvoidingView is only used on ios */ import React from 'react'; -import {KeyboardAvoidingViewProps, View} from 'react-native'; +import {View} from 'react-native'; +import Props from './types'; -function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { +function KeyboardAvoidingView(props: Props) { const {behavior, contentContainerStyle, enabled, keyboardVerticalOffset, ...rest} = props; return ( // eslint-disable-next-line react/jsx-props-no-spreading diff --git a/src/components/KeyboardAvoidingView/types.ts b/src/components/KeyboardAvoidingView/types.ts new file mode 100644 index 000000000000..48d354e8b53f --- /dev/null +++ b/src/components/KeyboardAvoidingView/types.ts @@ -0,0 +1,3 @@ +import {KeyboardAvoidingViewProps} from 'react-native'; + +export default KeyboardAvoidingViewProps; From 3ccdf0316e96cb52d995124233564f56ce3bd01b Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Fri, 27 Oct 2023 08:49:36 +0200 Subject: [PATCH 4/4] rename props import --- src/components/KeyboardAvoidingView/index.ios.tsx | 4 ++-- src/components/KeyboardAvoidingView/index.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/KeyboardAvoidingView/index.ios.tsx b/src/components/KeyboardAvoidingView/index.ios.tsx index 9bcc98f63655..fde4df6fc05b 100644 --- a/src/components/KeyboardAvoidingView/index.ios.tsx +++ b/src/components/KeyboardAvoidingView/index.ios.tsx @@ -3,9 +3,9 @@ */ import React from 'react'; import {KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native'; -import Props from './types'; +import KeyboardAvoidingViewProps from './types'; -function KeyboardAvoidingView(props: Props) { +function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { // eslint-disable-next-line react/jsx-props-no-spreading return ; } diff --git a/src/components/KeyboardAvoidingView/index.tsx b/src/components/KeyboardAvoidingView/index.tsx index 3ce9e69ea0a6..cf3a5c5ebef7 100644 --- a/src/components/KeyboardAvoidingView/index.tsx +++ b/src/components/KeyboardAvoidingView/index.tsx @@ -3,9 +3,9 @@ */ import React from 'react'; import {View} from 'react-native'; -import Props from './types'; +import KeyboardAvoidingViewProps from './types'; -function KeyboardAvoidingView(props: Props) { +function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) { const {behavior, contentContainerStyle, enabled, keyboardVerticalOffset, ...rest} = props; return ( // eslint-disable-next-line react/jsx-props-no-spreading