mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-02 06:45:02 +08:00
Add new FileSourceProvider
Reviewed By: michalgr Differential Revision: D3207541 fbshipit-source-id: d53599c3cf36ae7c89e85a29f637987bc7139159
This commit is contained in:
committed by
Facebook Github Bot 7
parent
f11a783e64
commit
af24e8001a
@@ -28,11 +28,18 @@ public abstract class JSBundleLoader {
|
||||
public static JSBundleLoader createFileLoader(
|
||||
final Context context,
|
||||
final String fileName) {
|
||||
return createFileLoader(context, fileName, false);
|
||||
}
|
||||
|
||||
public static JSBundleLoader createFileLoader(
|
||||
final Context context,
|
||||
final String fileName,
|
||||
final boolean useLazyBundle) {
|
||||
return new JSBundleLoader() {
|
||||
@Override
|
||||
public void loadScript(CatalystInstanceImpl instance) {
|
||||
if (fileName.startsWith("assets://")) {
|
||||
instance.loadScriptFromAssets(context.getAssets(), fileName);
|
||||
instance.loadScriptFromAssets(context.getAssets(), fileName, useLazyBundle);
|
||||
} else {
|
||||
instance.loadScriptFromFile(fileName, fileName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user