Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions GooglePlacesAutocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ interface GooglePlacesAutocompleteProps {
enablePoweredByContainer?: boolean;
fetchDetails?: boolean;
/** filter the reverse geocoding results by types - ['locality', 'administrative_area_level_3'] if you want to display only cities */
filter?: (data: any[]) => any[];
/** add custom filter method for dataSource */
filterReverseGeocodingByTypes?: PlaceType[];
/** available options for GooglePlacesDetails API: https://developers.google.com/places/web-service/details */
GooglePlacesDetailsQuery?: Partial<Query> & { fields?: string };
Expand Down
2 changes: 1 addition & 1 deletion GooglePlacesAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
props.suppressDefaultStyles ? {} : defaultStyles.listView,
props.styles.listView,
]}
data={dataSource}
data={props.filter ? props.filter(dataSource): dataSource}
keyExtractor={keyGenerator}
extraData={[dataSource, props]}
ItemSeparatorComponent={_renderSeparator}
Expand Down