aboutsummaryrefslogtreecommitdiff
path: root/src/components/search/SearchBar.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-03-27 20:30:36 -0400
committerGitHub <noreply@github.com>2021-03-27 20:30:36 -0400
commit67fb6f5cae06dfbcb359dd6468cb66ad85fa230d (patch)
treeeaf092811d5be72e89e4dec9942dc59a1f8a0211 /src/components/search/SearchBar.tsx
parentbef5728b24a71d1bf327a72e425346020a997037 (diff)
parentbf0a2abf8bab333ff0d87bc07002e6f96199ce3b (diff)
Merge pull request #330 from ankit-thanekar007/tma-722-cornell-fe
[TMA 722] : Cornell FrontEnd changes
Diffstat (limited to 'src/components/search/SearchBar.tsx')
-rw-r--r--src/components/search/SearchBar.tsx21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/components/search/SearchBar.tsx b/src/components/search/SearchBar.tsx
index 62bda77e..4824b56f 100644
--- a/src/components/search/SearchBar.tsx
+++ b/src/components/search/SearchBar.tsx
@@ -1,19 +1,21 @@
-import React, {useState, useEffect} from 'react';
+import React, {useEffect, useState} from 'react';
import {
+ Keyboard,
+ NativeSyntheticEvent,
StyleSheet,
- TextInput,
- TouchableOpacity,
Text,
- View,
+ TextInput,
TextInputProps,
- Keyboard,
- NativeSyntheticEvent,
TextInputSubmitEditingEventData,
+ TouchableOpacity,
+ View,
} from 'react-native';
+import {normalize} from 'react-native-elements';
import Animated, {interpolate} from 'react-native-reanimated';
import Icon from 'react-native-vector-icons/Feather';
-import {normalize} from 'react-native-elements';
-import {SCREEN_HEIGHT, getSearchSuggestions} from '../../utils';
+import {useSelector} from 'react-redux';
+import {RootState} from '../../store/rootReducer';
+import {getSearchSuggestions, SCREEN_HEIGHT} from '../../utils';
const AnimatedIcon = Animated.createAnimatedComponent(Icon);
@@ -37,9 +39,10 @@ const SearchBar: React.FC<SearchBarProps> = ({
e.preventDefault();
Keyboard.dismiss();
};
+ const {university} = useSelector((state: RootState) => state.user.profile);
const DEFAULT_PLACEHOLDER: string = 'Search';
// the list of suggestions to cycle through. TODO: get this from the backend
- const SEARCH_SUGGESTIONS: string[] = getSearchSuggestions();
+ const SEARCH_SUGGESTIONS: string[] = getSearchSuggestions(university);
/*
* index & id of current placeholder, used in selecting next placeholder. -1
* indicates DEFAULT_PLACEHOLDER. TODO: make it appear more random by tracking