
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
react-native-places-input
Advanced tools
Up to date working Google Places Input. Calling directly API not JS SDK.
Up to date working Google Places Input. Calling directly API not JS SDK.
New configuration props:
Fixing an issue with sometimes not getting details about selected place.
Fixed issue that in some cases list of places is not displayed.
New configuration props:
Remove default props for lat,lng and radius. Add queryCountries where you can pass array of countries to limit your search results.
yarn add react-native-places-input
or
npm install react-native-places-input
Fairly easy. Few required props but most of the work is already done in a component.
import PlacesInput from 'react-native-places-input';
And inside a component
<PlacesInput
googleApiKey={GOOGLE_API_KEY}
onSelect={place => console.log(place}
/>
class InputWrapper extends React.Component {
render() {
return (
<View style={{ width: '100%' }}>
<PlacesInput
googleApiKey={GOOGLE_API_KEY}
placeHolder={"Some Place holder"}
language={"en-US"}
onSelect={place => {
this.props.goToPoint(get(place, 'result.geometry.location.lat'), get(place, 'result.geometry.location.lng'))
}}
iconResult={<Ionicons name="md-pin" size={25} style={styles.placeIcon}/>}
/>
</View>
);
}
}
List of props supported by a component
Prop | Type | Default | Description |
---|---|---|---|
googleApiKey | PropTypes.string.isRequired, | Google API key | |
iconInput | PropTypes.any, | Icon added to an input | |
iconResult | PropTypes.any, | Icon added to results | |
language | PropTypes.string, | en | Language for google API call |
placeHolder | PropTypes.string, | Search places... | placeholder for an input |
queryTypes | PropTypes.string, | You may restrict results from a Place Autocomplete request to be of a certain type by passing a types parameter. Google docs | |
queryFields | PropTypes.string, | formatted_address,geometry,name | Fields requested from Google API |
queryCountries | PropTypes.array | Array of country codes to limit results | |
resultRender | PropTypes.func, | place => place.description | Function to render results text |
searchLatitude | PropTypes.number, | Lat to limit results | |
searchLongitude | PropTypes.number, | Lng to limit results | |
searchRadius | PropTypes.number, | radius to limit results | |
stylesContainer | PropTypes.object, | {} | Custom styles for a container |
stylesInput | PropTypes.object, | {} | Custom styles for an input |
stylesItem | PropTypes.object, | {} | Custom styles for an item |
stylesItemText | PropTypes.object, | {} | Custom styles for an item text |
stylesList | PropTypes.object, | {} | Custom styles for a list |
stylesLoading | PropTypes.object, | {} | Custom styles for a loading indicator |
textInputProps | PropTypes.object, | {} | Custom TextInput props |
requiredCharactersBeforeSearch | PropTypes.number | 2 | Component wont fetch places unless string length is equal this prop |
requiredTimeBeforeSearch | PropTypes.number | 1000 | Idle time on text input before component will fetch places |
onSelect | PropTypes.func, | Function called when you select a place |
<PlacesInput
placeHolder={'Some placeholder'}
stylesContainer={{
position: 'relative',
alignSelf: 'stretch',
margin: 0,
top: 0,
left: 0,
right: 0,
bottom: 0,
shadowOpacity: 0,
borderColor: '#dedede',
borderWidth: 1,
marginBottom: 10
}}
stylesList={{
top: 50,
borderColor: '#dedede',
borderLeftWidth: 1,
borderRightWidth: 1,
borderBottomWidth: 1,
left: -1,
right: -1
}}
googleApiKey={GOOGLE_API_KEY}
onSelect={place => this.setState({place})}
/>
<PlacesInput
placeHolder={'Some placeholder'}
queryCountries={['pl', 'fr']}
googleApiKey={GOOGLE_API_KEY}
onSelect={place => this.setState({place})}
/>
<PlacesInput
placeHolder={'Some placeholder'}
searchRadius={500}
searchLatitude={51.905070}
searchLongitude={19.458834}
googleApiKey={GOOGLE_API_KEY}
onSelect={place => this.setState({place})}
/>
<PlacesInput
placeHolder={'Some placeholder'}
queryTypes="establishment"
googleApiKey={GOOGLE_API_KEY}
onSelect={place => this.setState({place})}
/>
1.0.10
New configuration props:
FAQs
Up to date working Google Places Input. Calling directly API not JS SDK.
The npm package react-native-places-input receives a total of 230 weekly downloads. As such, react-native-places-input popularity was classified as not popular.
We found that react-native-places-input demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.