-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchAndRecentSearch.js
51 lines (45 loc) · 1.27 KB
/
searchAndRecentSearch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react';
import { Animated, ScrollView, View, Text, StyleSheet } from 'react-native';
const SearchAndRecentSearches = () => {
const scrollY = useRef(new Animated.Value(0)).current;
const height = scrollY.interpolate({
inputRange: [0, 100], // Adjust the range as needed
outputRange: [100, 300], // Adjust the height as needed
extrapolate: 'clamp',
});
return (
<Animated.ScrollView
contentContainerStyle={[styles.container, { height }]}
onScroll={Animated.event(
[{ nativeEvent: { contentOffset: { y: scrollY } } }],
{ useNativeDriver: false }
)}
scrollEventThrottle={16}
>
{/* Search bar */}
<View style={styles.searchBar}>
<TextInput
style={styles.input}
placeholder="Search..."
placeholderTextColor="#888"
/>
</View>
{/* Recent searches */}
<View style={styles.recentSearches}>
{/* Your recent searches component */}
</View>
</Animated.ScrollView>
);
};
const styles = StyleSheet.create({
container: {
paddingTop: 20, // Adjust as needed
},
searchBar: {
// Your search bar styles
},
recentSearches: {
// Your recent searches styles
},
});
export default SearchAndRecentSearches;