fixing cards filter

This commit is contained in:
Roland Osborne 2023-10-06 16:07:42 -07:00
parent fec1f9e2cf
commit 8d7e88d12b
2 changed files with 26 additions and 23 deletions

View File

@ -28,7 +28,7 @@ export function Cards({ navigation, openContact, openRegistry, addChannel }) {
)} )}
<View style={styles.inputwrapper}> <View style={styles.inputwrapper}>
<AntIcons style={styles.icon} name="search1" size={16} color={Colors.inputPlaceholder} /> <AntIcons style={styles.icon} name="search1" size={16} color={Colors.inputPlaceholder} />
<TextInput placeholder={ state.strings.contactFilter } placeholderTextColor={Colors.inputPlaceholder} value={state.filter} <TextInput placeholder={ state.strings.contactFilter } placeholderTextColor={Colors.inputPlaceholder}
style={styles.inputfield} autoCapitalize={'none'} spellCheck={false} onChangeText={actions.setFilter} /> style={styles.inputfield} autoCapitalize={'none'} spellCheck={false} onChangeText={actions.setFilter} />
<View style={styles.space} /> <View style={styles.space} />
</View> </View>
@ -40,7 +40,7 @@ export function Cards({ navigation, openContact, openRegistry, addChannel }) {
), ),
}); });
} }
}, [navigation]); }, [navigation, state.sort]);
const call = async (contact) => { const call = async (contact) => {
try { try {
@ -57,6 +57,7 @@ export function Cards({ navigation, openContact, openRegistry, addChannel }) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
{ !navigation && (
<View style={styles.title}> <View style={styles.title}>
{ state.sort && ( { state.sort && (
<TouchableOpacity style={styles.sort} onPress={() => actions.setSort(false)}> <TouchableOpacity style={styles.sort} onPress={() => actions.setSort(false)}>
@ -79,7 +80,7 @@ export function Cards({ navigation, openContact, openRegistry, addChannel }) {
<Text style={styles.newtext}>{ state.strings.add }</Text> <Text style={styles.newtext}>{ state.strings.add }</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
)}
{ state.cards.length == 0 && ( { state.cards.length == 0 && (
<View style={styles.notfound}> <View style={styles.notfound}>
<Text style={styles.notfoundtext}>{ state.strings.noContacts }</Text> <Text style={styles.notfoundtext}>{ state.strings.noContacts }</Text>

View File

@ -111,6 +111,8 @@ export function useCards() {
updateState({ filter }); updateState({ filter });
}, },
setSort: (sort) => { setSort: (sort) => {
console.log("SETTTING : ", sort);
updateState({ sort }); updateState({ sort });
}, },
}; };