diff --git a/GooglePlacesAutocomplete.d.ts b/GooglePlacesAutocomplete.d.ts index 1fbd5f91..15d5a8a0 100644 --- a/GooglePlacesAutocomplete.d.ts +++ b/GooglePlacesAutocomplete.d.ts @@ -390,6 +390,7 @@ interface GooglePlacesAutocompleteProps { region?: string; components?: string; }; + inbetweenCompo?: React.ReactNode; isRowScrollable?: boolean; keyboardShouldPersistTaps?: 'never' | 'always' | 'handled'; /** use the ListEmptyComponent prop when no autocomplete results are found. */ diff --git a/GooglePlacesAutocomplete.js b/GooglePlacesAutocomplete.js index cd032535..de3099a2 100644 --- a/GooglePlacesAutocomplete.js +++ b/GooglePlacesAutocomplete.js @@ -17,6 +17,7 @@ import { Keyboard, Platform, ScrollView, + StyleSheet, Text, TextInput, TouchableHighlight, @@ -54,7 +55,7 @@ const defaultStyles = { }, description: {}, separator: { - height: 0.5, + height: StyleSheet.hairlineWidth, backgroundColor: '#c8c7cc', }, poweredContainer: { @@ -819,9 +820,9 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => { placeholder={props.placeholder} onFocus={ onFocus - ? () => { + ? (e) => { _onFocus(); - onFocus(); + onFocus(e); } : _onFocus } @@ -829,7 +830,7 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => { onBlur ? (e) => { _onBlur(e); - onBlur(); + onBlur(e); } : _onBlur } @@ -840,6 +841,7 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => { {_renderRightButton()} )} + {props.inbetweenCompo} {_getFlatList()} {props.children} @@ -859,6 +861,7 @@ GooglePlacesAutocomplete.propTypes = { GooglePlacesDetailsQuery: PropTypes.object, GooglePlacesSearchQuery: PropTypes.object, GoogleReverseGeocodingQuery: PropTypes.object, + inbetweenCompo: PropTypes.object, isRowScrollable: PropTypes.bool, keyboardShouldPersistTaps: PropTypes.oneOf(['never', 'always', 'handled']), listEmptyComponent: PropTypes.func, diff --git a/README.md b/README.md index 8694bbf5..43d129c9 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ export default GooglePlacesInput;
Click to expand -This is an example using the Text Input from [`react-native-elements`](https://reactnativeelements.com/docs/input). +This is an example using the Text Input from [`react-native-elements`](https://reactnativeelements.com/docs/components/input). ```js import React from 'react'; @@ -236,6 +236,7 @@ _This list is a work in progress. PRs welcome!_ | GooglePlacesSearchQuery | object | "query" object for the Google Places Nearby API (when you use current location to find nearby places) | `{ rankby: 'distance', type: 'restaurant' }` | | | GoogleReverseGeocodingQuery | object | "query" object for the Google Geocode API (when you use current location to get the current address) | | | | isRowScrollable | boolean | enable/disable horizontal scrolling of a list result https://reactnative.dev/docs/scrollview#scrollenabled | true | +|inbetweenCompo|React.ReactNode|Insert a ReactNode in between the search bar and the search results Flatlist | keepResultsAfterBlur | boolean | show list of results after blur | false | true \| false | | keyboardShouldPersistTaps | string | Determines when the keyboard should stay visible after a tap https://reactnative.dev/docs/scrollview#keyboardshouldpersisttaps | 'always' | 'never' \| 'always' \| 'handled' | | listEmptyComponent | function | use FlatList's ListEmptyComponent prop when no autocomplete results are found. | | | diff --git a/package.json b/package.json index 465b9250..cb657852 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-google-places-autocomplete", - "version": "2.4.1", + "version": "2.5.1", "description": "Customizable Google Places autocomplete component for iOS and Android React-Native apps", "main": "GooglePlacesAutocomplete.js", "types": "GooglePlacesAutocomplete.d.ts",