Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 858d33f

Browse files
authored
fix(react-native): update template and related dependencies (#546)
1 parent 3ec5123 commit 858d33f

File tree

6 files changed

+55
-82
lines changed

6 files changed

+55
-82
lines changed

e2e/__snapshots__/templates.test.js.snap

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,7 +3451,7 @@ If you want to publish it as a public scoped package, run \`npm publish --access
34513451
exports[`Templates InstantSearch.js widget File content: LICENSE.md 1`] = `
34523452
"The MIT License (MIT)
34533453
3454-
Copyright (c) 2021-present algolia.
3454+
Copyright (c) 2022-present algolia.
34553455
34563456
Permission is hereby granted, free of charge, to any person obtaining a copy
34573457
of this software and associated documentation files (the \\"Software\\"), to deal
@@ -5904,7 +5904,7 @@ exports[`Templates React InstantSearch Native File content: .watchmanconfig 1`]
59045904
exports[`Templates React InstantSearch Native File content: App.js 1`] = `
59055905
"import React from 'react';
59065906
import { StyleSheet, View, SafeAreaView, StatusBar } from 'react-native';
5907-
import algoliasearch from 'algoliasearch/reactnative';
5907+
import algoliasearch from 'algoliasearch';
59085908
import { InstantSearch } from 'react-instantsearch-native';
59095909
import SearchBox from './src/SearchBox';
59105910
import InfiniteHits from './src/InfiniteHits';
@@ -5925,34 +5925,19 @@ const styles = StyleSheet.create({
59255925
},
59265926
});
59275927
5928-
class App extends React.Component {
5929-
root = {
5930-
Root: View,
5931-
props: {
5932-
style: {
5933-
flex: 1,
5934-
},
5935-
},
5936-
};
5937-
5938-
render() {
5939-
return (
5940-
<SafeAreaView style={styles.safe}>
5941-
<StatusBar barStyle=\\"light-content\\" />
5942-
<View style={styles.container}>
5943-
<InstantSearch
5944-
searchClient={searchClient}
5945-
indexName=\\"indexName\\"
5946-
root={this.root}
5947-
>
5948-
<SearchBox />
5949-
<InfiniteHits />
5950-
</InstantSearch>
5951-
</View>
5952-
</SafeAreaView>
5953-
);
5954-
}
5955-
}
5928+
const App = () => {
5929+
return (
5930+
<SafeAreaView style={styles.safe}>
5931+
<StatusBar barStyle=\\"light-content\\" />
5932+
<View style={styles.container}>
5933+
<InstantSearch searchClient={searchClient} indexName=\\"indexName\\">
5934+
<SearchBox />
5935+
<InfiniteHits />
5936+
</InstantSearch>
5937+
</View>
5938+
</SafeAreaView>
5939+
);
5940+
};
59565941
59575942
export default App;"
59585943
`;
@@ -5984,7 +5969,7 @@ exports[`Templates React InstantSearch Native File content: app.json 1`] = `
59845969
\\"expo\\": {
59855970
\\"name\\": \\"react-instantsearch-native-app\\",
59865971
\\"slug\\": \\"react-instantsearch-native-app\\",
5987-
\\"sdkVersion\\": \\"32.0.0\\"
5972+
\\"sdkVersion\\": \\"44.0.0\\"
59885973
}
59895974
}"
59905975
`;
@@ -6076,12 +6061,12 @@ const styles = StyleSheet.create({
60766061
},
60776062
});
60786063
6079-
const InfiniteHits = ({ hits, hasMore, refine }) => (
6064+
const InfiniteHits = ({ hits, hasMore, refineNext }) => (
60806065
<FlatList
60816066
data={hits}
60826067
keyExtractor={item => item.objectID}
60836068
ItemSeparatorComponent={() => <View style={styles.separator} />}
6084-
onEndReached={() => hasMore && refine()}
6069+
onEndReached={() => hasMore && refineNext()}
60856070
renderItem={({ item }) => (
60866071
<View style={styles.item}>
60876072
<Text style={styles.titleText}>
@@ -6098,7 +6083,7 @@ const InfiniteHits = ({ hits, hasMore, refine }) => (
60986083
InfiniteHits.propTypes = {
60996084
hits: PropTypes.arrayOf(PropTypes.object).isRequired,
61006085
hasMore: PropTypes.bool.isRequired,
6101-
refine: PropTypes.func.isRequired,
6086+
refineNext: PropTypes.func.isRequired,
61026087
};
61036088
61046089
export default connectInfiniteHits(InfiniteHits);"
@@ -6113,6 +6098,7 @@ import { connectSearchBox } from 'react-instantsearch-native';
61136098
const styles = StyleSheet.create({
61146099
container: {
61156100
padding: 16,
6101+
backgroundColor: '#252b33',
61166102
},
61176103
input: {
61186104
height: 48,
@@ -6258,7 +6244,7 @@ If you want to publish it as a public scoped package, run \`npm publish --access
62586244
exports[`Templates React InstantSearch widget File content: LICENSE.md 1`] = `
62596245
"The MIT License (MIT)
62606246
6261-
Copyright (c) 2021-present algolia.
6247+
Copyright (c) 2022-present algolia.
62626248
62636249
Permission is hereby granted, free of charge, to any person obtaining a copy
62646250
of this software and associated documentation files (the \\"Software\\"), to deal
Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { StyleSheet, View, SafeAreaView, StatusBar } from 'react-native';
3-
import algoliasearch from 'algoliasearch/reactnative';
3+
import algoliasearch from 'algoliasearch';
44
import { InstantSearch } from 'react-instantsearch-native';
55
import SearchBox from './src/SearchBox';
66
import InfiniteHits from './src/InfiniteHits';
@@ -21,33 +21,18 @@ const styles = StyleSheet.create({
2121
},
2222
});
2323

24-
class App extends React.Component {
25-
root = {
26-
Root: View,
27-
props: {
28-
style: {
29-
flex: 1,
30-
},
31-
},
32-
};
33-
34-
render() {
35-
return (
36-
<SafeAreaView style={styles.safe}>
37-
<StatusBar barStyle="light-content" />
38-
<View style={styles.container}>
39-
<InstantSearch
40-
searchClient={searchClient}
41-
indexName="{{indexName}}"
42-
root={this.root}
43-
>
44-
<SearchBox />
45-
<InfiniteHits />
46-
</InstantSearch>
47-
</View>
48-
</SafeAreaView>
49-
);
50-
}
51-
}
24+
const App = () => {
25+
return (
26+
<SafeAreaView style={styles.safe}>
27+
<StatusBar barStyle="light-content" />
28+
<View style={styles.container}>
29+
<InstantSearch searchClient={searchClient} indexName="{{indexName}}">
30+
<SearchBox />
31+
<InfiniteHits />
32+
</InstantSearch>
33+
</View>
34+
</SafeAreaView>
35+
);
36+
};
5237

5338
export default App;

src/templates/React InstantSearch Native/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"expo": {
33
"name": "{{name}}",
44
"slug": "{{name}}",
5-
"sdkVersion": "32.0.0"
5+
"sdkVersion": "44.0.0"
66
}
77
}

src/templates/React InstantSearch Native/package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@
1010
"eject": "expo eject"
1111
},
1212
"dependencies": {
13-
"algoliasearch": "3.32.1",
14-
"expo": "32.0.6",
15-
"prop-types": "15.7.2",
16-
"react": "16.5.0",
13+
"algoliasearch": "4.11.0",
14+
"expo": "44.0.3",
15+
"prop-types": "15.8.0",
16+
"react": "17.0.2",
1717
"react-instantsearch-native": "{{libraryVersion}}",
18-
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz"
18+
"react-native": "0.64.3"
1919
},
2020
"devDependencies": {
21-
"babel-preset-expo": "5.2.0",
22-
"eslint": "5.7.0",
23-
"eslint-config-algolia": "13.2.3",
24-
"eslint-config-prettier": "3.6.0",
25-
"eslint-plugin-import": "2.18.2",
26-
"eslint-plugin-prettier": "3.1.0",
27-
"eslint-plugin-react": "7.13.0",
28-
"expo-cli": "2.21.2",
29-
"prettier": "1.19.1"
21+
"@babel/core": "7.16.5",
22+
"babel-preset-expo": "9.0.2",
23+
"eslint": "8.5.0",
24+
"eslint-config-algolia": "20.0.0",
25+
"eslint-config-prettier": "8.3.0",
26+
"eslint-plugin-import": "2.25.3",
27+
"eslint-plugin-prettier": "4.0.0",
28+
"eslint-plugin-react": "7.28.0",
29+
"expo-cli": "5.0.3",
30+
"prettier": "2.5.1"
3031
}
3132
}

src/templates/React InstantSearch Native/src/InfiniteHits.js.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ const styles = StyleSheet.create({
2020
},
2121
});
2222

23-
const InfiniteHits = ({ hits, hasMore, refine }) => (
23+
const InfiniteHits = ({ hits, hasMore, refineNext }) => (
2424
<FlatList
2525
data={hits}
2626
keyExtractor={item => item.objectID}
2727
ItemSeparatorComponent={() => <View style={styles.separator} />}
28-
onEndReached={() => hasMore && refine()}
28+
onEndReached={() => hasMore && refineNext()}
2929
renderItem={({ item }) => (
3030
<View style={styles.item}>
3131
{{#if attributesToDisplay}}
@@ -50,7 +50,7 @@ const InfiniteHits = ({ hits, hasMore, refine }) => (
5050
InfiniteHits.propTypes = {
5151
hits: PropTypes.arrayOf(PropTypes.object).isRequired,
5252
hasMore: PropTypes.bool.isRequired,
53-
refine: PropTypes.func.isRequired,
53+
refineNext: PropTypes.func.isRequired,
5454
};
5555

5656
export default connectInfiniteHits(InfiniteHits);

src/templates/React InstantSearch Native/src/SearchBox.js.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { connectSearchBox } from 'react-instantsearch-native';
66
const styles = StyleSheet.create({
77
container: {
88
padding: 16,
9+
backgroundColor: '#252b33',
910
},
1011
input: {
1112
height: 48,

0 commit comments

Comments
 (0)