5

Pick any place with single click

 2 years ago
source link: https://reactnativeexample.com/pick-any-place-with-single-click/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Picker

Pick any place with single click

Jun 22, 2022 1 min read

react-native-place-picker

Pick any place with single click 🚀

⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️

Don’t forget to STAR AND FORK this repo if you like it

⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️

HEADER

How is it working?

This plugin is built only by create native page UIViewController for iOS or Activity for Android. and present the page in front of React Native Application without any special dependencies just native code

Installation

npm install react-native-place-picker
# or
yarn add react-native-place-picker
  • You need to add expo-dev-client and run expo run:ios or expo run:android

Info Expo managed app not yet supported 🚧

  • No further steps needed 😁

Android ⚠️

  • Add to your AndroidManifest.xml you Google Map API Key or your application will crash
<meta-data
   android:name="com.google.android.geo.API_KEY"
   android:value="YOUR_KEY" />

Usage

Request

import { pickPlace } from 'react-native-place-picker';

const OPTIONS = {

    title: "Choose Place", // Modal title

    // Initial map location coordinates
    initialCoordinates: {
        latitude: 25.2048,
        longitude: 55.2708
    }

};

pickPlace(OPTIONS)
    .then(console.log)
    .catch(console.log)

// or

pickPlace().then(console.log).catch(console.log)

Result

{
    // Determine if user did cancel th operation
    canceled: boolean,
    // Coordinates values
    latitude: number,
    longitude: number,
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

GitHub

View Github


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK