Skip to content

Commit

Permalink
Merge pull request #29947 from software-mansion-labs/ts-migration/Saf…
Browse files Browse the repository at this point in the history
…eArea

[TS migration] Migrate 'SafeArea' component to TypeScript
  • Loading branch information
stitesExpensify authored Nov 7, 2023
2 parents 8f6635b + dafc617 commit f9d9bb6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import PropTypes from 'prop-types';
import React from 'react';
import {SafeAreaView} from 'react-native-safe-area-context';
import styles from '@styles/styles';
import SafeAreaProps from './types';

function SafeArea(props) {
function SafeArea({children}: SafeAreaProps) {
return (
<SafeAreaView
style={[styles.iPhoneXSafeArea]}
edges={['left', 'right']}
>
{props.children}
{children}
</SafeAreaView>
);
}

SafeArea.propTypes = {
/** App content */
children: PropTypes.node.isRequired,
};
SafeArea.displayName = 'SafeArea';

export default SafeArea;
1 change: 0 additions & 1 deletion src/components/SafeArea/index.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/components/SafeArea/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import SafeAreaProps from './types';

export default ({children}: SafeAreaProps) => children;
5 changes: 5 additions & 0 deletions src/components/SafeArea/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import ChildrenProps from '@src/types/utils/ChildrenProps';

type SafeAreaProps = ChildrenProps;

export default SafeAreaProps;

0 comments on commit f9d9bb6

Please sign in to comment.