Move `getLaunchOptions` from ReactActivity to ReactActivityDelegate
Summary:
After 3c4fd42749
, `getLaunchOptions` no longer exists in class `ReactActivity`.
We need refactor UIExplorerActivity to fix the build error.
Closes https://github.com/facebook/react-native/pull/9320
Differential Revision: D3696381
Pulled By: astreet
fbshipit-source-id: 5700cf2363029a95cfbdaf6230e4f82ea69fb472
This commit is contained in:
parent
7cdd4c9a75
commit
4963a37e80
|
@ -14,32 +14,49 @@
|
|||
|
||||
package com.facebook.react.uiapp;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
import com.facebook.react.ReactActivityDelegate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class UIExplorerActivity extends ReactActivity {
|
||||
private final String PARAM_ROUTE = "route";
|
||||
private Bundle mInitialProps = null;
|
||||
public static class UIExplorerActivityDelegate extends ReactActivityDelegate {
|
||||
private static final String PARAM_ROUTE = "route";
|
||||
private Bundle mInitialProps = null;
|
||||
private final @Nullable Activity mActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// Get remote param before calling super which uses it
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
|
||||
String routeUri = new StringBuilder("rnuiexplorer://example/")
|
||||
.append(bundle.getString(PARAM_ROUTE))
|
||||
.append("Example")
|
||||
.toString();
|
||||
mInitialProps = new Bundle();
|
||||
mInitialProps.putString("exampleFromAppetizeParams", routeUri);
|
||||
public UIExplorerActivityDelegate(Activity activity, String mainComponentName) {
|
||||
super(activity, mainComponentName);
|
||||
this.mActivity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// Get remote param before calling super which uses it
|
||||
Bundle bundle = mActivity.getIntent().getExtras();
|
||||
if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
|
||||
String routeUri = new StringBuilder("rnuiexplorer://example/")
|
||||
.append(bundle.getString(PARAM_ROUTE))
|
||||
.append("Example")
|
||||
.toString();
|
||||
mInitialProps = new Bundle();
|
||||
mInitialProps.putString("exampleFromAppetizeParams", routeUri);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Bundle getLaunchOptions() {
|
||||
return mInitialProps;
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Bundle getLaunchOptions() {
|
||||
return mInitialProps;
|
||||
protected ReactActivityDelegate createReactActivityDelegate() {
|
||||
return new UIExplorerActivityDelegate(this, getMainComponentName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue