Skip to content

Commit 32bce31

Browse files
Salakarthymikee
authored andcommitted
fix: support an Application instance in PackageList for Android (#493)
1 parent 4732edc commit 32bce31

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/platform-android/native_modules.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ import java.util.ArrayList;
1717
{{ packageImports }}
1818
1919
public class PackageList {
20+
private Application application;
2021
private ReactNativeHost reactNativeHost;
2122
public PackageList(ReactNativeHost reactNativeHost) {
2223
this.reactNativeHost = reactNativeHost;
2324
}
25+
26+
public PackageList(Application application) {
27+
this.reactNativeHost = null;
28+
this.application = application;
29+
}
2430
2531
private ReactNativeHost getReactNativeHost() {
2632
return this.reactNativeHost;
@@ -31,6 +37,7 @@ public class PackageList {
3137
}
3238
3339
private Application getApplication() {
40+
if (this.reactNativeHost == null) return this.application;
3441
return this.reactNativeHost.getApplication();
3542
}
3643

0 commit comments

Comments
 (0)