2021-09-08 23:56:35 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { StyleSheet, View } from 'react-native';
|
|
|
|
|
2022-01-24 15:51:31 +00:00
|
|
|
import I18n from '../i18n';
|
2022-01-17 20:15:58 +00:00
|
|
|
import { useTheme } from '../theme';
|
2021-09-08 23:56:35 +00:00
|
|
|
import sharedStyles from '../views/Styles';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../lib/constants';
|
2022-06-27 18:46:59 +00:00
|
|
|
import { TextInput } from './TextInput';
|
2021-09-08 23:56:35 +00:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
flex: 1,
|
|
|
|
justifyContent: 'center',
|
|
|
|
marginLeft: 0
|
|
|
|
},
|
|
|
|
title: {
|
2023-09-08 13:51:12 +00:00
|
|
|
...sharedStyles.textSemibold,
|
|
|
|
fontSize: 16
|
2021-09-08 23:56:35 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-09-17 19:22:40 +00:00
|
|
|
interface ISearchHeaderProps {
|
2021-10-04 17:19:01 +00:00
|
|
|
onSearchChangeText?: (text: string) => void;
|
2022-02-04 22:15:01 +00:00
|
|
|
testID?: string;
|
2021-09-17 19:22:40 +00:00
|
|
|
}
|
|
|
|
|
2022-01-24 15:51:31 +00:00
|
|
|
const SearchHeader = ({ onSearchChangeText, testID }: ISearchHeaderProps): JSX.Element => {
|
2022-01-17 20:15:58 +00:00
|
|
|
const { theme } = useTheme();
|
2021-09-08 23:56:35 +00:00
|
|
|
const isLight = theme === 'light';
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={styles.container}>
|
|
|
|
<TextInput
|
|
|
|
autoFocus
|
2023-09-08 13:51:12 +00:00
|
|
|
style={[styles.title, isLight && { color: themes[theme].headerTitleColor }]}
|
2022-01-24 15:51:31 +00:00
|
|
|
placeholder={I18n.t('Search')}
|
2021-09-08 23:56:35 +00:00
|
|
|
onChangeText={onSearchChangeText}
|
|
|
|
testID={testID}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-01-17 20:02:53 +00:00
|
|
|
export default SearchHeader;
|