A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
add search in notebooks
ammarahm-ed61cd546a1d3d
diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.jsindex 7fa8342d2..c5836a38c 100644--- a/apps/mobile/src/views/Folders/index.js+++ b/apps/mobile/src/views/Folders/index.js@@ -21,6 +21,7 @@ import {eSendEvent} from '../../services/eventManager';import {eScrollEvent} from '../../services/events';import {slideLeft, slideRight} from '../../utils/animations';import {w, ToastEvent, hexToRGBA} from '../../utils/utils';+import {inputRef} from '../../components/SearchInput';export const Folders = ({navigation}) => {const [state, dispatch] = useTracked();@@ -31,6 +32,8 @@ export const Folders = ({navigation}) => {notebooks,preventDefaultMargins,} = state;+ const searchResults = {...state.searchResults};+const [refreshing, setRefreshing] = useState(false);let isFocused = useIsFocused();@@ -84,6 +87,7 @@ export const Folders = ({navigation}) => {navigation={navigation}placeholder="Search all notebooks"data={notebooks}+ type="notebooks"bottomButtonOnPress={() => {AddNotebookEvent(null);}}>@@ -115,53 +119,102 @@ export const Folders = ({navigation}) => {}onScroll={onScroll}ListHeaderComponent={- <View- style={{- marginTop:- Platform.OS == 'ios'- ? notebooks[0] && !selectionMode- ? 135- : 135 - 60- : notebooks[0] && !selectionMode- ? 155- : 155 - 60,- }}>- {pinned && pinned.notebooks && pinned.notebooks.length > 0 ? (- <>- <FlatList- data={pinned.notebooks}- keyExtractor={(item, index) => item.id.toString()}- renderItem={({item, index}) =>- item.type === 'notebook' ? (- <NotebookItem- hideMore={params.hideMore}- customStyle={{- backgroundColor: Platform.ios- ? hexToRGBA(colors.accent + '19')- : hexToRGBA(colors.shade),- width: '100%',- paddingHorizontal: 12,- paddingTop: 20,- paddingRight: 18,- marginBottom: 10,- marginTop: 20,- borderBottomWidth: 0,- marginHorizontal: 0,- }}- isMove={params.isMove}- onLongPress={() => {}}- noteToMove={params.note}- item={item}- pinned={true}- index={index}- colors={colors}- />- ) : null- }- />- </>- ) : null}- </View>+ searchResults.type === 'notebooks' &&+ searchResults.results.length > 0 ? (+ <View+ style={{+ marginTop:+ Platform.OS == 'ios'+ ? notebooks[0] && !selectionMode+ ? 135+ : 135 - 60+ : notebooks[0] && !selectionMode+ ? 155+ : 155 - 60,+ flexDirection: 'row',+ alignItems: 'center',+ justifyContent: 'space-between',+ paddingHorizontal: 12,+ }}>+ <Text+ style={{+ fontFamily: WEIGHT.bold,+ color: colors.accent,+ fontSize: SIZE.xs,+ }}>+ Search Results for {searchResults.keyword}+ </Text>+ <Text+ onPress={() => {+ inputRef.current?.setNativeProps({+ text: '',+ });+ dispatch({+ type: ACTIONS.SEARCH_RESULTS,+ results: {+ results: [],+ type: null,+ keyword: null,+ },+ });+ }}+ style={{+ fontFamily: WEIGHT.regular,+ color: colors.errorText,+ fontSize: SIZE.xs,+ }}>+ Clear+ </Text>+ </View>+ ) : (+ <View+ style={{+ marginTop:+ Platform.OS == 'ios'+ ? notebooks[0] && !selectionMode+ ? 135+ : 135 - 60+ : notebooks[0] && !selectionMode+ ? 155+ : 155 - 60,+ }}>+ {pinned && pinned.notebooks && pinned.notebooks.length > 0 ? (+ <>+ <FlatList+ data={pinned.notebooks}+ keyExtractor={(item, index) => item.id.toString()}+ renderItem={({item, index}) =>+ item.type === 'notebook' ? (+ <NotebookItem+ hideMore={params.hideMore}+ customStyle={{+ backgroundColor: Platform.ios+ ? hexToRGBA(colors.accent + '19')+ : hexToRGBA(colors.shade),+ width: '100%',+ paddingHorizontal: 12,+ paddingTop: 20,+ paddingRight: 18,+ marginBottom: 10,+ marginTop: 20,+ borderBottomWidth: 0,+ marginHorizontal: 0,+ }}+ isMove={params.isMove}+ onLongPress={() => {}}+ noteToMove={params.note}+ item={item}+ pinned={true}+ index={index}+ colors={colors}+ />+ ) : null+ }+ />+ </>+ ) : null}+ </View>+ )}ListEmptyComponent={<View@@ -210,7 +263,13 @@ export const Folders = ({navigation}) => {</Text></View>}- data={notebooks}+ data={+ searchResults &&+ searchResults.results.length > 0 &&+ searchResults.type === 'notebooks'+ ? searchResults.results+ : notebooks+ }keyExtractor={(item, index) => item.id.toString()}renderItem={({item, index}) => (<SelectionWrapper item={item}>diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.jsindex 7b41a9cf2..62d5fd242 100755--- a/apps/mobile/src/views/Home/index.js+++ b/apps/mobile/src/views/Home/index.js@@ -59,7 +59,7 @@ export const Home = ({navigation}) => {data={notes ? notes : []}><SelectionHeader />- <NotesList isGrouped={true} />+ <NotesList /></Container>);};