Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix search bar

Ammar Ahmedc4970f986a84
diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.js
index 21990220d..7a82f2ea3 100644
--- a/apps/mobile/src/components/header/index.js
+++ b/apps/mobile/src/components/header/index.js
@@ -1,7 +1,9 @@
import React, { useEffect, useState } from 'react';
import { Platform, StyleSheet, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import { SearchBar } from '../../screens/search/search-bar';
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';
+import useNavigationStore from '../../stores/use-navigation-store';
import { useSelectionStore } from '../../stores/use-selection-store';
import { useThemeStore } from '../../stores/use-theme-store';
import { eScrollEvent } from '../../utils/events';
@@ -15,6 +17,7 @@ export const Header = React.memo(
const insets = useSafeAreaInsets();
const [hide, setHide] = useState(true);
const selectionMode = useSelectionStore(state => state.selectionMode);
+ const currentScreen = useNavigationStore(state => state.currentScreen);
const onScroll = data => {
if (data.y > 150) {
@@ -34,25 +37,33 @@ export const Header = React.memo(
}, [hide]);
return selectionMode ? null : (
- <View
- style={[
- styles.container,
- {
- marginTop: Platform.OS === 'android' ? insets.top : null,
- backgroundColor: colors.bg,
- overflow: 'hidden',
- borderBottomWidth: 1,
- borderBottomColor: hide ? 'transparent' : colors.nav,
- justifyContent: 'space-between'
- }
- ]}
- >
- <View style={styles.leftBtnContainer}>
- <LeftMenus />
- <Title />
+ <>
+ <View
+ style={[
+ styles.container,
+ {
+ marginTop: Platform.OS === 'android' ? insets.top : null,
+ backgroundColor: colors.bg,
+ overflow: 'hidden',
+ borderBottomWidth: 1,
+ borderBottomColor: hide ? 'transparent' : colors.nav,
+ justifyContent: 'space-between'
+ }
+ ]}
+ >
+ {currentScreen.name === 'Search' ? (
+ <SearchBar />
+ ) : (
+ <>
+ <View style={styles.leftBtnContainer}>
+ <LeftMenus />
+ <Title />
+ </View>
+ <RightMenus />
+ </>
+ )}
</View>
- <RightMenus />
- </View>
+ </>
);
},
() => true
@@ -62,7 +73,8 @@ const styles = StyleSheet.create({
container: {
flexDirection: 'row',
zIndex: 11,
- minHeight: 50,
+ height: 50,
+ maxHeight: 50,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 12,
diff --git a/apps/mobile/src/screens/search/index.js b/apps/mobile/src/screens/search/index.js
index 65bbddc56..a2da384bf 100644
--- a/apps/mobile/src/screens/search/index.js
+++ b/apps/mobile/src/screens/search/index.js
@@ -36,9 +36,6 @@ export const Search = ({ navigation, route }) => {
return (
<>
- <ContainerHeader>
- <SearchBar />
- </ContainerHeader>
<List
listData={searchResults}
type="search"
diff --git a/apps/mobile/src/screens/search/searchbar.js b/apps/mobile/src/screens/search/searchbar.js
index 810597eb6..a3b3fc77d 100644
--- a/apps/mobile/src/screens/search/searchbar.js
+++ b/apps/mobile/src/screens/search/searchbar.js
@@ -77,16 +77,11 @@ export const SearchBar = () => {
return (
<View
style={{
- height: normalize(50),
+ height: 50,
flexDirection: 'row',
alignItems: 'center',
- paddingHorizontal: 12,
flexShrink: 1,
- width: '100%',
- paddingLeft: 6,
- marginTop: Platform.OS === 'android' ? insets.top + 5 : 5,
- borderBottomWidth: 1,
- borderBottomColor: colors.nav
+ width: '100%'
}}
>
<IconButton