-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
52 lines (48 loc) · 1.22 KB
/
App.tsx
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
52
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/emin93/react-native-template-typescript
*
* @format
*/
import React, { Component } from "react";
import { StyleSheet, SafeAreaView, Text } from "react-native";
import { SearchBox, InfiniteHits } from "./src/components";
import {
ALGOLIA_APP_ID,
ALGOLIA_INDEX_NAME,
ALGOLIA_SEARCH_KEY,
} from "react-native-dotenv";
import { InstantSearch, connectStats } from "react-instantsearch-native";
interface Props {}
export class App extends Component<Props> {
render() {
return (
<SafeAreaView style={styles.container}>
<InstantSearch
apiKey={ALGOLIA_SEARCH_KEY}
appId={ALGOLIA_APP_ID}
indexName={ALGOLIA_INDEX_NAME}
>
<SearchBox />
<ConnectedStats />
<InfiniteHits />
</InstantSearch>
</SafeAreaView>
);
}
}
const ConnectedStats = connectStats(({ nbHits }) => (
<Text style={{ paddingLeft: 16 }}>
{nbHits.toLocaleString()} wine matching !
</Text>
));
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "flex-start",
backgroundColor: "white",
},
});