|
|
|
@@ -87,54 +87,57 @@ const HomeScreen = ({ navigation }) => { |
|
|
|
style={{ flex: 1, color: colors.textPrimary }} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
<Text> |
|
|
|
|
|
|
|
{filteredData?.length === 0 && ( |
|
|
|
<View style={{paddingHorizontal: 18}}> |
|
|
|
<Text |
|
|
|
style={[globalStyles.boldText, { color: colors.textPrimary }]} |
|
|
|
> |
|
|
|
{t('common.noResults')} |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
)} |
|
|
|
{!isLoading && ( |
|
|
|
<ScrollView style={{ flex: 1, paddingHorizontal: 18 }}> |
|
|
|
{query.length === 0 |
|
|
|
? posts?.map((post) => ( |
|
|
|
<ListItem |
|
|
|
key={post?.id} |
|
|
|
title={post?.attributes?.title} |
|
|
|
photo={ |
|
|
|
post?.attributes?.profileImage?.data?.attributes?.formats |
|
|
|
} |
|
|
|
publishedAt={post?.attributes?.publishedAt} |
|
|
|
onPress={() => |
|
|
|
navigation.navigate("PostDetails", { |
|
|
|
title: post?.attributes?.title, |
|
|
|
id: post?.id, |
|
|
|
}) |
|
|
|
} |
|
|
|
/> |
|
|
|
)) |
|
|
|
: filteredData.map((post) => ( |
|
|
|
<ListItem |
|
|
|
key={post?.id} |
|
|
|
title={post?.attributes?.title} |
|
|
|
photo={ |
|
|
|
post?.attributes?.profileImage?.data?.attributes?.formats |
|
|
|
} |
|
|
|
publishedAt={post?.attributes?.publishedAt} |
|
|
|
onPress={() => |
|
|
|
navigation.navigate("PostDetails", { |
|
|
|
title: post?.attributes?.title, |
|
|
|
id: post?.id, |
|
|
|
}) |
|
|
|
} |
|
|
|
/> |
|
|
|
))} |
|
|
|
</ScrollView> |
|
|
|
<View style={{ paddingHorizontal: 18 }}> |
|
|
|
<Text |
|
|
|
style={[globalStyles.boldText, { color: colors.textPrimary }]} |
|
|
|
> |
|
|
|
{t("common.noResults")} |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
)} |
|
|
|
</Text> |
|
|
|
|
|
|
|
{!isLoading && ( |
|
|
|
<ScrollView |
|
|
|
style={{ flex: 1, paddingHorizontal: 18 }} |
|
|
|
showsVerticalScrollIndicator={false} |
|
|
|
> |
|
|
|
{query.length === 0 |
|
|
|
? posts?.map((post) => ( |
|
|
|
<ListItem |
|
|
|
key={post?.id} |
|
|
|
title={post?.attributes?.title} |
|
|
|
photo={ |
|
|
|
post?.attributes?.profileImage?.data?.attributes?.formats |
|
|
|
} |
|
|
|
publishedAt={post?.attributes?.publishedAt} |
|
|
|
onPress={() => |
|
|
|
navigation.navigate("PostDetails", { |
|
|
|
title: post?.attributes?.title, |
|
|
|
id: post?.id, |
|
|
|
}) |
|
|
|
} |
|
|
|
/> |
|
|
|
)) |
|
|
|
: filteredData.map((post) => ( |
|
|
|
<ListItem |
|
|
|
key={post?.id} |
|
|
|
title={post?.attributes?.title} |
|
|
|
photo={ |
|
|
|
post?.attributes?.profileImage?.data?.attributes?.formats |
|
|
|
} |
|
|
|
publishedAt={post?.attributes?.publishedAt} |
|
|
|
onPress={() => |
|
|
|
navigation.navigate("PostDetails", { |
|
|
|
title: post?.attributes?.title, |
|
|
|
id: post?.id, |
|
|
|
}) |
|
|
|
} |
|
|
|
/> |
|
|
|
))} |
|
|
|
</ScrollView> |
|
|
|
)} |
|
|
|
</Layout> |
|
|
|
); |
|
|
|
}; |