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

Android - Add a ReactFragment #12199

Closed
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
allow activity to handle back presses
  • Loading branch information
jpshelley committed Feb 17, 2017
commit b089982ebe9cec0e86a71bf4986c783ac5355e37
15 changes: 2 additions & 13 deletions ReactAndroid/src/main/java/com/facebook/react/ReactFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
package com.facebook.react;
jpshelley marked this conversation as resolved.
Show resolved Hide resolved

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
Expand All @@ -30,7 +30,7 @@
* Fragment for creating a React View. This allows the developer to "embed" a React Application
* inside native components such as a Drawer, ViewPager, etc.
*/
public class ReactFragment extends Fragment implements PermissionAwareActivity, DefaultHardwareBackBtnHandler {
public class ReactFragment extends Fragment implements PermissionAwareActivity {

protected static final String ARG_COMPONENT_NAME = "arg_component_name";
protected static final String ARG_LAUNCH_OPTIONS = "arg_launch_options";
Expand Down Expand Up @@ -169,17 +169,6 @@ public void requestPermissions(String[] permissions, int requestCode, Permission
requestPermissions(permissions, requestCode);
}

/**
* {@link #invokeDefaultOnBackPressed()} will get called if our JS React app doesn't consume
* the event itself. Once this gets called we then call our Activity's method.
* {@link Activity#onBackPressed()}. If you want to do something else when this is called
* extend this class and override this method.
*/
@Override
public void invokeDefaultOnBackPressed() {
getActivity().onBackPressed();
}

/**
* Builder class to help instantiate a ReactFragment
*/
Expand Down