implement new tag api

This commit is contained in:
ammarahm-ed
2020-03-22 12:39:35 +05:00
parent 1d7cff15a0
commit 17060b813f
3 changed files with 9 additions and 8 deletions

View File

@@ -301,7 +301,7 @@ export const Menu = ({
marginBottom: 0,
}}>
{tags
.filter(o => o.count > 1)
.filter(o => o.noteIds.length > 1)
.slice(0, tags.length > 10 ? 10 : tags.length)
.map(item => (
<TouchableOpacity
@@ -342,7 +342,7 @@ export const Menu = ({
}}>
{item.title + ' '}
</Text>
{item.count > 1 ? (
{item.noteIds.length > 1 ? (
<Text
style={{
color: 'white',
@@ -355,7 +355,7 @@ export const Menu = ({
padding: 0,
paddingHorizontal: 1,
}}>
{item.count > 99 ? '99+' : item.count}
{item.noteIds.length > 99 ? '99+' : item.noteIds.length}
</Text>
) : null}
</TouchableOpacity>

View File

@@ -181,7 +181,7 @@ const SimpleList = ({
);
const _listKeyExtractor = (item, index) =>
item.dateCreated.toString() + index.toString();
item.id.toString() + index.toString();
return (
<FlatList

View File

@@ -8,6 +8,7 @@ import SimpleList from '../../components/SimpleList';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import NavigationService from '../../services/NavigationService';
import {db} from '../../utils/utils';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
@@ -69,10 +70,10 @@ export const Tags = ({navigation}) => {
fontSize: SIZE.xs,
color: colors.icon,
}}>
{item && item.count && item.count > 1
? item.count + ' notes'
: item.count === 1
? item.count + ' note'
{item && item.noteIds.length && item.noteIds.length > 1
? item.noteIds.length + ' notes'
: item.noteIds.length === 1
? item.noteIds.length + ' note'
: null}
</Text>
</Text>