Migrate SearchHeader to TS
This commit is contained in:
parent
55b89e6e43
commit
6128bc4e50
|
@ -1,6 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
import { withDimensions } from '../dimensions';
|
import { withDimensions } from '../dimensions';
|
||||||
import { isIOS, isTablet } from '../utils/deviceInfo';
|
import { isIOS, isTablet } from '../utils/deviceInfo';
|
||||||
|
@ -19,9 +18,16 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const SearchHeader = ({
|
interface ISearchHeaderProps {
|
||||||
onSearchChangeText, placeholder, theme, testID, width, height
|
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 isLight = theme === 'light';
|
||||||
const isLandscape = width > height;
|
const isLandscape = width > height;
|
||||||
const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1;
|
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);
|
export default withDimensions(SearchHeader);
|
Loading…
Reference in New Issue