mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-07 17:37:34 +08:00
Fix crash when destroying catalyst
Reviewed By: fromcelticpark Differential Revision: D6373275 fbshipit-source-id: c36b53f023800097b301d530250b05e5b2a4dfca
This commit is contained in:
committed by
Facebook Github Bot
parent
0ff576081b
commit
f1015664e9
@@ -764,8 +764,14 @@ public class ReactInstanceManager {
|
||||
}
|
||||
|
||||
public @Nullable ViewManager createViewManager(String viewManagerName) {
|
||||
ReactApplicationContext context =
|
||||
Assertions.assertNotNull((ReactApplicationContext) getCurrentReactContext());
|
||||
ReactApplicationContext context;
|
||||
synchronized (mReactContextLock) {
|
||||
context = (ReactApplicationContext) getCurrentReactContext();
|
||||
if (context == null || !context.hasActiveCatalystInstance()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (mPackages) {
|
||||
for (ReactPackage reactPackage : mPackages) {
|
||||
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
|
||||
@@ -781,9 +787,15 @@ public class ReactInstanceManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getViewManagerNames() {
|
||||
ReactApplicationContext context =
|
||||
Assertions.assertNotNull((ReactApplicationContext) getCurrentReactContext());
|
||||
public @Nullable List<String> getViewManagerNames() {
|
||||
ReactApplicationContext context;
|
||||
synchronized(mReactContextLock) {
|
||||
context = (ReactApplicationContext) getCurrentReactContext();
|
||||
if (context == null || !context.hasActiveCatalystInstance()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (mPackages) {
|
||||
Set<String> uniqueNames = new HashSet<>();
|
||||
for (ReactPackage reactPackage : mPackages) {
|
||||
|
||||
Reference in New Issue
Block a user