From 7f6c9f0dafda8a76784d4e1681a197382be83c79 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 17 Oct 2023 14:08:59 +0200 Subject: [PATCH 1/2] [TS migration] Migrate 'FormScrollView.js' component to TypeScript --- src/components/FormScrollView.js | 25 ------------------------- src/components/FormScrollView.tsx | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 src/components/FormScrollView.js create mode 100644 src/components/FormScrollView.tsx diff --git a/src/components/FormScrollView.js b/src/components/FormScrollView.js deleted file mode 100644 index aa84bfefcc2f..000000000000 --- a/src/components/FormScrollView.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import {ScrollView} from 'react-native'; -import styles from '../styles/styles'; - -const propTypes = { - /** Form elements */ - children: PropTypes.node.isRequired, -}; - -const FormScrollView = React.forwardRef((props, ref) => ( - - {props.children} - -)); - -FormScrollView.propTypes = propTypes; -export default FormScrollView; diff --git a/src/components/FormScrollView.tsx b/src/components/FormScrollView.tsx new file mode 100644 index 000000000000..3705e5e7ffeb --- /dev/null +++ b/src/components/FormScrollView.tsx @@ -0,0 +1,25 @@ +import React, {ForwardedRef} from 'react'; +import {ScrollView} from 'react-native'; +import styles from '../styles/styles'; + +type FormScrollViewProps = Partial & { + /** Form elements */ + children: React.ReactNode; +}; + +function FormScrollView({children, ...rest}: FormScrollViewProps, ref: ForwardedRef) { + return ( + + {children} + + ); +} + +export default React.forwardRef(FormScrollView); From 947220bace13ce281031d7b18459f8e705abfe71 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 18 Oct 2023 13:07:43 +0200 Subject: [PATCH 2/2] Adjust after internal review --- src/components/FormScrollView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/FormScrollView.tsx b/src/components/FormScrollView.tsx index 3705e5e7ffeb..17e302f61636 100644 --- a/src/components/FormScrollView.tsx +++ b/src/components/FormScrollView.tsx @@ -1,8 +1,8 @@ import React, {ForwardedRef} from 'react'; -import {ScrollView} from 'react-native'; +import {ScrollView, ScrollViewProps} from 'react-native'; import styles from '../styles/styles'; -type FormScrollViewProps = Partial & { +type FormScrollViewProps = ScrollViewProps & { /** Form elements */ children: React.ReactNode; };