|  | @@ -10,6 +10,7 @@ import android.support.v7.app.AppCompatActivity;
 | 
	
		
			
			| 10 | 10 |  import android.util.Log;
 | 
	
		
			
			| 11 | 11 |  import android.view.KeyEvent;
 | 
	
		
			
			| 12 | 12 |  import android.view.Menu;
 | 
	
		
			
			|  | 13 | +import android.view.MenuItem;
 | 
	
		
			
			| 13 | 14 |  import android.widget.EditText;
 | 
	
		
			
			| 14 | 15 |  import android.widget.Toast;
 | 
	
		
			
			| 15 | 16 |  
 | 
	
	
		
			
			|  | @@ -18,11 +19,14 @@ import com.facebook.react.LifecycleState;
 | 
	
		
			
			| 18 | 19 |  import com.facebook.react.ReactInstanceManager;
 | 
	
		
			
			| 19 | 20 |  import com.facebook.react.ReactPackage;
 | 
	
		
			
			| 20 | 21 |  import com.facebook.react.ReactRootView;
 | 
	
		
			
			|  | 22 | +import com.facebook.react.bridge.Arguments;
 | 
	
		
			
			|  | 23 | +import com.facebook.react.bridge.WritableMap;
 | 
	
		
			
			| 21 | 24 |  import com.facebook.react.common.ReactConstants;
 | 
	
		
			
			| 22 | 25 |  import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
 | 
	
		
			
			| 23 | 26 |  import com.facebook.react.shell.MainReactPackage;
 | 
	
		
			
			| 24 | 27 |  import com.reactnativenavigation.BuildConfig;
 | 
	
		
			
			| 25 | 28 |  import com.reactnativenavigation.core.RctManager;
 | 
	
		
			
			|  | 29 | +import com.reactnativenavigation.core.objects.Button;
 | 
	
		
			
			| 26 | 30 |  import com.reactnativenavigation.core.objects.Screen;
 | 
	
		
			
			| 27 | 31 |  import com.reactnativenavigation.packages.RnnPackage;
 | 
	
		
			
			| 28 | 32 |  import com.reactnativenavigation.utils.ContextProvider;
 | 
	
	
		
			
			|  | @@ -41,6 +45,7 @@ public abstract class BaseReactActivity extends AppCompatActivity implements Def
 | 
	
		
			
			| 41 | 45 |      private static final String TAG = "BaseReactActivity";
 | 
	
		
			
			| 42 | 46 |      private static final String REDBOX_PERMISSION_MESSAGE =
 | 
	
		
			
			| 43 | 47 |              "Overlay permissions needs to be granted in order for react native apps to run in dev mode";
 | 
	
		
			
			|  | 48 | +    private static final String EVENT_TOOLBAR_BUTTON_CLICKED = "OnToolbarButtonClicked";
 | 
	
		
			
			| 44 | 49 |  
 | 
	
		
			
			| 45 | 50 |      @Nullable
 | 
	
		
			
			| 46 | 51 |      protected ReactInstanceManager mReactInstanceManager;
 | 
	
	
		
			
			|  | @@ -225,7 +230,9 @@ public abstract class BaseReactActivity extends AppCompatActivity implements Def
 | 
	
		
			
			| 225 | 230 |          return null;
 | 
	
		
			
			| 226 | 231 |      }
 | 
	
		
			
			| 227 | 232 |  
 | 
	
		
			
			| 228 |  | -    public abstract String getCurrentNavigatorId();
 | 
	
		
			
			|  | 233 | +    protected abstract String getCurrentNavigatorId();
 | 
	
		
			
			|  | 234 | +
 | 
	
		
			
			|  | 235 | +    protected abstract Screen getCurrentScreen();
 | 
	
		
			
			| 229 | 236 |  
 | 
	
		
			
			| 230 | 237 |      public abstract int getScreenStackSize();
 | 
	
		
			
			| 231 | 238 |  
 | 
	
	
		
			
			|  | @@ -235,6 +242,20 @@ public abstract class BaseReactActivity extends AppCompatActivity implements Def
 | 
	
		
			
			| 235 | 242 |          return super.onCreateOptionsMenu(menu);
 | 
	
		
			
			| 236 | 243 |      }
 | 
	
		
			
			| 237 | 244 |  
 | 
	
		
			
			|  | 245 | +    @Override
 | 
	
		
			
			|  | 246 | +    public boolean onOptionsItemSelected(MenuItem item) {
 | 
	
		
			
			|  | 247 | +        if (item.getItemId() == android.R.id.home) {
 | 
	
		
			
			|  | 248 | +            onBackPressed();
 | 
	
		
			
			|  | 249 | +        } else {
 | 
	
		
			
			|  | 250 | +            String eventId = Button.getButtonEventId(item);
 | 
	
		
			
			|  | 251 | +            assert eventId != null;
 | 
	
		
			
			|  | 252 | +
 | 
	
		
			
			|  | 253 | +            WritableMap params = Arguments.createMap();
 | 
	
		
			
			|  | 254 | +            RctManager.getInstance().sendEvent(eventId, getCurrentScreen(), params);
 | 
	
		
			
			|  | 255 | +        }
 | 
	
		
			
			|  | 256 | +        return super.onOptionsItemSelected(item);
 | 
	
		
			
			|  | 257 | +    }
 | 
	
		
			
			|  | 258 | +
 | 
	
		
			
			| 238 | 259 |      public Menu getMenu() {
 | 
	
		
			
			| 239 | 260 |          return mMenu;
 | 
	
		
			
			| 240 | 261 |      }
 |