Skip to content
Open
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* <p>
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Expand Down Expand Up @@ -36,7 +36,7 @@
public abstract class AsyncReactActivity extends androidx.fragment.app.FragmentActivity
implements DefaultHardwareBackBtnHandler, PermissionAwareActivity {

public enum ScriptType {ASSET,FILE,NETWORK}
public enum ScriptType {ASSET, FILE, NETWORK}

private final ReactActivityDelegate mDelegate;
protected boolean bundleLoaded = false;
Expand All @@ -51,9 +51,10 @@ protected AsyncReactActivity() {
* This is used to schedule rendering of the component.
* e.g. "MoviesApp"
*/
final private @Nullable String getMainComponentNameInner() {
if(!bundleLoaded &&
getBundle().scriptType==ScriptType.NETWORK){
final private @Nullable
String getMainComponentNameInner() {
if (!bundleLoaded &&
getBundle().scriptType == ScriptType.NETWORK) {
return null;
}
return getMainComponentName();
Expand All @@ -67,13 +68,14 @@ protected AsyncReactActivity() {
* Called at construction time, override if you have a custom delegate implementation.
*/
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentNameInner());
return new ReactActivityDelegate(this, null);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ReactInstanceManager manager = ((ReactApplication)getApplication()).getReactNativeHost().getReactInstanceManager();
mDelegate.onCreate(null);
final ReactInstanceManager manager = ((ReactApplication) getApplication()).getReactNativeHost().getReactInstanceManager();
if (!manager.hasStartedCreatingInitialContext()
||ScriptLoadUtil.getCatalystInstance(getReactNativeHost())==null) {
manager.addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() {
Expand Down Expand Up @@ -127,7 +129,7 @@ public void run() {
ScriptLoadUtil.setJsBundleAssetPath(
reactInstanceManager.getCurrentReactContext(),
path);
initView();
mDelegate.loadApp(getMainComponentName());
}
}

Expand All @@ -151,7 +153,6 @@ protected void loadScript(final LoadScriptListener loadListener){
ScriptLoadUtil.loadScriptFromFile(scriptPath,instance,scriptPath,false);
loadListener.onLoadComplete(true,scriptPath);
}else if(pathType== ScriptType.NETWORK){
initView();
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
dialogBuilder.setTitle("Loading jsBundle");
dialogBuilder.setCancelable(false);
Expand Down Expand Up @@ -207,10 +208,6 @@ public void run() {
}
}

protected void initView(){
mDelegate.onCreate(null);
}

@Override
protected void onPause() {
super.onPause();
Expand Down