-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
43 lines (36 loc) · 1.1 KB
/
App.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
import React, { useState } from 'react';
import { StatusBar } from 'expo-status-bar';
import { SafeAreaView, StyleSheet, View } from 'react-native';
import Header from './components/Header'
import SearchInput from './components/SearchInput'
import SearchResults from './components/SearchResults';
import searchEmoji from './search/searchEmoji';
const MAX_SEARCH_RESULTS = 20
export default function App() {
const [searchResults, setSearchResults] = useState(searchEmoji('', MAX_SEARCH_RESULTS))
const handleSearchChange = searchText => {
setSearchResults(searchEmoji(searchText, MAX_SEARCH_RESULTS))
}
return (
<SafeAreaView style={styles.container}>
<View style={styles.contentContainer}>
<StatusBar style="auto" />
<Header />
<SearchInput onChangeText={handleSearchChange} />
<SearchResults results={searchResults} />
</View>
</SafeAreaView>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
},
contentContainer: {
flex: 1,
maxWidth: 600,
width: '100%',
},
})