Rocket.Chat.ReactNative/app/containers/SearchHeader.tsx

45 lines
1001 B
TypeScript
Raw Normal View History

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