Skip to content

Commit

Permalink
refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
listenzz committed Jul 29, 2023
1 parent 4a6b22a commit 685ed10
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,8 @@ public void install(@NonNull ReactNativeHost reactNativeHost) {
public void setReactNativeHost(@NonNull ReactNativeHost reactNativeHost) {
this.reactNativeHost = reactNativeHost;
}

private boolean reactInitialized;


public void initialize() {
if (reactInitialized) {
return;
}
reactInitialized = true;

checkReactNativeHost();
final ReactInstanceManager reactInstanceManager = reactNativeHost.getReactInstanceManager();
reactInstanceManager.addReactInstanceEventListener(context -> {
Expand Down Expand Up @@ -117,8 +110,10 @@ public ReactContext getCurrentReactContext() {
}

public boolean getUseDeveloperSupport() {
ReactInstanceManager instanceManager = getReactInstanceManager();
return instanceManager != null && reactNativeHost.getUseDeveloperSupport();
if (reactNativeHost != null && reactNativeHost.hasInstance()) {
return reactNativeHost.getUseDeveloperSupport();
}
return false;
}

public void registerNativeModule(@NonNull String moduleName, @NonNull Class<? extends HybridFragment> clazz) {
Expand Down

0 comments on commit 685ed10

Please sign in to comment.