react-native-google-places-autocomplete 2.5.3 → 2.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GooglePlacesAutocomplete.js +13 -5
- package/package.json +1 -1
|
@@ -84,10 +84,15 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
const buildRowsFromResults = (results) => {
|
|
87
|
+
const buildRowsFromResults = (results, text) => {
|
|
88
88
|
let res = [];
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const shouldDisplayPredefinedPlaces = text
|
|
90
|
+
? results.length === 0 && text.length === 0
|
|
91
|
+
: results.length === 0;
|
|
92
|
+
if (
|
|
93
|
+
shouldDisplayPredefinedPlaces ||
|
|
94
|
+
props.predefinedPlacesAlwaysVisible === true
|
|
95
|
+
) {
|
|
91
96
|
res = [
|
|
92
97
|
...props.predefinedPlaces.filter((place) => place?.description.length),
|
|
93
98
|
];
|
|
@@ -173,7 +178,10 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
|
|
|
173
178
|
url === 'https://maps.googleapis.com/maps/api';
|
|
174
179
|
|
|
175
180
|
const _abortRequests = () => {
|
|
176
|
-
_requests.map((i) =>
|
|
181
|
+
_requests.map((i) => {
|
|
182
|
+
i.onreadystatechange = null;
|
|
183
|
+
i.abort();
|
|
184
|
+
});
|
|
177
185
|
_requests = [];
|
|
178
186
|
};
|
|
179
187
|
|
|
@@ -511,7 +519,7 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
|
|
|
511
519
|
: responseJSON.predictions;
|
|
512
520
|
|
|
513
521
|
_results = results;
|
|
514
|
-
setDataSource(buildRowsFromResults(results));
|
|
522
|
+
setDataSource(buildRowsFromResults(results, text));
|
|
515
523
|
// }
|
|
516
524
|
}
|
|
517
525
|
if (typeof responseJSON.error_message !== 'undefined') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-google-places-autocomplete",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5",
|
|
4
4
|
"description": "Customizable Google Places autocomplete component for iOS and Android React-Native apps",
|
|
5
5
|
"main": "GooglePlacesAutocomplete.js",
|
|
6
6
|
"types": "GooglePlacesAutocomplete.d.ts",
|