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 new search
ammarahm-ed83f2c32a31c8
diff --git a/apps/mobile/src/views/Tags/index.js b/apps/mobile/src/views/Tags/index.jsindex d23500b90..e39f41a2a 100644--- a/apps/mobile/src/views/Tags/index.js+++ b/apps/mobile/src/views/Tags/index.js@@ -1,20 +1,18 @@-import React, {useCallback, useEffect} from 'react';-import {Text} from 'react-native';-import {Placeholder} from '../../components/ListPlaceholders';-import {PressableButton} from '../../components/PressableButton';+import React, { useCallback, useEffect } from 'react';+import { Placeholder } from '../../components/ListPlaceholders';import SimpleList from '../../components/SimpleList';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';-import NavigationService from '../../services/Navigation';-import {SIZE, WEIGHT} from '../../utils/SizeUtils';-import {eSendEvent} from '../../services/EventManager';-import {eUpdateSearchState} from '../../utils/Events';+import { useTracked } from '../../provider';+import { Actions } from '../../provider/Actions';+import { eSendEvent } from '../../services/EventManager';+import SearchService from '../../services/SearchService';+import { eScrollEvent } from '../../utils/Events';export const Tags = ({route, navigation}) => {const [state, dispatch] = useTracked();const {tags} = state;const onFocus = useCallback(() => {+ eSendEvent(eScrollEvent, {name:'Tags', type: 'in'});dispatch({type: Actions.HEADER_STATE,state: true,@@ -37,42 +35,36 @@ export const Tags = ({route, navigation}) => {useEffect(() => {navigation.addListener('focus', onFocus);return () => {+ eSendEvent(eScrollEvent, {name:'Tags', type: 'back'});navigation.removeListener('focus', onFocus);};});-useEffect(() => {if (navigation.isFocused()) {updateSearch();}}, [tags]);+const updateSearch = () => {- if (tags.length === 0) {- eSendEvent('showSearch', true);- } else {- eSendEvent('showSearch');- eSendEvent(eUpdateSearchState, {- placeholder: 'Search all tags',- data: tags,- noSearch: false,- type: 'tags',- color: null,- });- }+ SearchService.update({+ placeholder: 'Search in tags',+ data: tags,+ type: 'tags',+ });};+return (<SimpleListdata={tags}type="tags"focused={() => navigation.isFocused()}- RenderItem={RenderItem}placeholderData={{- heading:"Your Favorites",- paragraph:"You have not added any notes to favorites yet.",+ heading:"Your Tags",+ paragraph:"You have not created any tags for your notes yet.",button:null,}}placeholder={<Placeholder type="tags" />}@@ -83,57 +75,4 @@ export const Tags = ({route, navigation}) => {export default Tags;-const RenderItem = ({item, index}) => {- const [state, dispatch] = useTracked();- const {colors} = state;- return (- <PressableButton- onPress={() => {- NavigationService.navigate('NotesPage', {- type: 'tag',- title: item.title,- tag: item,- });- }}- selectedColor={colors.nav}- alpha={!colors.night ? -0.02 : 0.02}- opacity={1}- customStyle={{- paddingHorizontal: 12,- height: 80,- justifyContent: 'center',- alignItems: 'flex-start',- borderBottomWidth: 1.5,- borderBottomColor: colors.nav,- }}>- <Text- style={{- fontFamily: WEIGHT.bold,- fontSize: SIZE.md,- color: colors.heading,- }}>- <Text- style={{- color: colors.accent,- }}>- #- </Text>- {item.title}- </Text>- <Text- style={{- fontSize: SIZE.xs,- color: colors.icon,- fontFamily: WEIGHT.regular,- marginTop: 5,- }}>- {item && item.noteIds.length && item.noteIds.length > 1- ? item.noteIds.length + ' notes'- : item.noteIds.length === 1- ? item.noteIds.length + ' note'- : null}- </Text>- </PressableButton>- );-};