Skip to content

Commit

Permalink
处理reactInstanceManager回收机制
Browse files Browse the repository at this point in the history
  • Loading branch information
smartzhao committed Apr 11, 2018
1 parent 1705799 commit 9d6ea66
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 2 deletions.
Binary file modified android/.idea/caches/build_file_checksums.ser
Binary file not shown.
44 changes: 44 additions & 0 deletions android/app/src/main/java/com/zhaochong/android/TestActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.zhaochong.android;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.kaopiz.kprogresshud.KProgressHUD;
import com.rnbridge.RNBridgeManager;
import com.rnbridge.callback.RNPushlishMsgListener;
import com.rnbridge.rnactivity.BaseReactActivity;

public class TestActivity extends BaseReactActivity implements RNPushlishMsgListener {
Bundle bundle = new Bundle();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_test);
RNBridgeManager
.getInstance()
.setLaunchOptions(bundle)
.setComponentName("RnBase")
.setBundleAssetName("index.VPCenter.bundle")
.setCustomProgressParams("加载中。。。。", "测试中", KProgressHUD.Style.SPIN_INDETERMINATE)
.setNativeContants("RNContants", "我是Android常量,hello RN")
// .setRnPushlishMsgListener()
.startRNActivity(this);
finish();
}

@Override
public String rnCallNativeFromPromise(String msg) {
return null;
}

@Override
public String rnCallNativeFromCallback(String msg) {
return null;
}

@Override
public void rnCallNative(String s, String action) {

}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions android/app/src/main/res/layout/activity_test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TestActivity">

</android.support.constraint.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ public void onPause() {
public void onDestroy() {

if (mReactRootView != null) {
// mReactRootView.unmountReactApplication();
mReactRootView.unmountReactApplication();
mReactRootView = null;
}
if (getReactNativeHost().hasInstance()) {
getReactInstanceManager().onHostDestroy(mActivity);
}

getReactNativeHost().clear();
// 清除View
ReactNativePreLoader.deatchView(bundleAssetName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
public class BaseReactActivity extends PreLoadReactActivity {


@Nullable
@Override
protected String getMainComponentName() {
Expand Down

0 comments on commit 9d6ea66

Please sign in to comment.