Skip to content

Commit

Permalink
Make getCurrentLocation accessible on the ref object
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryk authored and bell-steven committed Apr 26, 2021
1 parent f2e92a3 commit 2a697a6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions GooglePlacesAutocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ interface GooglePlacesAutocompleteProps {
export type GooglePlacesAutocompleteRef = {
setAddressText(address: string): void;
getAddressText(): string;
getCurrentLocation(): void;
} & TextInput;

export const GooglePlacesAutocomplete: React.ForwardRefExoticComponent<
Expand Down
1 change: 1 addition & 0 deletions GooglePlacesAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
focus: () => inputRef.current.focus(),
isFocused: () => inputRef.current.isFocused(),
clear: () => inputRef.current.clear(),
getCurrentLocation,
}));

const requestShouldUseWithCredentials = () =>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ _This list is a work in progress. PRs welcome!_
| `blur` | `void` | makes the TextInput lose focus |
| `clear` | `void` | removes all text from the TextInput |
| `isFocused` | `() => boolean` | returns `true` if the TextInput is currently focused; `false` otherwise |
| `getCurrentLocation` | `() => void` | makes a query to find nearby places based on current location |

You can access these methods using a ref.

Expand Down

0 comments on commit 2a697a6

Please sign in to comment.