Merge pull request #31725 from InigoDDC/react-places-autocomplete-add-googleCallbackName

[@types/react-places-autocomplete] add googleCallbackName property to PropTypes
This commit is contained in:
Sheetal Nandi
2019-01-02 12:11:50 -08:00
committed by GitHub
2 changed files with 8 additions and 8 deletions
+4 -6
View File
@@ -8,8 +8,7 @@
// TypeScript Version: 2.8
//
/// <reference types="googlemaps" />
import * as React from "react";
import * as React from 'react';
export type AutocompletePrediction = google.maps.places.AutocompletePrediction;
@@ -29,6 +28,8 @@ export interface Suggestion {
}
export interface PropTypes {
onChange?: (value: string) => void;
value?: string;
onError?: (status: string, clearSuggestion: () => void) => void;
onSelect?: (address: string, placeID: string) => void;
searchOptions?: {
@@ -39,13 +40,10 @@ export interface PropTypes {
radius?: number | string;
types?: string[];
};
value?: string;
onChange?: (value: string) => void;
debounce?: number;
highlightFirstSuggestion?: boolean;
shouldFetchSuggestions?: boolean;
googleCallbackName?: string;
children: (opts: Readonly<{
loading: boolean;
suggestions: ReadonlyArray<Suggestion>;
@@ -1,5 +1,7 @@
import * as React from 'react';
import PlacesAutocomplete, { geocodeByAddress, geocodeByPlaceId, getLatLng } from 'react-places-autocomplete';
import PlacesAutocomplete, {
geocodeByAddress, geocodeByPlaceId, getLatLng
} from 'react-places-autocomplete';
class Test extends React.Component {
state = {
@@ -28,7 +30,7 @@ class Test extends React.Component {
render() {
return (
<form onSubmit={this.handleFormSubmit}>
<PlacesAutocomplete value={this.state.address} onChange={this.onChange}>
<PlacesAutocomplete value={this.state.address} onChange={this.onChange} googleCallbackName="google_callback_name">
{({getInputProps, getSuggestionItemProps, suggestions}) => (
<>
<input {...getInputProps()} />