improve community search page

This commit is contained in:
feruz 2021-01-25 09:45:04 +02:00
parent 958314aea8
commit 7527aa635c
3 changed files with 29 additions and 17 deletions

View File

@ -527,9 +527,9 @@
ProvisioningStyle = Manual;
};
05B6C48C24C306CE00B7FA60 = {
DevelopmentTeam = RBP7PE82SN;
DevelopmentTeam = 75B6RXTKGT;
LastSwiftMigration = 1160;
ProvisioningStyle = Automatic;
ProvisioningStyle = Manual;
};
2D02E47A1E0B4A5D006451C7 = {
CreatedOnToolsVersion = 8.2.1;
@ -1106,7 +1106,7 @@
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2792;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = RBP7PE82SN;
DEVELOPMENT_TEAM = 75B6RXTKGT;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../../../ios/Pods/Headers/Public/**",
@ -1161,7 +1161,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = app.esteem.mobile.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
PROVISIONING_PROFILE_SPECIFIER = ios_dev_app;
SWIFT_OBJC_BRIDGING_HEADER = "Ecency-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@ -1182,7 +1182,7 @@
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2792;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 75B6RXTKGT;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../../../ios/Pods/Headers/Public/**",
@ -1237,7 +1237,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = app.esteem.mobile.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
PROVISIONING_PROFILE_SPECIFIER = ios_dist_app;
SWIFT_OBJC_BRIDGING_HEADER = "Ecency-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";

View File

@ -35,7 +35,7 @@ const SearchResultScreen = ({ navigation }) => {
const _handleChangeText = debounce((value) => {
setSearchValue(value);
}, 250);
}, 1000);
return (
<View style={styles.container}>

View File

@ -45,16 +45,28 @@ const CommunitiesResultsContainer = ({ children, navigation, searchValue }) => {
setData([]);
setNoResult(false);
getSubscriptions(currentAccount.username).then((subs) => {
getCommunities('', searchValue ? 100 : 20, searchValue, 'rank').then((communities) => {
communities.forEach((community) =>
Object.assign(community, {
isSubscribed: subs.some(
(subscribedCommunity) => subscribedCommunity[0] === community.name,
),
}),
);
getCommunities('', searchValue ? 100 : 20, searchValue, 'rank').then((communities) => {
if (currentAccount && currentAccount.username) {
getSubscriptions(currentAccount.username).then((subs) => {
communities.forEach((community) =>
Object.assign(community, {
isSubscribed: subs.some(
(subscribedCommunity) => subscribedCommunity[0] === community.name,
),
}),
);
if (searchValue) {
setData(communities);
} else {
setData(shuffle(communities));
}
if (communities.length === 0) {
setNoResult(true);
}
});
} else {
if (searchValue) {
setData(communities);
} else {
@ -64,7 +76,7 @@ const CommunitiesResultsContainer = ({ children, navigation, searchValue }) => {
if (communities.length === 0) {
setNoResult(true);
}
});
}
});
}, [searchValue]);