|
@@ -1,18 +1,12 @@
|
|
|
-import { FlatList, Image, ScrollView, StyleSheet, Text, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native'
|
|
|
-import React, { useEffect, useState } from 'react'
|
|
|
+import { ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
|
+import React, { useState } from 'react'
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context'
|
|
|
-import NewscoutTitleHeader from '../../components/molecules/Header/NewscoutTitleHeader'
|
|
|
import colors from '../../constants/colors'
|
|
|
-import { Checkbox, IconButton, List, Modal, PaperProvider, Portal, TextInput, ToggleButton } from 'react-native-paper'
|
|
|
-import { horizontalScale, moderateScale, screenWidth, verticalScale } from '../../constants/metrics'
|
|
|
+import { PaperProvider, TextInput } from 'react-native-paper'
|
|
|
+import { horizontalScale, moderateScale, verticalScale } from '../../constants/metrics'
|
|
|
import IonIcon from 'react-native-vector-icons/Ionicons'
|
|
|
import fonts from '../../constants/fonts'
|
|
|
-import { navigateToArticle, navigateToListViewPage, useConstructor } from '../../utils/functions'
|
|
|
-import { getArticlesBySearch, getCategories, getMenus, getTrendingNews } from '../../api/data'
|
|
|
-import LoadingScreen from '../../components/organisms/Sections/LoadingScreen'
|
|
|
-import { BASE_URL, PAGINATE_BY } from '../../api/urls'
|
|
|
-import HorizontalNewsCardVariant from '../../components/molecules/Cards/HorizontalNewsCardVariant'
|
|
|
-import ThemedTextButton from '../../components/molecules/Buttons/ThemeTextButton'
|
|
|
+import {navigateToListViewPage} from '../../utils/functions'
|
|
|
import CategorySearchSection from '../../components/organisms/Sections/CategorySearchSection'
|
|
|
import RecentSearchesSection from '../../components/organisms/Sections/RecentSearchesSection'
|
|
|
|
|
@@ -23,15 +17,8 @@ const SearchPage = props => {
|
|
|
route
|
|
|
} = props
|
|
|
|
|
|
- const [isSearching, setSearching] = useState(false)
|
|
|
const [searchText, setSearchText] = useState("")
|
|
|
|
|
|
- const [suggestedNews, setSuggestedNews] = useState([])
|
|
|
-
|
|
|
-
|
|
|
- const [recentSearches, setRecentSearches] = useState([])
|
|
|
-
|
|
|
-
|
|
|
// * Filters Modal
|
|
|
const [isFiltersVisible, setFiltersVisible] = useState(false);
|
|
|
const showFilters = () => setFiltersVisible(true);
|
|
@@ -66,15 +53,6 @@ const SearchPage = props => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- const onChangeText = text => {
|
|
|
- if (text.length <= 0) {
|
|
|
- setSuggestedNews([])
|
|
|
- setSearching(false)
|
|
|
- }
|
|
|
- setSearchText(text)
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
const onSearch = () => {
|
|
|
navigation.push('SearchListPage', { query: searchText })
|
|
|
}
|
|
@@ -107,8 +85,8 @@ const SearchPage = props => {
|
|
|
borderRadius: moderateScale(8),
|
|
|
borderWidth: moderateScale(1),
|
|
|
}}
|
|
|
+ cursorColor={colors().primaryColor}
|
|
|
right={() => <TouchableOpacity onPress={() => navigateToListViewPage(navigation, 'search', searchText)}><IonIcon name="search" color={colors().grayShade_200} size={moderateScale(8)} /></TouchableOpacity>}
|
|
|
- onChangeText={onChangeText}
|
|
|
onSubmitEditing={onSearch}
|
|
|
/>
|
|
|
</View>
|