react-native-mapintent

1.0.3 • Public • Published

react-native-mapintent

A React Native map intent for Android. Allows to open Android Stock Map Application.

Installation

npm install --save react-native-mapintent

Add it to your android project

  • In android/setting.gradle
...
include ':RNMapIntent', ':app'
project(':RNMapIntent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mapintent')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':RNMapIntent')
}
  • register module (in MainActivity.java)
import com.syarul.mapintent.RNMapIntentPackage;  // <--- import 
 
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
  ......
 
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReactRootView = new ReactRootView(this);
 
    mReactInstanceManager = ReactInstanceManager.builder()
      .setApplication(getApplication())
      .setBundleAssetName("index.android.bundle")
      .setJSMainModuleName("index.android")
      .addPackage(new MainReactPackage())
      .addPackage(new RNMapIntentPackage())              // <------ add here 
      .setUseDeveloperSupport(BuildConfig.DEBUG)
      .setInitialLifecycleState(LifecycleState.RESUMED)
      .build();
 
    mReactRootView.startReactApplication(mReactInstanceManager, "ExampleRN", null);
 
    setContentView(mReactRootView);
  }
 
  ......
 
}

Example

MapIntent.open(latitude, longitude, label)

  • latitude: (string) geolocation latitude value
  • longitude: (string) geolocation longitude value
  • label: (string) label on the geolocation point.
var MapIntent = require('react-native-mapintent');
 
MapIntent.open('3.0820879','101.6364262', 'This is da place!!');

License

MIT

Package Sidebar

Install

npm i react-native-mapintent

Weekly Downloads

3

Version

1.0.3

License

MIT

Last publish

Collaborators

  • syarul