diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-05-19 16:43:32 -0700 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-05-20 17:54:35 -0700 |
commit | 68c33a12c867ab328e7e1899d4fcbfcdb6f7f119 (patch) | |
tree | 509bd151e93fb78dd21134a1682832fbae8263fc /src/screens/chat/ChatSearchBar.tsx | |
parent | 408c1c4046d1945ea4d2e857796841368ab1b8e8 (diff) |
Modify to reuse existing search bar
Diffstat (limited to 'src/screens/chat/ChatSearchBar.tsx')
-rw-r--r-- | src/screens/chat/ChatSearchBar.tsx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/screens/chat/ChatSearchBar.tsx b/src/screens/chat/ChatSearchBar.tsx index 91018d4c..1c91f493 100644 --- a/src/screens/chat/ChatSearchBar.tsx +++ b/src/screens/chat/ChatSearchBar.tsx @@ -17,6 +17,7 @@ interface SearchBarProps extends TextInputProps { onCancel: () => void; searching: boolean; placeholder: string; + label?: string; } const ChatSearchBar: React.FC<SearchBarProps> = ({ onFocus, @@ -26,6 +27,7 @@ const ChatSearchBar: React.FC<SearchBarProps> = ({ onCancel, onLayout, placeholder, + label, }) => { const handleSubmit = ( e: NativeSyntheticEvent<TextInputSubmitEditingEventData>, @@ -34,14 +36,18 @@ const ChatSearchBar: React.FC<SearchBarProps> = ({ Keyboard.dismiss(); }; + const extraLabelStyle = {paddingLeft: label ? 0 : 10}; + return ( <View style={styles.container} onLayout={onLayout}> <Animated.View style={styles.inputContainer}> - <Animated.View style={styles.searchTextContainer}> - <Text style={styles.searchTextStyes}>To:</Text> - </Animated.View> + {label && ( + <Animated.View style={styles.searchTextContainer}> + <Text style={styles.searchTextStyes}>{label}</Text> + </Animated.View> + )} <TextInput - style={styles.input} + style={[extraLabelStyle, styles.input]} placeholderTextColor={'#828282'} onSubmitEditing={handleSubmit} clearButtonMode="always" |