From 86cab84728d96e16d03e69250e3d816fea1dfd43 Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Thu, 30 Dec 2021 16:28:53 +0100 Subject: [PATCH 1/9] fix(react-native): use up to date dependencies in template --- .../React InstantSearch Native/App.js.hbs | 2 +- .../React InstantSearch Native/app.json | 3 +- .../React InstantSearch Native/package.json | 31 ++++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/templates/React InstantSearch Native/App.js.hbs b/src/templates/React InstantSearch Native/App.js.hbs index 01da44f9f..173a4bcce 100644 --- a/src/templates/React InstantSearch Native/App.js.hbs +++ b/src/templates/React InstantSearch Native/App.js.hbs @@ -1,6 +1,6 @@ import React from 'react'; import { StyleSheet, View, SafeAreaView, StatusBar } from 'react-native'; -import algoliasearch from 'algoliasearch/reactnative'; +import algoliasearch from 'algoliasearch'; import { InstantSearch } from 'react-instantsearch-native'; import SearchBox from './src/SearchBox'; import InfiniteHits from './src/InfiniteHits'; diff --git a/src/templates/React InstantSearch Native/app.json b/src/templates/React InstantSearch Native/app.json index 8005f29d1..ceefb5c4f 100644 --- a/src/templates/React InstantSearch Native/app.json +++ b/src/templates/React InstantSearch Native/app.json @@ -1,7 +1,6 @@ { "expo": { "name": "{{name}}", - "slug": "{{name}}", - "sdkVersion": "32.0.0" + "slug": "{{name}}" } } diff --git a/src/templates/React InstantSearch Native/package.json b/src/templates/React InstantSearch Native/package.json index d93558074..02fdee7e8 100644 --- a/src/templates/React InstantSearch Native/package.json +++ b/src/templates/React InstantSearch Native/package.json @@ -10,22 +10,23 @@ "eject": "expo eject" }, "dependencies": { - "algoliasearch": "3.32.1", - "expo": "32.0.6", - "prop-types": "15.7.2", - "react": "16.5.0", - "react-instantsearch-native": "{{libraryVersion}}", - "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz" + "algoliasearch": "4.11.0", + "expo": "44.0.3", + "prop-types": "15.8.0", + "react": "17.0.2", + "react-instantsearch-native": "6.18.0", + "react-native": "0.64.3" }, "devDependencies": { - "babel-preset-expo": "5.2.0", - "eslint": "5.7.0", - "eslint-config-algolia": "13.2.3", - "eslint-config-prettier": "3.6.0", - "eslint-plugin-import": "2.18.2", - "eslint-plugin-prettier": "3.1.0", - "eslint-plugin-react": "7.13.0", - "expo-cli": "2.21.2", - "prettier": "1.19.1" + "@babel/core": "7.16.5", + "babel-preset-expo": "9.0.2", + "eslint": "8.5.0", + "eslint-config-algolia": "20.0.0", + "eslint-config-prettier": "8.3.0", + "eslint-plugin-import": "2.25.3", + "eslint-plugin-prettier": "4.0.0", + "eslint-plugin-react": "7.28.0", + "expo-cli": "5.0.3", + "prettier": "2.5.1" } } From ebd55a638ab951645a1e61717974744f1f99ddb2 Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Thu, 30 Dec 2021 17:49:45 +0100 Subject: [PATCH 2/9] fix(react-native): remove deprecated prop and convert app to function component --- .../React InstantSearch Native/App.js.hbs | 41 ++++++------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/src/templates/React InstantSearch Native/App.js.hbs b/src/templates/React InstantSearch Native/App.js.hbs index 173a4bcce..26ed778c8 100644 --- a/src/templates/React InstantSearch Native/App.js.hbs +++ b/src/templates/React InstantSearch Native/App.js.hbs @@ -21,33 +21,18 @@ const styles = StyleSheet.create({ }, }); -class App extends React.Component { - root = { - Root: View, - props: { - style: { - flex: 1, - }, - }, - }; - - render() { - return ( - - - - - - - - - - ); - } -} +const App = () => { + return ( + + + + + + + + + + ); +}; export default App; From 87d52f9de5f0861a8130864cd247f1c1ca22dccd Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Thu, 30 Dec 2021 17:52:28 +0100 Subject: [PATCH 3/9] test(react-native): update e2e snapshots --- e2e/__snapshots__/templates.test.js.snap | 48 ++++++++---------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index 0e0facdb4..4dd5c8348 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -5904,7 +5904,7 @@ exports[`Templates React InstantSearch Native File content: .watchmanconfig 1`] exports[`Templates React InstantSearch Native File content: App.js 1`] = ` "import React from 'react'; import { StyleSheet, View, SafeAreaView, StatusBar } from 'react-native'; -import algoliasearch from 'algoliasearch/reactnative'; +import algoliasearch from 'algoliasearch'; import { InstantSearch } from 'react-instantsearch-native'; import SearchBox from './src/SearchBox'; import InfiniteHits from './src/InfiniteHits'; @@ -5925,34 +5925,19 @@ const styles = StyleSheet.create({ }, }); -class App extends React.Component { - root = { - Root: View, - props: { - style: { - flex: 1, - }, - }, - }; - - render() { - return ( - - - - - - - - - - ); - } -} +const App = () => { + return ( + + + + + + + + + + ); +}; export default App;" `; @@ -5983,8 +5968,7 @@ exports[`Templates React InstantSearch Native File content: app.json 1`] = ` "{ \\"expo\\": { \\"name\\": \\"react-instantsearch-native-app\\", - \\"slug\\": \\"react-instantsearch-native-app\\", - \\"sdkVersion\\": \\"32.0.0\\" + \\"slug\\": \\"react-instantsearch-native-app\\" } }" `; @@ -6011,7 +5995,7 @@ exports[`Templates React InstantSearch Native File content: package.json 1`] = ` \\"eject\\": \\"expo eject\\" }, \\"partialDependencies\\": { - \\"react-instantsearch-native\\": \\"5.2.0\\" + \\"react-instantsearch-native\\": \\"6.18.0\\" } }" `; From 3666fb816cad3bbac64e0adfc1c5a22e6b7b6e25 Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Fri, 31 Dec 2021 10:58:53 +0100 Subject: [PATCH 4/9] fix: use refineNext --- .../React InstantSearch Native/src/InfiniteHits.js.hbs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/templates/React InstantSearch Native/src/InfiniteHits.js.hbs b/src/templates/React InstantSearch Native/src/InfiniteHits.js.hbs index fdd7cf136..fc6eecb9a 100644 --- a/src/templates/React InstantSearch Native/src/InfiniteHits.js.hbs +++ b/src/templates/React InstantSearch Native/src/InfiniteHits.js.hbs @@ -20,12 +20,12 @@ const styles = StyleSheet.create({ }, }); -const InfiniteHits = ({ hits, hasMore, refine }) => ( +const InfiniteHits = ({ hits, hasMore, refineNext }) => ( item.objectID} ItemSeparatorComponent={() => } - onEndReached={() => hasMore && refine()} + onEndReached={() => hasMore && refineNext()} renderItem={({ item }) => ( {{#if attributesToDisplay}} @@ -50,7 +50,7 @@ const InfiniteHits = ({ hits, hasMore, refine }) => ( InfiniteHits.propTypes = { hits: PropTypes.arrayOf(PropTypes.object).isRequired, hasMore: PropTypes.bool.isRequired, - refine: PropTypes.func.isRequired, + refineNext: PropTypes.func.isRequired, }; export default connectInfiniteHits(InfiniteHits); From 8194b597edb64a6dd830ecdb8e5d5388ea30c296 Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:10:17 +0100 Subject: [PATCH 5/9] update snapshots --- e2e/__snapshots__/templates.test.js.snap | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index 4dd5c8348..60206c4f9 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -3266,13 +3266,11 @@ search.addWidgets([ }); }, widgets: [ - container => - instantsearch.widgets.refinementList({ + container => instantsearch.widgets.refinementList({ container, attribute: 'facet1', }), - container => - instantsearch.widgets.refinementList({ + container => instantsearch.widgets.refinementList({ container, attribute: 'facet2', }), @@ -6060,12 +6058,12 @@ const styles = StyleSheet.create({ }, }); -const InfiniteHits = ({ hits, hasMore, refine }) => ( +const InfiniteHits = ({ hits, hasMore, refineNext }) => ( item.objectID} ItemSeparatorComponent={() => } - onEndReached={() => hasMore && refine()} + onEndReached={() => hasMore && refineNext()} renderItem={({ item }) => ( @@ -6082,7 +6080,7 @@ const InfiniteHits = ({ hits, hasMore, refine }) => ( InfiniteHits.propTypes = { hits: PropTypes.arrayOf(PropTypes.object).isRequired, hasMore: PropTypes.bool.isRequired, - refine: PropTypes.func.isRequired, + refineNext: PropTypes.func.isRequired, }; export default connectInfiniteHits(InfiniteHits);" From 2e7f5097f25daf1dc33208c74894560ed1c70fd0 Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:16:18 +0100 Subject: [PATCH 6/9] update snapshots --- e2e/__snapshots__/templates.test.js.snap | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index 60206c4f9..56342195b 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -3266,11 +3266,13 @@ search.addWidgets([ }); }, widgets: [ - container => instantsearch.widgets.refinementList({ + container => + instantsearch.widgets.refinementList({ container, attribute: 'facet1', }), - container => instantsearch.widgets.refinementList({ + container => + instantsearch.widgets.refinementList({ container, attribute: 'facet2', }), From b76d49bbe938de740125c872787004462c73ed88 Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Mon, 3 Jan 2022 11:28:25 +0100 Subject: [PATCH 7/9] pr review fixes --- src/templates/React InstantSearch Native/app.json | 3 ++- src/templates/React InstantSearch Native/package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/templates/React InstantSearch Native/app.json b/src/templates/React InstantSearch Native/app.json index ceefb5c4f..d6363dee9 100644 --- a/src/templates/React InstantSearch Native/app.json +++ b/src/templates/React InstantSearch Native/app.json @@ -1,6 +1,7 @@ { "expo": { "name": "{{name}}", - "slug": "{{name}}" + "slug": "{{name}}", + "sdkVersion": "44.0.0" } } diff --git a/src/templates/React InstantSearch Native/package.json b/src/templates/React InstantSearch Native/package.json index 02fdee7e8..65a2bdc9f 100644 --- a/src/templates/React InstantSearch Native/package.json +++ b/src/templates/React InstantSearch Native/package.json @@ -14,7 +14,7 @@ "expo": "44.0.3", "prop-types": "15.8.0", "react": "17.0.2", - "react-instantsearch-native": "6.18.0", + "react-instantsearch-native": "{{libraryVersion}}", "react-native": "0.64.3" }, "devDependencies": { From 45ed4ae07856e08ef3c50532f900294c48cb8128 Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Mon, 3 Jan 2022 11:28:42 +0100 Subject: [PATCH 8/9] add background to searchbox component --- src/templates/React InstantSearch Native/src/SearchBox.js.hbs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templates/React InstantSearch Native/src/SearchBox.js.hbs b/src/templates/React InstantSearch Native/src/SearchBox.js.hbs index 69d85d535..b810852ff 100644 --- a/src/templates/React InstantSearch Native/src/SearchBox.js.hbs +++ b/src/templates/React InstantSearch Native/src/SearchBox.js.hbs @@ -6,6 +6,7 @@ import { connectSearchBox } from 'react-instantsearch-native'; const styles = StyleSheet.create({ container: { padding: 16, + backgroundColor: '#252b33', }, input: { height: 48, From d2d4d241a5ebbe1cda9cddd54858ed65c49c6966 Mon Sep 17 00:00:00 2001 From: Dhaya <154633+dhayab@users.noreply.github.com> Date: Mon, 3 Jan 2022 11:32:19 +0100 Subject: [PATCH 9/9] update e2e snapshots --- e2e/__snapshots__/templates.test.js.snap | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index 56342195b..65f632807 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -3451,7 +3451,7 @@ If you want to publish it as a public scoped package, run \`npm publish --access exports[`Templates InstantSearch.js widget File content: LICENSE.md 1`] = ` "The MIT License (MIT) -Copyright (c) 2021-present algolia. +Copyright (c) 2022-present algolia. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \\"Software\\"), to deal @@ -5968,7 +5968,8 @@ exports[`Templates React InstantSearch Native File content: app.json 1`] = ` "{ \\"expo\\": { \\"name\\": \\"react-instantsearch-native-app\\", - \\"slug\\": \\"react-instantsearch-native-app\\" + \\"slug\\": \\"react-instantsearch-native-app\\", + \\"sdkVersion\\": \\"44.0.0\\" } }" `; @@ -5995,7 +5996,7 @@ exports[`Templates React InstantSearch Native File content: package.json 1`] = ` \\"eject\\": \\"expo eject\\" }, \\"partialDependencies\\": { - \\"react-instantsearch-native\\": \\"6.18.0\\" + \\"react-instantsearch-native\\": \\"5.2.0\\" } }" `; @@ -6097,6 +6098,7 @@ import { connectSearchBox } from 'react-instantsearch-native'; const styles = StyleSheet.create({ container: { padding: 16, + backgroundColor: '#252b33', }, input: { height: 48, @@ -6242,7 +6244,7 @@ If you want to publish it as a public scoped package, run \`npm publish --access exports[`Templates React InstantSearch widget File content: LICENSE.md 1`] = ` "The MIT License (MIT) -Copyright (c) 2021-present algolia. +Copyright (c) 2022-present algolia. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \\"Software\\"), to deal