verdnatura-chat/app/containers/SearchHeader.tsx

50 lines
1.3 KiB
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';
2022-01-17 20:15:58 +00:00
import { themes } from '../constants/colors';
import TextInput from '../presentation/TextInput';
2022-01-17 20:15:58 +00:00
import { isIOS, isTablet } from '../utils/deviceInfo';
import { useOrientation } from '../dimensions';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
marginLeft: 0
},
title: {
...sharedStyles.textSemibold
}
});
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';
[NEW] Threads (#2567) * [IMPROVEMENT] Mentions layout without background * Fix RoomItem * Fix tests * Smaller messagebox * Messagebox colors tweak * Beginning header buttons refactor * Add HeaderButtons * item with title * Refactor * Remove lib * Refactor * Update snapshot * Send to channel on messagebox * Add tshow * Add showMessageInMainThread to login.user reducer * Filter threads on main channel based on user setting * Send tshow * Add tunread * Move unread colors logic away from UnreadBadge component so it can be used on other components * Export UnreadBadge on index * Add empty test * Refactor * Update tests * Lint * Thread unread user and group on RoomItem * Thread badge working * Started ThreadMessagesView.Item * Fix separator * Reactivity working * Lint * custom emojis aren't necessary * Basic filter layout * Filtering layout * Refactor * apply filter * DropdownItemHeader * default all * few fixes * No data found * Fixes list performance issues * Use locale on date formats * Fixed minor styles * Thread badge * Refactor getBadgeColor * Fix send to channel background color * starting search threads * Fix lint and tests * Bump to 4.12.0 just for testing :) * Search input layout * query * starting threads header * fix unnecessary tlm on tmid messages * Fix thread header * lint * Fix thread header on ShareView * Add e2e tests * Fix subscriptions sort * Update stories and minor fixes * Fix button sizes on Messagebox * Remove comment * Unnecessary conditional * Add showMessageInMainThread to user collection * Fix thread header * Fix thread messages not working on tablet * Reset Messagebox.tshow after sending a message * Allow to send to channel when replying to a thread from main channel * Unnecessary theme prop * Address comments * Remove re-render * Fix scroll indicator bug * Fix style * Minor i18n fix * Fix dropdown height * I18n ptbr * I18n
2020-10-30 17:35:07 +00:00
const { isLandscape } = useOrientation();
const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1;
const titleFontSize = 16 * scale;
return (
<View style={styles.container}>
<TextInput
autoFocus
style={[styles.title, isLight && { color: themes[theme].headerTitleColor }, { fontSize: titleFontSize }]}
placeholder={I18n.t('Search')}
onChangeText={onSearchChangeText}
theme={theme}
testID={testID}
/>
</View>
);
};
export default SearchHeader;