use of com.taobao.weex.ui.IFComponentHolder in project weex-example by KalicyZhou.
the class WXComponentFactory method newInstance.
public static WXComponent newInstance(WXSDKInstance instance, WXDomObject node, WXVContainer parent) {
if (instance == null || node == null || TextUtils.isEmpty(node.getType())) {
return null;
}
if (sComponentTypes.get(instance.getInstanceId()) == null) {
Set<String> types = new HashSet<>();
sComponentTypes.put(instance.getInstanceId(), types);
}
sComponentTypes.get(instance.getInstanceId()).add(node.getType());
IFComponentHolder holder = WXComponentRegistry.getComponent(node.getType());
if (holder == null) {
if (WXEnvironment.isApkDebugable()) {
String tag = "WXComponentFactory error type:[" + node.getType() + "]" + " class not found";
WXLogUtils.e(tag);
}
//For compatible reason of JS framework, unregistered type will be treated as container.
holder = WXComponentRegistry.getComponent(WXBasicComponentType.CONTAINER);
if (holder == null) {
throw new WXRuntimeException("Container component not found.");
}
}
try {
return holder.createInstance(instance, node, parent);
} catch (Exception e) {
WXLogUtils.e("WXComponentFactory Exception type:[" + node.getType() + "] ", e);
}
return null;
}
Aggregations