Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
bell-steven committed Aug 2, 2021
1 parent 096f7ca commit 8fca5d6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
13 changes: 9 additions & 4 deletions GooglePlacesAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
}, []);
useEffect(() => {
// Update dataSource if props.predefinedPlaces changed
setDataSource(buildRowsFromResults([]))
}, [props.predefinedPlaces])
setDataSource(buildRowsFromResults([]));
}, [props.predefinedPlaces]);

useImperativeHandle(ref, () => ({
setAddressText: (address) => {
Expand Down Expand Up @@ -530,7 +530,9 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
};

// eslint-disable-next-line react-hooks/exhaustive-deps
const debounceData = useMemo(() => debounce(_request, props.debounce), [props.query]);
const debounceData = useMemo(() => debounce(_request, props.debounce), [
props.query,
]);

const _onChangeText = (text) => {
setStateText(text);
Expand Down Expand Up @@ -849,7 +851,10 @@ GooglePlacesAutocomplete.propTypes = {
listEmptyComponent: PropTypes.func,
listUnderlayColor: PropTypes.string,
// Must write it this way: https://stackoverflow.com/a/54290946/7180620
listViewDisplayed: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['auto'])]),
listViewDisplayed: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.oneOf(['auto']),
]),
keepResultsAfterBlur: PropTypes.bool,
minLength: PropTypes.number,
nearbyPlacesAPI: PropTypes.string,
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<a href="https://www.npmjs.com/package/react-native-google-places-autocomplete">
<img alt="npm version" src="https://img.shields.io/npm/v/react-native-google-places-autocomplete"/>
</a>
Expand Down Expand Up @@ -266,15 +265,15 @@ _This list is a work in progress. PRs welcome!_

## Methods

| method name | type | description |
| ---------------- | ------------------------- | ----------------------------------------------------------------------- |
| `getAddressText` | `() => string` | return the value of TextInput |
| `setAddressText` | `(value: string) => void` | set the value of TextInput |
| `focus` | `void` | makes the TextInput focus |
| `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 |
| method name | type | description |
| -------------------- | ------------------------- | ----------------------------------------------------------------------- |
| `getAddressText` | `() => string` | return the value of TextInput |
| `setAddressText` | `(value: string) => void` | set the value of TextInput |
| `focus` | `void` | makes the TextInput focus |
| `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 8fca5d6

Please sign in to comment.