Rocket.Chat.ReactNative/app/views/ShareListView/Header/Header.tsx

47 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-07-29 16:33:28 +00:00
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
2019-07-29 16:33:28 +00:00
import TextInput from '../../../containers/TextInput';
2019-07-29 16:33:28 +00:00
import I18n from '../../../i18n';
import { themes } from '../../../lib/constants';
2019-07-29 16:33:28 +00:00
import sharedStyles from '../../Styles';
import { IShareListHeader } from './interface';
2019-07-29 16:33:28 +00:00
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center'
},
search: {
fontSize: 20,
...sharedStyles.textRegular,
marginHorizontal: 14
},
title: {
fontSize: 20,
...sharedStyles.textBold,
marginHorizontal: 16
}
});
const Header = React.memo(({ searching, onChangeSearchText, theme }: IShareListHeader) => {
2019-12-04 16:39:53 +00:00
const titleColorStyle = { color: themes[theme].headerTintColor };
const isLight = theme === 'light';
2019-07-29 16:33:28 +00:00
if (searching) {
return (
<View style={styles.container}>
<TextInput
2019-12-04 16:39:53 +00:00
style={[styles.search, isLight && titleColorStyle]}
2019-07-29 16:33:28 +00:00
placeholder={I18n.t('Search')}
onChangeText={onChangeSearchText}
2019-12-04 16:39:53 +00:00
theme={theme}
2019-07-29 16:33:28 +00:00
autoFocus
/>
</View>
);
}
2019-12-04 16:39:53 +00:00
return <Text style={[styles.title, titleColorStyle]}>{I18n.t('Send_to')}</Text>;
2019-07-29 16:33:28 +00:00
});
export default Header;