Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
react-native-google-places
Advanced tools
iOS/Android Google Places Widgets (Autocomplete, Place Picker) for React Native Apps
iOS/Android Google Places Widgets (Autocomplete, Place Picker) for React Native Apps
npm i react-native-google-places --save
react-native link react-native-google-places
pod 'GooglePlaces'
and pod 'GoogleMaps'
to your Podfile.cd ios && pod init
at the root directory of your project. Otherwise just edit your Podfile to include:source 'https://github.com/CocoaPods/Specs.git'
target 'YOUR_APP_TARGET_NAME' do
pod 'GooglePlaces'
pod 'GoogleMaps'
end
@import GooglePlaces;
on top of the file.didFinishLaunchingWithOptions
method, instantiate the library as follows:[GMSPlacesClient provideAPIKey:@"YOUR_IOS_API_KEY_HERE"];
pod install
from your ios
directory..xcworkspace
file to open the project. Or just use the react-native run-ios
command as usual to run your app in the simulator.<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_ANDROID_API_KEY_HERE"/>
react-native link react-native-google-places
. Otherwise, do the following or just ensure they are in place;android/settings.gradle
file:include ':react-native-google-places'
project(':react-native-google-places').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-places/android')
android/app/build.grade
file:dependencies {
...
compile project(':react-native-google-places')
}
...MainApplication.java
file:import com.arttitude360.reactnative.rngoogleplaces.RNGooglePlacesPackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
...
new RNGooglePlacesPackage() //<-- Add line
);
}
react-native run-android
to get started.import RNGooglePlaces from 'react-native-google-places';
class GPlacesDemo extends Component {
openSearchModal() {
RNGooglePlaces.openAutocompleteModal()
.then((place) => {
console.log(place);
// place represents user's selection from the
// suggestions and it is a simplified Google Place object.
})
.catch((error) => console.log(error));
}
render() {
return (
<View style={styles.container}>
<TouchableOpacity
style={styles.button}
onPress={() => this.openSearchModal()}
>
<Text>Pick a Place</Text>
</TouchableOpacity>
</View>
);
}
}
{
placeID: "ChIJZa6ezJa8j4AR1p1nTSaRtuQ",
website: "https://www.facebook.com/",
phoneNumber: "+1 650-543-4800",
address: "1 Hacker Way, Menlo Park, CA 94025, USA",
name: "Facebook HQ",
latitude: 37.4843428,
longitude: -122.14839939999999
}
Promise
from calling RNGooglePlaces.openAutocompleteModal()
are dependent on the selected place - as phoneNumber, website
are not set on all Google Place
objects.You have to link dependencies and re-run the build :
react-native link
react-native run-ios
The MIT License.
FAQs
iOS/Android Google Places Widgets (Autocomplete Modals) and API Services for React Native Apps
The npm package react-native-google-places receives a total of 1,027 weekly downloads. As such, react-native-google-places popularity was classified as popular.
We found that react-native-google-places 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.