Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN0.29 compatability #363

Merged
merged 2 commits into from
Jul 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions android/lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apply plugin: 'com.android.library'
apply from: 'gradle-maven-push.gradle'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change seems unrelated

android {
compileSdkVersion 23
Expand All @@ -16,7 +15,7 @@ android {
}

dependencies {
compile 'com.facebook.react:react-native:0.27.2'
compile 'com.facebook.react:react-native:+'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use 0.29.0 instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For more context:
screen shot 2016-07-08 at 3 43 01 pm

compile "com.google.android.gms:play-services-base:8.4.0"
compile 'com.google.android.gms:play-services-maps:8.4.0'
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.airbnb.android.react.maps;

import android.view.View;
import android.app.Activity;
import android.content.Context;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactContext;
Expand Down Expand Up @@ -41,19 +41,19 @@ public class AirMapManager extends ViewGroupManager<AirMapView> {

private ReactContext reactContext;

private Activity reactActivity;
private Context appContext;
private AirMapMarkerManager markerManager;
private AirMapPolylineManager polylineManager;
private AirMapPolygonManager polygonManager;
private AirMapCircleManager circleManager;

public AirMapManager(
Activity activity,
Context context,
AirMapMarkerManager markerManager,
AirMapPolylineManager polylineManager,
AirMapPolygonManager polygonManager,
AirMapCircleManager circleManager) {
this.reactActivity = activity;
this.appContext = context;
this.markerManager = markerManager;
this.polylineManager = polylineManager;
this.polygonManager = polygonManager;
Expand All @@ -70,12 +70,12 @@ protected AirMapView createViewInstance(ThemedReactContext context) {
reactContext = context;

try {
MapsInitializer.initialize(reactActivity);
MapsInitializer.initialize(this.appContext);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omit this.

} catch (Exception e) {
e.printStackTrace();
emitMapError("Map initialize error", "map_init_error");
}
AirMapView view = new AirMapView(context, reactActivity, this);
AirMapView view = new AirMapView(context, this.appContext, this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


return view;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.airbnb.android.react.maps;

import android.app.Activity;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
Expand All @@ -16,6 +15,7 @@
import android.view.ScaleGestureDetector;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
import android.content.Context;

import android.view.ViewGroup;
import android.widget.ImageView;
Expand Down Expand Up @@ -88,8 +88,8 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,

final EventDispatcher eventDispatcher;

public AirMapView(ThemedReactContext context, Activity activity, AirMapManager manager) {
super(activity);
public AirMapView(ThemedReactContext context, Context appContext, AirMapManager manager) {
super(appContext);
this.manager = manager;
this.context = context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
import java.util.List;

public class MapsPackage implements ReactPackage {
private Activity reactActivity = null;

public MapsPackage(Activity activity) {
reactActivity = activity;
}
public MapsPackage(Activity activity) { } // backwards compatability
public MapsPackage() { }

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
Expand All @@ -37,7 +34,7 @@ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext
AirMapPolygonManager polygonManager = new AirMapPolygonManager(reactContext);
AirMapCircleManager circleManager = new AirMapCircleManager(reactContext);
AirMapManager mapManager = new AirMapManager(
reactActivity,
reactContext.getBaseContext(),
annotationManager,
polylineManager,
polygonManager,
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ To install using Cocoapods, simply insert the following line into your `Podfile`
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MapsPackage(this) // <-- Add this!
new MapsPackage() // <-- Add this!
);
}
}
Expand All @@ -88,7 +88,7 @@ To install using Cocoapods, simply insert the following line into your `Podfile`
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.addPackage(new MapsPackage(this)) // <---- and This!
.addPackage(new MapsPackage()) // <---- and This!
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
Expand Down