Skip to content

Commit

Permalink
do removeView in onCreate to ensure double check
Browse files Browse the repository at this point in the history
  • Loading branch information
markzhai committed Sep 1, 2016
1 parent c1a3def commit e896e65
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -37,7 +37,7 @@ sh package.sh

```groovy
dependencies {
compile "com.github.moduth:react-native-preloader:0.31.0"
compile "com.github.markzhai:react-native-preloader:0.32.0"
}
```

Expand Down
6 changes: 3 additions & 3 deletions preloader/gradle.properties
@@ -1,9 +1,9 @@
POM_NAME=React Native Pre-loader
POM_ARTIFACT_ID=react-native-preloader
POM_PACKAGING=aar
VERSION_NAME=0.31.0
VERSION_CODE=1
GROUP=com.github.moduth
VERSION_NAME=0.32.0
VERSION_CODE=2
GROUP=com.github.markzhai

POM_DESCRIPTION=React Native Pre-loader for Android
POM_URL=https://github.com/markzhai/react-native-preloader
Expand Down
Expand Up @@ -24,6 +24,7 @@
import android.provider.Settings;
import android.util.Log;
import android.view.KeyEvent;
import android.view.ViewGroup;
import android.widget.Toast;

import com.facebook.common.logging.FLog;
Expand Down Expand Up @@ -133,6 +134,14 @@ protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "use pre-load view");
MutableContextWrapper contextWrapper = (MutableContextWrapper) mReactRootView.getContext();
contextWrapper.setBaseContext(this);
try {
ViewGroup viewGroup = (ViewGroup) mReactRootView.getParent();
if (viewGroup != null) {
viewGroup.removeView(mReactRootView);
}
} catch (Exception exception) {
Log.e(TAG, "getParent error", exception);
}
} else {
Log.i(TAG, "createRootView");
mReactRootView = createRootView();
Expand Down

0 comments on commit e896e65

Please sign in to comment.