From 6128bc4e5097534f6788ad0b7ce7c7e5b09e8a3c Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Fri, 17 Sep 2021 15:22:40 -0400 Subject: [PATCH] Migrate SearchHeader to TS --- .../{SearchHeader.js => SearchHeader.tsx} | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) rename app/containers/{SearchHeader.js => SearchHeader.tsx} (73%) diff --git a/app/containers/SearchHeader.js b/app/containers/SearchHeader.tsx similarity index 73% rename from app/containers/SearchHeader.js rename to app/containers/SearchHeader.tsx index cb0fb2be..3f5bf4b9 100644 --- a/app/containers/SearchHeader.js +++ b/app/containers/SearchHeader.tsx @@ -1,6 +1,5 @@ import React from 'react'; import { StyleSheet, View } from 'react-native'; -import PropTypes from 'prop-types'; import { withDimensions } from '../dimensions'; import { isIOS, isTablet } from '../utils/deviceInfo'; @@ -19,9 +18,16 @@ const styles = StyleSheet.create({ } }); -const SearchHeader = ({ - onSearchChangeText, placeholder, theme, testID, width, height -}) => { +interface ISearchHeaderProps { + onSearchChangeText(): void; + placeholder: string; + theme: string; + testID: string; + width: number; + height: number; +} + +const SearchHeader = ({ onSearchChangeText, placeholder, theme, testID, width, height }: ISearchHeaderProps) => { const isLight = theme === 'light'; const isLandscape = width > height; const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1; @@ -41,12 +47,4 @@ const SearchHeader = ({ ); }; -SearchHeader.propTypes = { - onSearchChangeText: PropTypes.func.isRequired, - placeholder: PropTypes.string.isRequired, - theme: PropTypes.string, - testID: PropTypes.string, - width: PropTypes.number, - height: PropTypes.number -}; export default withDimensions(SearchHeader);