react / react/react-native

When using FileReader readAsDataURL it does not load blob file, no error

未关闭
#38,230 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Issue: Author Provided Repro Needs: Triage :mag: Newer Patch Available
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

When I run this code below the load event does not print the log and therefore the blob file is not being converted into a uri.

`if (messageModel.item.image) {
console.log(messageModel.item.id, "has image");
const imgBlob = messageModel.item.image;

  let reader = new FileReader();
  reader.addEventListener(
    "load",
    () => {
      console.log("loaded");
    },
    false
  );
  reader.readAsDataURL(imgBlob);
}`
React Native Version

0.71.0

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: macOS 13.4.1
CPU: (10) arm64 Apple M1 Max
Memory: 325.55 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.15.0 - /usr/local/bin/node
Yarn: 3.4.1 - /usr/local/bin/yarn
npm: 9.5.0 - /usr/local/bin/npm
Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.0 - /Users/davidchoi/.rvm/rubies/ruby-2.7.6/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9619390
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.6 => 0.71.6
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
info React Native v0.72.1 is now available (your project is running on v0.71.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.72.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.71.6
info For more info, check out "https://reactnative.dev/docs/upgrading".

Steps to reproduce

Simply running the code I showed in a expo 48 app will do it. But you can also look at my repo if you want.

Snack, code example, screenshot, or link to a repository

This is the repo, https://github.com/jsoneaday/learn-react-native-fast. Code is in section_3/chatter

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

在链接的 repository 中的 section_3/chatter 示例中复现该问题,从 FileReader 的 readAsDataURL 调用及其 load 监听器开始。比较报告中的 React Native 0.71.6 和 Expo 48 设置下的行为,然后确定一个聚焦的复现或测试,以演示预期的 blob 转换和 load 事件。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。