https://github.com/robincsl/example-kiwicom-react-native-reverse-geocode
https://github.com/robincsl/example-kiwicom-react-native-reverse-geocode
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/robincsl/example-kiwicom-react-native-reverse-geocode
- Owner: RobinCsl
- Created: 2021-07-28T15:56:11.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-29T07:46:11.000Z (almost 5 years ago)
- Last Synced: 2025-02-01T06:45:40.944Z (over 1 year ago)
- Language: Java
- Size: 396 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example repo for @kiwicom/react-native-reverse-geocode package
To recreate:
1. Run the following commands:
```
$ npx expo init --yarn
# Choose 'Bare workflow - minimal'
$ yarn add @kiwicom/react-native-reverse-geocode
```
2. modify `App.js` with
```js
import * as React from 'react';
import { Text, View, NativeModules } from 'react-native';
const { RNReverseGeocode } = NativeModules;
const region = {
latitude: 50,
longitude: 14,
latitudeDelta: 0.01,
longitudeDelta: 0.01,
};
const searchText = 'Charles';
var jsonData;
const app = () => {
const [jsonData, setJsonData] = React.useState(null);
React.useEffect(() => {
RNReverseGeocode.searchForLocations(
searchText,
region,
(err, res) => {
setJsonData({
error: err,
addresses: res
})
}
);
}, [])
return (
{JSON.stringify(jsonData)}
);
};
export default app;
```
3. Follow the instructions to install `@kiwicom/react-native-reverse-geocode`, i.e.:
- on iOS, install the pods
```sh
$ cd ios
$ pod install
```
- on Android, I'm not sure, I haven't tested. The log outputs might give you clues how to solve it.
After running the app with `yarn ios` (and some time compiling the app if it's the first time the command is run), the following view can be seen in the emulator:
