2019-07-29 16:33:28 +00:00
|
|
|
import React from 'react';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { StyleSheet, Text, View } from 'react-native';
|
2019-07-29 16:33:28 +00:00
|
|
|
|
2022-05-18 19:17:42 +00:00
|
|
|
import TextInput from '../../../containers/TextInput';
|
2019-07-29 16:33:28 +00:00
|
|
|
import I18n from '../../../i18n';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../../lib/constants';
|
2019-07-29 16:33:28 +00:00
|
|
|
import sharedStyles from '../../Styles';
|
2021-12-02 13:39:48 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-12-02 13:39:48 +00:00
|
|
|
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;
|