在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):zhangtaii/react-native-google-place-picker开源软件地址(OpenSource Url):https://github.com/zhangtaii/react-native-google-place-picker开源编程语言(OpenSource Language):Java 37.1%开源软件介绍(OpenSource Introduction):react-native-google-place-pickerReact Native Wrapper of Google Place Picker for iOS + Android.
Table of contentsInstall
Then you must install the native dependencies. You can use
or link manually like so: iOS
Android
include ':react-native-google-place-picker'
project(':react-native-google-place-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-place-picker/android')
compile project(':react-native-google-place-picker')
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
...
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
...
<application>
...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY" />
...
</application>
</manifest> Usageimport RNGooglePlacePicker from 'react-native-google-place-picker';
RNGooglePlacePicker.show((response) => {
if (response.didCancel) {
console.log('User cancelled GooglePlacePicker');
}
else if (response.error) {
console.log('GooglePlacePicker Error: ', response.error);
}
else {
this.setState({
location: response
});
}
}) Example
The Response Object
CreditsThanks following repositories' inspiration/help: LicenseCode in this git repo is licensed MIT. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论