0.0.3 • Published 4 years ago

@iomechs/react-native-location-view v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

react-native-location-view

Simple location picker with maps and Google Places API support.

Preview

npm.io

Installation

Download an install the library

npm install react-native-location-view --save

Or if you are using yarn

yarn add react-native-location-view

This library depends upon 2 other native libraries

  1. react-native-maps
  2. react-native-vector-icons

Make sure to install these before you install react-native-location-view

For Google Places API go to this page and enable "Google Places API Web Service" (NOT Android or iOS) in the console.

Example

import React from 'react';
import LocationView from "react-native-location-view";
import {View} from "react-native";


export default class SelectLocationScreen extends React.Component {
  state = {

  };

  render() {
    return(
      <View style={{flex: 1}}>
        <LocationView
          apiKey={"MY_GOOGLE_API_KEY"}
          initialLocation={{
            latitude: 37.78825,
            longitude: -122.4324,
          }}
        />
      </View>
    );
  }
}

Supported Props

PropTypeRequired
apiKeystringYes
initialLocationobjectYes
markerColorstringNo
actionButtonStyleobject (style)No
actionTextStyleobject (style)No
actionTextstringNo
onLocationSelectfunctionNo
debounceDurationnumberNo