Skip to content

Commit

Permalink
Fix updating props.predefinedPlaces
Browse files Browse the repository at this point in the history
  • Loading branch information
iketiunn authored and bell-steven committed Mar 15, 2021
1 parent d1657fa commit ec0ad69
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GooglePlacesAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
// Update dataSource if props.predefinedPlaces changed
setDataSource(buildRowsFromResults([]))
}, [props.predefinedPlaces])

useImperativeHandle(ref, () => ({
setAddressText: (address) => {
Expand Down

0 comments on commit ec0ad69

Please sign in to comment.