-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to construct a new Blob() #35042
Comments
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: #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: #35042 Reviewed By: NickGerleman Differential Revision: D40716048 Pulled By: cipolleschi fbshipit-source-id: 17643d230fa7ea83baee363d137d51f87818baa8
Since the above PR was merged and reverted, can someone confirm that this is still being looked at for 0.71 per this comment by @cipolleschi ? |
The right fix has been merged in 0.71 (which will be released in a few weeks). From the OSS perspective, the commit looks the same, but we have to update an internal script to properly generate those lines. |
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: facebook#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: facebook#35042 Reviewed By: NickGerleman Differential Revision: D40716048 Pulled By: cipolleschi fbshipit-source-id: 17643d230fa7ea83baee363d137d51f87818baa8
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Description
After creating a React Native app with the new architecture enabled, using the global
Blob()
constructor resulted in the following error:Invariant Violation: NativeBlobModule is available.
This was reproducible in the following combinations:As a result of this global
Blob()
being unavailable, theblob()
method in whatwg-fetch polyfill is also now missing from Requests/Responses since the library first checks for Blob support.Version
0.70.3, 0.68-stable
Output of
npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 12.5.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 2.47 GB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.17 - ~/.yarn/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK:
API Levels: 28, 30, 31, 32
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0
System Images: android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
Languages:
Java: 12.0.2 - /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.3 => 0.70.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: