Skip to content

Commit

Permalink
🎉 use connectStats from algolia
Browse files Browse the repository at this point in the history
  • Loading branch information
ajubin committed May 20, 2019
1 parent 4b19811 commit 8ce01bf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
*/

import React, { Component } from "react";
import { StyleSheet, SafeAreaView } from "react-native";
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 } from "react-instantsearch-native";
import { InstantSearch, connectStats } from "react-instantsearch-native";

interface Props {}
export class App extends Component<Props> {
Expand All @@ -29,13 +29,20 @@ export class App extends Component<Props> {
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,
Expand Down

0 comments on commit 8ce01bf

Please sign in to comment.