GithubHelp home page GithubHelp logo

Comments (18)

lelandrichardson avatar lelandrichardson commented on May 7, 2024

Hey @rufisayev ,

This repo was originally written as just an example app rather than a consumable library... I'm working now on turning this into a consumable library on npm but it's not there yet.

With some work, you should be able to look in the MainActivity.java in this project and copy the registration thats done there...

from react-native-maps.

rufisayev avatar rufisayev commented on May 7, 2024

I write MainActivity.java like you but i get error like this:
error: cannot find symbol
.addPackage(new AirPackage())

Although i attached all java files(which you set into java folder) into my project

from react-native-maps.

afilp avatar afilp commented on May 7, 2024

Hello, I would like to use your better implementation of mapview straight away. I see that this is not released on NPM. Do you have any instructions on what we need to do in order to include it on our project? For now, I am only interested for the iOS part. Thanks!

from react-native-maps.

lelandrichardson avatar lelandrichardson commented on May 7, 2024

@rufisayev you will need to import com.rn_mapview if you havent done that. Also, you should try and follow the instructions in #5

@af7 I'm working on getting this published as a library on npm. This repo started getting attention before I could finish it. Hopefully I will be able to do that this weekend, along with detailed instructions.

from react-native-maps.

rufisayev avatar rufisayev commented on May 7, 2024

@lelandrichardson i import my package,i write my code like this,is there are any problem?

package com.mapapp;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;

import com.facebook.react.LifecycleState;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactRootView;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.shell.MainReactPackage;

import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;

public class MainActivity
extends Activity
implements DefaultHardwareBackBtnHandler {

private ReactInstanceManager reactInstanceManager;
private ReactRootView reactRootView;
private GoogleApiClient mGoogleApiClient;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    reactRootView = new ReactRootView(this);

    reactInstanceManager = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setBundleAssetName("index.android.bundle")
            .setJSMainModuleName("index.android")
            .addPackage(new MainReactPackage())
            .addPackage(new AirPackage())
            .setUseDeveloperSupport(BuildConfig.DEBUG)
            .setInitialLifecycleState(LifecycleState.RESUMED)
            .build();

    reactRootView.startReactApplication(reactInstanceManager, "rn_mapview", null);

    // Create a GoogleApiClient instance

// mGoogleApiClient = new GoogleApiClient.Builder(this)
// .addApi(Drive.API)
// .addScope(Drive.SCOPE_FILE)
// .addConnectionCallbacks(this)
// .addOnConnectionFailedListener(this)
// .build();

    setContentView(reactRootView);
}

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU && reactInstanceManager != null) {
        reactInstanceManager.showDevOptionsDialog();
        return true;
    }
    return super.onKeyUp(keyCode, event);
}

@Override
public void onBackPressed() {
  if (reactInstanceManager != null) {
    reactInstanceManager.onBackPressed();
  } else {
    super.onBackPressed();
  }
}

@Override
public void invokeDefaultOnBackPressed() {
  super.onBackPressed();
}

@Override
protected void onPause() {
    super.onPause();

    if (reactInstanceManager != null) {
        reactInstanceManager.onPause();
    }
}

@Override
protected void onResume() {
    super.onResume();

    if (reactInstanceManager != null) {
        reactInstanceManager.onResume(this, this);
    }
}

// @OverRide
// public void onConnected(Bundle connectionHint) {
// // Connected to Google Play services!
// // The good stuff goes here.
// }
//
// @OverRide
// public void onConnectionSuspended(int cause) {
// // The connection has been interrupted.
// // Disable any UI components that depend on Google APIs
// // until onConnected() is called.
// }
//
// @OverRide
// public void onConnectionFailed(ConnectionResult result) {
// // This callback is important for handling errors that
// // may occur while attempting to connect with Google.
// //
// // More about this in the 'Handle Connection Failures' section.
//
// }
}

from react-native-maps.

afilp avatar afilp commented on May 7, 2024

@lelandrichardson If you could do it this weekend it would be great for me! Thanks again!

from react-native-maps.

christopherdro avatar christopherdro commented on May 7, 2024

@lelandrichardson @af7 I'm working on this a bit now. Starting with iOS.
Have you guys already started with some of the changes?

from react-native-maps.

lelandrichardson avatar lelandrichardson commented on May 7, 2024

@christopherdro I havent started yet. Feel free to start on it. Would be nice if we could not duplicate work...

from react-native-maps.

christopherdro avatar christopherdro commented on May 7, 2024

Yea that's what I wanted to avoid as well. I ended up created a new project as a framework instead of a application to start and setting up the header search paths so that it will work properly for development and as a library.

Could you push the package.json that you used to publish to npm recently?

I was thinking it would be a good idea to rename the library to something different than rn_mapview.
I named it RNMapView for now, but feel free to tell me how you would like it to be named and i'll change it.

Maybe AIRMaps?

from react-native-maps.

lelandrichardson avatar lelandrichardson commented on May 7, 2024

@christopherdro you can get the package.json here: https://gist.github.com/lelandrichardson/83901244c78d081b69b5

Feel free to change it however you see fit (ie, react-native should be removed as a dep).

RNMapView works as a name... or maybe AIRMapView?

from react-native-maps.

rufisayev avatar rufisayev commented on May 7, 2024

@lelandrichardson finally i can build my project,now i can open view,but when i click one of buttons i t give me an error..

from react-native-maps.

lelandrichardson avatar lelandrichardson commented on May 7, 2024

@rufisayev which buttons? All of them? What error does it give?

from react-native-maps.

rufisayev avatar rufisayev commented on May 7, 2024

All of them i get the same error like this:

AirMapView.java:66

from react-native-maps.

lelandrichardson avatar lelandrichardson commented on May 7, 2024

@rufisayev there is a known issue where we are using getMap() instead of getMapAsync() which appears to not work correctly on all android devices. If possible, try to change your emulator. I'm using a nexus 5 emulator and its working. We are working on a fix for this.

from react-native-maps.

christopherdro avatar christopherdro commented on May 7, 2024

@lelandrichardson I like AirMapView

from react-native-maps.

rufisayev avatar rufisayev commented on May 7, 2024

I install nexus 5 emulator,now i still get error like this:
Attempt to invoke virtual method 'void com.google.android.gms.maps.GoogleMap.setInfoWindowAdapter(com.google.android.gms.maps.GoogleMap$InfoWindowAdapter)on a null object reference

AirMapView.java:66

from react-native-maps.

rufisayev avatar rufisayev commented on May 7, 2024

I tried in different emulators bu still i get the same error,how can i solve it?And exactly in which emulator it works on you?

from react-native-maps.

lelandrichardson avatar lelandrichardson commented on May 7, 2024

The emulator that is working for me is Google Nexus 5 - 5.1.0 - API 22 - 1080x1920. Unfortunately I'm not sure what to tell you beyond that. I am working on getting the component to work with the Async API and will maybe/hopefully have some progress on that this weekend.

from react-native-maps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.