From 7cc6df961f99d5828f6cbe39c7509e17bae7d93c Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 5 Mar 2021 16:14:15 -0500 Subject: fixed padding issue --- src/components/search/RecentSearches.tsx | 10 +++-- src/components/search/SearchResultList.tsx | 28 +++++++------- src/components/search/SearchResultsBackground.tsx | 8 ++-- src/screens/search/SearchScreen.tsx | 45 +++++++++-------------- 4 files changed, 42 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/components/search/RecentSearches.tsx b/src/components/search/RecentSearches.tsx index 3925d084..6fb9fca9 100644 --- a/src/components/search/RecentSearches.tsx +++ b/src/components/search/RecentSearches.tsx @@ -5,10 +5,12 @@ import { TouchableOpacity, StyleSheet, TouchableOpacityProps, + ScrollView, } from 'react-native'; import {PreviewType, ProfilePreviewType, ScreenType} from '../../types'; import {TAGG_LIGHT_BLUE} from '../../constants'; import SearchResults from './SearchResults'; +import {SCREEN_HEIGHT} from '../../utils'; interface RecentSearchesProps extends TouchableOpacityProps { sectionTitle: PreviewType; @@ -21,7 +23,9 @@ interface RecentSearchesProps extends TouchableOpacityProps { */ const RecentSearches: React.FC = (props) => { return ( - + {props.sectionTitle} {props.sectionButtonTitle && ( @@ -35,14 +39,14 @@ const RecentSearches: React.FC = (props) => { previewType={props.sectionTitle} screenType={props.screenType} /> - + ); }; const styles = StyleSheet.create({ mainContainer: { marginLeft: '3%', - padding : 20, + padding: 20, }, container: { flexDirection: 'row', diff --git a/src/components/search/SearchResultList.tsx b/src/components/search/SearchResultList.tsx index 7f8073c4..a3d9c8c5 100644 --- a/src/components/search/SearchResultList.tsx +++ b/src/components/search/SearchResultList.tsx @@ -1,20 +1,15 @@ import React, {useEffect, useState} from 'react'; -import { - Keyboard, - KeyboardAvoidingView, - SectionList, - StyleSheet, - Text, - View, -} from 'react-native'; +import {SectionList, StyleSheet, Text, View} from 'react-native'; import {useSelector} from 'react-redux'; import {RootState} from 'src/store/rootreducer'; +import {NO_RESULTS_FOUND} from '../../constants/strings'; import {PreviewType, ScreenType} from '../../types'; import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; import SearchResultsCell from './SearchResultCell'; -import {NO_RESULTS_FOUND} from '../../constants/strings'; + interface SearchResultsProps { results: Array | undefined; + keyboardVisible: boolean; previewType: PreviewType; screenType: ScreenType; } @@ -26,7 +21,10 @@ const sectionHeader: React.FC = (showBorder: Boolean) => { return null; }; -const SearchResultList: React.FC = ({results}) => { +const SearchResultList: React.FC = ({ + results, + keyboardVisible, +}) => { const [showSection, setShowSection] = useState(true); const [showEmptyView, setshowEmptyView] = useState(false); const {user: loggedInUser} = useSelector((state: RootState) => state.user); @@ -48,8 +46,11 @@ const SearchResultList: React.FC = ({results}) => { )} {!showEmptyView && ( item.id + index} renderItem={({item}) => ( @@ -69,7 +70,7 @@ const SearchResultList: React.FC = ({results}) => { const styles = StyleSheet.create({ container: { - marginTop: SCREEN_HEIGHT * 0.04, + marginTop: SCREEN_HEIGHT * 0.02, }, sectionHeaderStyle: { width: '100%', @@ -78,7 +79,6 @@ const styles = StyleSheet.create({ backgroundColor: '#C4C4C4', }, keyboardOpen: {marginBottom: SCREEN_HEIGHT * 0.3}, - keyboardClose: {marginBottom: 20}, noResultsTextContainer: { justifyContent: 'center', flexDirection: 'row', diff --git a/src/components/search/SearchResultsBackground.tsx b/src/components/search/SearchResultsBackground.tsx index fa4e18ca..c5fcc6fb 100644 --- a/src/components/search/SearchResultsBackground.tsx +++ b/src/components/search/SearchResultsBackground.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import Animated, {interpolate} from 'react-native-reanimated'; import {StyleSheet} from 'react-native'; +import Animated, {interpolate} from 'react-native-reanimated'; import {SCREEN_HEIGHT, SCREEN_WIDTH, StatusBarHeight} from '../../utils'; interface SearchResultsBackgroundProps { @@ -21,11 +21,9 @@ const SearchResultsBackground: React.FC = ({ return ( - + {children} - + ); }; diff --git a/src/screens/search/SearchScreen.tsx b/src/screens/search/SearchScreen.tsx index b6841480..70733d7e 100644 --- a/src/screens/search/SearchScreen.tsx +++ b/src/screens/search/SearchScreen.tsx @@ -3,12 +3,10 @@ import {useFocusEffect} from '@react-navigation/native'; import React, {useCallback, useEffect, useState} from 'react'; import { Keyboard, - KeyboardAvoidingView, RefreshControl, ScrollView, StatusBar, StyleSheet, - SafeAreaView, } from 'react-native'; import Animated, {Easing, timing} from 'react-native-reanimated'; import {useDispatch, useSelector} from 'react-redux'; @@ -23,15 +21,11 @@ import { TabsGradient, } from '../../components'; import {SEARCH_ENDPOINT, TAGG_LIGHT_BLUE} from '../../constants'; +import {loadSearchResults} from '../../services'; import {loadRecentlySearched, resetScreenType} from '../../store/actions'; import {RootState} from '../../store/rootReducer'; -import {ProfilePreviewType, ScreenType, UserType} from '../../types'; +import {ProfilePreviewType, ScreenType} from '../../types'; import {SCREEN_HEIGHT, SCREEN_WIDTH, StatusBarHeight} from '../../utils'; -import {loadSearchResults} from '../../services'; -const NO_USER: UserType = { - userId: '', - username: '', -}; /** * Search Screen for user recommendations and a search @@ -178,25 +172,22 @@ const SearchScreen: React.FC = () => { - - {results === undefined && recents.length !== 0 ? ( - - ) : ( - - )} - + {results === undefined && recents.length !== 0 ? ( + + ) : ( + + )} -- cgit v1.2.3-70-g09d2