From 548896df9aa23c055527c91af133dac10c404309 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 19 Oct 2023 10:56:01 +0200 Subject: [PATCH] [TS migration] Migrate 'SafeArea' component to TypeScript --- src/components/SafeArea/index.ios.tsx | 10 +++------- src/components/SafeArea/index.tsx | 4 +++- src/components/SafeArea/types.ts | 5 +++++ 3 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 src/components/SafeArea/types.ts diff --git a/src/components/SafeArea/index.ios.tsx b/src/components/SafeArea/index.ios.tsx index ba9b1f01e298..1bbdf223e3c0 100644 --- a/src/components/SafeArea/index.ios.tsx +++ b/src/components/SafeArea/index.ios.tsx @@ -1,23 +1,19 @@ import React from 'react'; import {SafeAreaView} from 'react-native-safe-area-context'; -import PropTypes from 'prop-types'; import styles from '../../styles/styles'; +import SafeAreaProps from './types'; -function SafeArea(props) { +function SafeArea({children}: SafeAreaProps) { return ( - {props.children} + {children} ); } -SafeArea.propTypes = { - /** App content */ - children: PropTypes.node.isRequired, -}; SafeArea.displayName = 'SafeArea'; export default SafeArea; diff --git a/src/components/SafeArea/index.tsx b/src/components/SafeArea/index.tsx index e68fd1c402ce..94090ef48642 100644 --- a/src/components/SafeArea/index.tsx +++ b/src/components/SafeArea/index.tsx @@ -1 +1,3 @@ -export default ({children}) => children; +import SafeAreaProps from './types'; + +export default ({children}: SafeAreaProps) => children; diff --git a/src/components/SafeArea/types.ts b/src/components/SafeArea/types.ts new file mode 100644 index 000000000000..98ad9f0143bd --- /dev/null +++ b/src/components/SafeArea/types.ts @@ -0,0 +1,5 @@ +import ChildrenProps from '../../types/utils/ChildrenProps'; + +type SafeAreaProps = ChildrenProps; + +export default SafeAreaProps;