mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
279cfec55f
Summary: Currently, RCTBlobManager (the native module for Blob support) cannot be loaded on iOS when the new architecture is enabled. ## Changelog [General] [Added] - `BlobModule` to `RCTCoreModulesClassProvider` Pull Request resolved: https://github.com/facebook/react-native/pull/35047 Test Plan: The snippet below can be used to test Blob support with the new architecture enabled. ``` // App.tsx import { useEffect } from 'react'; import { View } from 'react-native'; function uriToBlob(uri: any) { return new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.responseType = 'blob'; xhr.onload = () => { const blob = xhr.response; resolve(blob); }; xhr.onerror = err => { reject(err); }; xhr.open('GET', uri); xhr.send(); }); } export default function App() { useEffect(() => { uriToBlob('https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'); }); return <View />; } ``` Related issue: https://github.com/facebook/react-native/issues/35042 Reviewed By: NickGerleman Differential Revision: D40716048 Pulled By: cipolleschi fbshipit-source-id: 17643d230fa7ea83baee363d137d51f87818baa8
59 lines
1.9 KiB
Plaintext
59 lines
1.9 KiB
Plaintext
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @generated by an internal plugin build system
|
|
*/
|
|
|
|
#ifndef RN_DISABLE_OSS_PLUGIN_HEADER
|
|
|
|
// OSS-compatibility layer
|
|
|
|
#import "CoreModulesPlugins.h"
|
|
|
|
#import <string>
|
|
#import <unordered_map>
|
|
|
|
Class RCTCoreModulesClassProvider(const char *name) {
|
|
// Intentionally leak to avoid crashing after static destructors are run.
|
|
static const auto sCoreModuleClassMap = new const std::unordered_map<std::string, Class (*)(void)>{
|
|
{"AccessibilityManager", RCTAccessibilityManagerCls},
|
|
{"Appearance", RCTAppearanceCls},
|
|
{"DeviceInfo", RCTDeviceInfoCls},
|
|
{"ExceptionsManager", RCTExceptionsManagerCls},
|
|
{"PlatformConstants", RCTPlatformCls},
|
|
{"Clipboard", RCTClipboardCls},
|
|
{"I18nManager", RCTI18nManagerCls},
|
|
{"SourceCode", RCTSourceCodeCls},
|
|
{"ActionSheetManager", RCTActionSheetManagerCls},
|
|
{"AlertManager", RCTAlertManagerCls},
|
|
{"AsyncLocalStorage", RCTAsyncLocalStorageCls},
|
|
{"Timing", RCTTimingCls},
|
|
{"StatusBarManager", RCTStatusBarManagerCls},
|
|
{"KeyboardObserver", RCTKeyboardObserverCls},
|
|
{"AppState", RCTAppStateCls},
|
|
{"PerfMonitor", RCTPerfMonitorCls},
|
|
{"DevMenu", RCTDevMenuCls},
|
|
{"DevSettings", RCTDevSettingsCls},
|
|
{"BlobModule", RCTBlobManagerCls},
|
|
{"RedBox", RCTRedBoxCls},
|
|
{"LogBox", RCTLogBoxCls},
|
|
{"WebSocketExecutor", RCTWebSocketExecutorCls},
|
|
{"WebSocketModule", RCTWebSocketModuleCls},
|
|
{"DevLoadingView", RCTDevLoadingViewCls},
|
|
{"DevSplitBundleLoader", RCTDevSplitBundleLoaderCls},
|
|
{"EventDispatcher", RCTEventDispatcherCls},
|
|
};
|
|
|
|
auto p = sCoreModuleClassMap->find(name);
|
|
if (p != sCoreModuleClassMap->end()) {
|
|
auto classFunc = p->second;
|
|
return classFunc();
|
|
}
|
|
return nil;
|
|
}
|
|
|
|
#endif // RN_DISABLE_OSS_PLUGIN_HEADER
|