React-native: FileReader .readAsDataURL not working after upgrade to RN 0.57

Created on 13 Sep 2018  路  8Comments  路  Source: facebook/react-native

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 593.19 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.3 - /usr/local/bin/node
Yarn: 1.0.2 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 21.1.2, 23.0.1, 23.0.2, 23.0.3, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.2, 27.0.3, 28.0.0
API Levels: 22, 23, 24, 25, 26, 27, 28
IDEs:
Android Studio: 3.0 AI-171.4443003
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
@storybook/react-native: ^3.4.8 => 3.4.10
@types/react: ^16.4.1 => 16.4.12
react: 16.3.1 => 16.3.1
react-native: ^0.57.0 => 0.57.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-rename: 2.2.2

Description

I need to parse an image that receive from a fetch request into an base64 string. When I as using RN 0.55.4 my code worked properly, but after upgrading to RN0.57 (and RN0.56) it didn't worked anymore.
I've logged my base64 string after upgrade, and I get:
IMAGE64 data:application/octet-stream;base64,77+977+977+977+9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...(a bunch of "A"s)

in RN0.55.4, my base64 string was totally different.

Reproducible Demo

That's how I do the request and parsing:

const reader = new FileReader();
fetch(`${ENDPOINT}/tudo/v2/services/person/profileimage`, {
          method: 'GET',
          headers: {
            Authorization: `Bearer ${token}`,
          },
        }).then((res) => res.blob())
          .then((blob) => {
            reader.readAsDataURL(blob);
            reader.onloadend = function () {
              const base64data = reader.result;
              if (base64data.length > 500) {
                AsyncStorage.setItem(`@Profile:imageBase64-${document}`, base64data);
                callback(base64data);
              }
            };
          }).catch((err) => { /* onsole.log('IMAGE ERROR', err, arguments); */ });
Ran Commands Locked

Most helpful comment

@react-native-bot It's not an older version. I've tested in the latest release. Please, reopen.

All 8 comments

It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.

The ":rewind:Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@react-native-bot the original post already states that this is on the latest version of RN. This automatic tag might have been added because RN 0.55/0.56 are mentioned but this is a false positive.

I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

@react-native-bot It's not an older version. I've tested in the latest release. Please, reopen.

is there any advance in the resolution of this issue? any workaround known? this issue is blocking my migration to 0.57

is there any advance in the resolution of this issue? any workaround known?

Is there any way we can re-open this issue?

Is there any fix for this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oney picture oney  路  3Comments

madwed picture madwed  路  3Comments

jlongster picture jlongster  路  3Comments

axelg12 picture axelg12  路  3Comments

anchetaWern picture anchetaWern  路  3Comments