| 
				
			 | 
			
			
				@@ -5,23 +5,25 @@ import android.os.Bundle; 
			 | 
		
	
		
			
			| 
				5
			 | 
			
				5
			 | 
			
			
				 import android.view.View; 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				6
			 | 
			
			
				 import android.widget.FrameLayout; 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				7
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				8
			 | 
			
				
			 | 
			
			
				-import com.facebook.react.ReactNativeHost; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				8
			 | 
			
			
				+import com.facebook.react.ReactInstanceManager; 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				9
			 | 
			
			
				 import com.facebook.react.ReactRootView; 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				
			 | 
			
			
				-import com.facebook.react.bridge.ReactContext; 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				
			 | 
			
			
				-import com.reactnativenavigation.NavigationApplication; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				10
			 | 
			
			
				+import com.facebook.react.modules.core.DeviceEventManagerModule; 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				11
			 | 
			
			
				 import com.reactnativenavigation.react.NavigationEventEmitter; 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				12
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				14
			 | 
			
				13
			 | 
			
			
				 public class Container extends FrameLayout { 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				
			 | 
			
			
				-	private final ReactNativeHost reactNativeHost; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				14
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				15
			 | 
			
			
				 	private final String id; 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				16
			 | 
			
			
				 	private final String name; 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				17
			 | 
			
			
				 	private ReactRootView rootView; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+	private final ReactInstanceManager reactInstanceManager; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				20
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				20
			 | 
			
				
			 | 
			
			
				-	public Container(Activity activity, ReactNativeHost reactNativeHost, String id, String name) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+	public Container(Activity activity, String id, String name, final ReactInstanceManager reactInstanceManager) { 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				22
			 | 
			
			
				 		super(activity); 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				
			 | 
			
			
				-		this.reactNativeHost = reactNativeHost; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				24
			 | 
			
			
				 		this.id = id; 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				25
			 | 
			
			
				 		this.name = name; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+		this.reactInstanceManager = reactInstanceManager; 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				27
			 | 
			
			
				 		addView(createReactRootView()); 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				28
			 | 
			
			
				 	} 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				29
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -31,6 +33,7 @@ public class Container extends FrameLayout { 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				33
			 | 
			
			
				 		onStop(); 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				34
			 | 
			
			
				 	} 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				35
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				37
			 | 
			
			
				 	public void destroy() { 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				38
			 | 
			
			
				 		rootView.unmountReactApplication(); 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				39
			 | 
			
			
				 	} 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -39,7 +42,7 @@ public class Container extends FrameLayout { 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				42
			 | 
			
			
				 		rootView = new ReactRootView(getContext()); 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				43
			 | 
			
			
				 		Bundle opts = new Bundle(); 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				44
			 | 
			
			
				 		opts.putString("id", id); 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				
			 | 
			
			
				-		rootView.startReactApplication(reactNativeHost.getReactInstanceManager(), name, opts); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+		rootView.startReactApplication(reactInstanceManager, name, opts); 
			 | 
		
	
		
			
			| 
				43
			 | 
			
				46
			 | 
			
			
				 		rootView.setEventListener(new ReactRootView.ReactRootViewEventListener() { 
			 | 
		
	
		
			
			| 
				44
			 | 
			
				47
			 | 
			
			
				 			@Override 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				48
			 | 
			
			
				 			public void onAttachedToReactInstance(final ReactRootView reactRootView) { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -51,15 +54,11 @@ public class Container extends FrameLayout { 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				54
			 | 
			
			
				 	} 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				55
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				53
			 | 
			
				56
			 | 
			
			
				 	private void onStart() { 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				
			 | 
			
			
				-		new NavigationEventEmitter(reactContext()).containerStart(id); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				57
			 | 
			
			
				+		new NavigationEventEmitter(reactInstanceManager.getCurrentReactContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)).containerStart(id); 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				58
			 | 
			
			
				 	} 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				59
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				57
			 | 
			
				60
			 | 
			
			
				 	private void onStop() { 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				
			 | 
			
			
				-		new NavigationEventEmitter(reactContext()).containerStop(id); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				+		new NavigationEventEmitter(reactInstanceManager.getCurrentReactContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)).containerStop(id); 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				62
			 | 
			
			
				 	} 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				63
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				61
			 | 
			
				
			 | 
			
			
				-	private ReactContext reactContext() { 
			 | 
		
	
		
			
			| 
				62
			 | 
			
				
			 | 
			
			
				-		//TODO this is wrong, we should inject reactContext somehow 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				
			 | 
			
			
				-		return ((NavigationApplication) getContext().getApplicationContext()).getReactNativeHost().getReactInstanceManager().getCurrentReactContext(); 
			 | 
		
	
		
			
			| 
				64
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				64
			 | 
			
			
				 } 
			 |