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

View File

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

View File

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