Skip to content
This repository was archived by the owner on Aug 29, 2020. It is now read-only.

Commit ca474ec

Browse files
committed
Add autocomplete 'components' parameter
1 parent 86062b4 commit ca474ec

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ interface GoogleProps {
55
radius?: number
66
strictbounds?: boolean
77
offset?: number
8+
components?: string
89
}
910

1011
export interface AutocompleteProps {

lib/use-google-autocomplete.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/use-google-autocomplete.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/use-google-autocomplete.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ export default function useGoogleAutocomplete({
9696
const language = options.language ? `&language=${options.language}` : ''
9797
const location = options.location ? `&location=${options.location}` : ''
9898
const radius = options.radius ? `&radius=${options.radius}` : ''
99+
const components = options.components ? `&components=${options.components}` : ''
99100

100-
const url = `${cors}https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${query}${types}${language}${location}${radius}${strictbounds}${offset}&key=${apiKey}&sessiontoken=${
101+
const url = `${cors}https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${query}${types}${language}${location}${radius}${components}${strictbounds}${offset}&key=${apiKey}&sessiontoken=${
101102
sessionToken.current
102103
}`
103104

0 commit comments

Comments
 (0)